fence.h 564 B

12345678910111213141516171819
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef _ASM_RISCV_FENCE_H
  3. #define _ASM_RISCV_FENCE_H
  4. #define RISCV_FENCE_ASM(p, s) "\tfence " #p "," #s "\n"
  5. #define RISCV_FENCE(p, s) \
  6. ({ __asm__ __volatile__ (RISCV_FENCE_ASM(p, s) : : : "memory"); })
  7. #ifdef CONFIG_SMP
  8. #define RISCV_ACQUIRE_BARRIER RISCV_FENCE_ASM(r, rw)
  9. #define RISCV_RELEASE_BARRIER RISCV_FENCE_ASM(rw, w)
  10. #define RISCV_FULL_BARRIER RISCV_FENCE_ASM(rw, rw)
  11. #else
  12. #define RISCV_ACQUIRE_BARRIER
  13. #define RISCV_RELEASE_BARRIER
  14. #define RISCV_FULL_BARRIER
  15. #endif
  16. #endif /* _ASM_RISCV_FENCE_H */