mcs_spinlock.h 570 B

123456789101112131415161718192021222324
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_MCS_LOCK_H
  3. #define __ASM_MCS_LOCK_H
  4. #ifdef CONFIG_SMP
  5. #include <asm/spinlock.h>
  6. /* MCS spin-locking. */
  7. #define arch_mcs_spin_lock_contended(lock) \
  8. do { \
  9. /* Ensure prior stores are observed before we enter wfe. */ \
  10. smp_mb(); \
  11. while (!(smp_load_acquire(lock))) \
  12. wfe(); \
  13. } while (0) \
  14. #define arch_mcs_spin_unlock_contended(lock) \
  15. do { \
  16. smp_store_release(lock, 1); \
  17. dsb_sev(); \
  18. } while (0)
  19. #endif /* CONFIG_SMP */
  20. #endif /* __ASM_MCS_LOCK_H */