Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_MCS_LOCK_H
0003 #define __ASM_MCS_LOCK_H
0004 
0005 #ifdef CONFIG_SMP
0006 #include <asm/spinlock.h>
0007 
0008 /* MCS spin-locking. */
0009 #define arch_mcs_spin_lock_contended(lock)              \
0010 do {                                    \
0011     /* Ensure prior stores are observed before we enter wfe. */ \
0012     smp_mb();                           \
0013     while (!(smp_load_acquire(lock)))               \
0014         wfe();                          \
0015 } while (0)                             \
0016 
0017 #define arch_mcs_spin_unlock_contended(lock)                \
0018 do {                                    \
0019     smp_store_release(lock, 1);                 \
0020     dsb_sev();                          \
0021 } while (0)
0022 
0023 #endif  /* CONFIG_SMP */
0024 #endif  /* __ASM_MCS_LOCK_H */