synch.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_SYNCH_H
  3. #define _ASM_POWERPC_SYNCH_H
  4. #ifdef __KERNEL__
  5. #include <asm/feature-fixups.h>
  6. #include <asm/asm-const.h>
  7. #ifndef __ASSEMBLY__
  8. extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
  9. extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
  10. void *fixup_end);
  11. static inline void eieio(void)
  12. {
  13. __asm__ __volatile__ ("eieio" : : : "memory");
  14. }
  15. static inline void isync(void)
  16. {
  17. __asm__ __volatile__ ("isync" : : : "memory");
  18. }
  19. #endif /* __ASSEMBLY__ */
  20. #if defined(__powerpc64__)
  21. # define LWSYNC lwsync
  22. #elif defined(CONFIG_E500)
  23. # define LWSYNC \
  24. START_LWSYNC_SECTION(96); \
  25. sync; \
  26. MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup);
  27. #else
  28. # define LWSYNC sync
  29. #endif
  30. #ifdef CONFIG_SMP
  31. #define __PPC_ACQUIRE_BARRIER \
  32. START_LWSYNC_SECTION(97); \
  33. isync; \
  34. MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup);
  35. #define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER)
  36. #define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n"
  37. #define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(sync) "\n"
  38. #define PPC_ATOMIC_EXIT_BARRIER "\n" stringify_in_c(sync) "\n"
  39. #else
  40. #define PPC_ACQUIRE_BARRIER
  41. #define PPC_RELEASE_BARRIER
  42. #define PPC_ATOMIC_ENTRY_BARRIER
  43. #define PPC_ATOMIC_EXIT_BARRIER
  44. #endif
  45. #endif /* __KERNEL__ */
  46. #endif /* _ASM_POWERPC_SYNCH_H */