[PATCH RFC cmpxchg 7/8] parisc: Emulate two-byte cmpxchg

From: Paul E. McKenney
Date: Mon Apr 01 2024 - 17:40:25 EST


Use the new cmpxchg_emu_u16() to emulate two-byte cmpxchg() on parisc.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Cc: Helge Deller <deller@xxxxxx>
Cc: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>
Cc: Andrzej Hajda <andrzej.hajda@xxxxxxxxx>
Cc: <linux-parisc@xxxxxxxxxxxxxxx>
---
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/cmpxchg.h | 1 +
2 files changed, 2 insertions(+)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index daafeb20f9937..06f221a3f3459 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -15,6 +15,7 @@ config PARISC
select ARCH_HAS_STRICT_MODULE_RWX
select ARCH_HAS_UBSAN
select ARCH_HAS_PTE_SPECIAL
+ select ARCH_NEED_CMPXCHG_1_2_EMU
select ARCH_NO_SG_CHAIN
select ARCH_SUPPORTS_HUGETLBFS if PA20
select ARCH_SUPPORTS_MEMORY_FAILURE
diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
index c1d776bb16b4e..f909c000b6577 100644
--- a/arch/parisc/include/asm/cmpxchg.h
+++ b/arch/parisc/include/asm/cmpxchg.h
@@ -72,6 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
#endif
case 4: return __cmpxchg_u32((unsigned int *)ptr,
(unsigned int)old, (unsigned int)new_);
+ case 2: return cmpxchg_emu_u16((volatile u16 *)ptr, old, new);
case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff);
}
__cmpxchg_called_with_bad_pointer();
--
2.40.1