| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|---|
| 2 | #ifndef _ASM_X86_RQSPINLOCK_H |
| 3 | #define _ASM_X86_RQSPINLOCK_H |
| 4 | |
| 5 | #include <asm/paravirt.h> |
| 6 | |
| 7 | #ifdef CONFIG_PARAVIRT |
| 8 | DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key); |
| 9 | |
| 10 | #define resilient_virt_spin_lock_enabled resilient_virt_spin_lock_enabled |
| 11 | static __always_inline bool resilient_virt_spin_lock_enabled(void) |
| 12 | { |
| 13 | return static_branch_likely(&virt_spin_lock_key); |
| 14 | } |
| 15 | |
| 16 | #ifdef CONFIG_QUEUED_SPINLOCKS |
| 17 | typedef struct qspinlock rqspinlock_t; |
| 18 | #else |
| 19 | typedef struct rqspinlock rqspinlock_t; |
| 20 | #endif |
| 21 | extern int resilient_tas_spin_lock(rqspinlock_t *lock); |
| 22 | |
| 23 | #define resilient_virt_spin_lock resilient_virt_spin_lock |
| 24 | static inline int resilient_virt_spin_lock(rqspinlock_t *lock) |
| 25 | { |
| 26 | return resilient_tas_spin_lock(lock); |
| 27 | } |
| 28 | |
| 29 | #endif /* CONFIG_PARAVIRT */ |
| 30 | |
| 31 | #include <asm-generic/rqspinlock.h> |
| 32 | |
| 33 | #endif /* _ASM_X86_RQSPINLOCK_H */ |
| 34 |
