diff mbox series

[2/3] ARM: Use qspinlock implementation

Message ID 20191007214439.27891-3-sebastian@breakpoint.cc (mailing list archive)
State New, archived
Headers show
Series Queued spinlocks/RW-locks for ARM | expand

Commit Message

Sebastian Andrzej Siewior Oct. 7, 2019, 9:44 p.m. UTC
Use the generic queued spinlock implementation for spinlock. The WFE
mechanism is used as part of arch_mcs_spin_lock_contended().

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
---
 arch/arm/Kconfig                      | 1 +
 arch/arm/include/asm/Kbuild           | 1 +
 arch/arm/include/asm/spinlock.h       | 5 +++--
 arch/arm/include/asm/spinlock_types.h | 4 ++--
 4 files changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2f704531d883a..7eba89bb45755 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -35,6 +35,7 @@  config ARM
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_USE_QUEUED_RWLOCKS if !CPU_V6
+	select ARCH_USE_QUEUED_SPINLOCKS if !CPU_V6
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 5327be7572cd2..f98bcfd9612b6 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -18,6 +18,7 @@  generic-y += preempt.h
 generic-y += seccomp.h
 generic-y += serial.h
 generic-y += trace_clock.h
+generic-y += qspinlock.h
 generic-y += qrwlock.h
 
 generated-y += mach-types.h
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index e23f71b2cd43d..7f3477679eb58 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -45,6 +45,7 @@  static inline void dsb_sev(void)
 	__asm__(SEV);
 }
 
+#ifdef CONFIG_CPU_V6
 /*
  * ARMv6 ticket-based spin-locking.
  *
@@ -128,7 +129,6 @@  static inline int arch_spin_is_contended(arch_spinlock_t *lock)
 }
 #define arch_spin_is_contended	arch_spin_is_contended
 
-#ifdef CONFIG_CPU_V6
 /*
  * RWLOCKS
  *
@@ -274,7 +274,8 @@  static inline int arch_read_trylock(arch_rwlock_t *rw)
 #else
 
 #include <asm/qrwlock.h>
-#define smp_mb__after_spinlock()       smp_mb()
+#include <asm/qspinlock.h>
+#define smp_mb__after_spinlock()	smp_mb()
 
 #endif
 
diff --git a/arch/arm/include/asm/spinlock_types.h b/arch/arm/include/asm/spinlock_types.h
index c942a75250bb2..7d5200da6a5f8 100644
--- a/arch/arm/include/asm/spinlock_types.h
+++ b/arch/arm/include/asm/spinlock_types.h
@@ -6,6 +6,7 @@ 
 # error "please don't include this file directly"
 #endif
 
+#ifdef CONFIG_CPU_V6
 #define TICKET_SHIFT	16
 
 typedef struct {
@@ -29,12 +30,11 @@  typedef struct {
 	u32 lock;
 } arch_rwlock_t;
 
-#ifdef CONFIG_CPU_V6
-
 #define __ARCH_RW_LOCK_UNLOCKED                { 0 }
 
 #else
 
+#include <asm-generic/qspinlock_types.h>
 #include <asm-generic/qrwlock_types.h>
 
 #endif