barrier.h 785 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_BARRIER_H
  3. #define __ASM_BARRIER_H
  4. #ifndef __ASSEMBLY__
  5. /* The synchronize caches instruction executes as a nop on systems in
  6. which all memory references are performed in order. */
  7. #define synchronize_caches() __asm__ __volatile__ ("sync" : : : "memory")
  8. #if defined(CONFIG_SMP)
  9. #define mb() do { synchronize_caches(); } while (0)
  10. #define rmb() mb()
  11. #define wmb() mb()
  12. #define dma_rmb() mb()
  13. #define dma_wmb() mb()
  14. #else
  15. #define mb() barrier()
  16. #define rmb() barrier()
  17. #define wmb() barrier()
  18. #define dma_rmb() barrier()
  19. #define dma_wmb() barrier()
  20. #endif
  21. #define __smp_mb() mb()
  22. #define __smp_rmb() mb()
  23. #define __smp_wmb() mb()
  24. #include <asm-generic/barrier.h>
  25. #endif /* !__ASSEMBLY__ */
  26. #endif /* __ASM_BARRIER_H */