[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240408174944.907695-12-paulmck@kernel.org>
Date: Mon, 8 Apr 2024 10:49:42 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: elver@...gle.com,
akpm@...ux-foundation.org,
tglx@...utronix.de,
peterz@...radead.org,
dianders@...omium.org,
pmladek@...e.com,
torvalds@...ux-foundation.org,
Arnd Bergmann <arnd@...db.de>,
"Paul E. McKenney" <paulmck@...nel.org>,
Andi Shyti <andi.shyti@...ux.intel.com>,
Palmer Dabbelt <palmer@...osinc.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-sh@...r.kernel.org
Subject: [PATCH cmpxchg 12/14] sh: Emulate one-byte cmpxchg
Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on sh.
[ paulmck: Drop two-byte support per Arnd Bergmann feedback. ]
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Cc: Andi Shyti <andi.shyti@...ux.intel.com>
Cc: Palmer Dabbelt <palmer@...osinc.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: <linux-sh@...r.kernel.org>
---
arch/sh/Kconfig | 1 +
arch/sh/include/asm/cmpxchg.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 2ad3e29f0ebec..f47e9ccf4efd2 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -16,6 +16,7 @@ config SUPERH
select ARCH_HIBERNATION_POSSIBLE if MMU
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_WANT_IPC_PARSE_VERSION
+ select ARCH_NEED_CMPXCHG_1_EMU
select CPU_NO_EFFICIENT_FFS
select DMA_DECLARE_COHERENT
select GENERIC_ATOMIC64
diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h
index 5d617b3ef78f7..27a9040983cfe 100644
--- a/arch/sh/include/asm/cmpxchg.h
+++ b/arch/sh/include/asm/cmpxchg.h
@@ -56,6 +56,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
unsigned long new, int size)
{
switch (size) {
+ case 1:
+ return cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
case 4:
return __cmpxchg_u32(ptr, old, new);
}
--
2.40.1
Powered by blists - more mailing lists