mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

When CONFIG_RISCV_QUEUED_SPINLOCKS=y, the _Q_PENDING_LOOPS
definition is missing. Add the _Q_PENDING_LOOPS definition for
pure qspinlock usage.
Fixes: ab83647fad
("riscv: Add qspinlock support")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20241215135252.201983-1-guoren@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __ASM_RISCV_SPINLOCK_H
|
|
#define __ASM_RISCV_SPINLOCK_H
|
|
|
|
#ifdef CONFIG_QUEUED_SPINLOCKS
|
|
#define _Q_PENDING_LOOPS (1 << 9)
|
|
#endif
|
|
|
|
#ifdef CONFIG_RISCV_COMBO_SPINLOCKS
|
|
|
|
#define __no_arch_spinlock_redefine
|
|
#include <asm/ticket_spinlock.h>
|
|
#include <asm/qspinlock.h>
|
|
#include <asm/jump_label.h>
|
|
|
|
/*
|
|
* TODO: Use an alternative instead of a static key when we are able to parse
|
|
* the extensions string earlier in the boot process.
|
|
*/
|
|
DECLARE_STATIC_KEY_TRUE(qspinlock_key);
|
|
|
|
#define SPINLOCK_BASE_DECLARE(op, type, type_lock) \
|
|
static __always_inline type arch_spin_##op(type_lock lock) \
|
|
{ \
|
|
if (static_branch_unlikely(&qspinlock_key)) \
|
|
return queued_spin_##op(lock); \
|
|
return ticket_spin_##op(lock); \
|
|
}
|
|
|
|
SPINLOCK_BASE_DECLARE(lock, void, arch_spinlock_t *)
|
|
SPINLOCK_BASE_DECLARE(unlock, void, arch_spinlock_t *)
|
|
SPINLOCK_BASE_DECLARE(is_locked, int, arch_spinlock_t *)
|
|
SPINLOCK_BASE_DECLARE(is_contended, int, arch_spinlock_t *)
|
|
SPINLOCK_BASE_DECLARE(trylock, bool, arch_spinlock_t *)
|
|
SPINLOCK_BASE_DECLARE(value_unlocked, int, arch_spinlock_t)
|
|
|
|
#elif defined(CONFIG_RISCV_QUEUED_SPINLOCKS)
|
|
|
|
#include <asm/qspinlock.h>
|
|
|
|
#else
|
|
|
|
#include <asm/ticket_spinlock.h>
|
|
|
|
#endif
|
|
|
|
#include <asm/qrwlock.h>
|
|
|
|
#endif /* __ASM_RISCV_SPINLOCK_H */
|