barrier.h 892 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copied from the kernel sources to tools/perf/:
  4. *
  5. * Generic barrier definitions.
  6. *
  7. * It should be possible to use these on really simple architectures,
  8. * but it serves more as a starting point for new ports.
  9. *
  10. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  11. * Written by David Howells (dhowells@redhat.com)
  12. */
  13. #ifndef __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
  14. #define __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
  15. #ifndef __ASSEMBLY__
  16. #include <linux/compiler.h>
  17. /*
  18. * Force strict CPU ordering. And yes, this is required on UP too when we're
  19. * talking to devices.
  20. *
  21. * Fall back to compiler barriers if nothing better is provided.
  22. */
  23. #ifndef mb
  24. #define mb() barrier()
  25. #endif
  26. #ifndef rmb
  27. #define rmb() mb()
  28. #endif
  29. #ifndef wmb
  30. #define wmb() mb()
  31. #endif
  32. #endif /* !__ASSEMBLY__ */
  33. #endif /* __TOOLS_LINUX_ASM_GENERIC_BARRIER_H */