]> git.dujemihanovic.xyz Git - linux.git/commitdiff
xtensa: Emulate one-byte cmpxchg
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 27 Mar 2024 22:28:04 +0000 (15:28 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 13 Sep 2024 14:10:38 +0000 (07:10 -0700)
Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on xtensa.

[ paulmck: Apply kernel test robot feedback. ]
[ paulmck: Drop two-byte support per Arnd Bergmann feedback. ]
[ Apply Geert Uytterhoeven feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Yujie Liu <yujie.liu@intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
arch/xtensa/Kconfig
arch/xtensa/include/asm/cmpxchg.h

index f200a4ec044e64a9cfc58127761f0f8214553a71..d3db28f2f81108242d2bafb13503d729ba90fdb5 100644 (file)
@@ -14,6 +14,7 @@ config XTENSA
        select ARCH_HAS_DMA_SET_UNCACHED if MMU
        select ARCH_HAS_STRNCPY_FROM_USER if !KASAN
        select ARCH_HAS_STRNLEN_USER
+       select ARCH_NEED_CMPXCHG_1_EMU
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
index 675a11ea8de76baba0eb6b8ac2cd868a0fdcfd2b..95e33a913962d8b629d26b3a24c33c09fa8d2f21 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/bits.h>
 #include <linux/stringify.h>
+#include <linux/cmpxchg-emu.h>
 
 /*
  * cmpxchg
@@ -74,6 +75,7 @@ static __inline__ unsigned long
 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 {
        switch (size) {
+       case 1:  return cmpxchg_emu_u8(ptr, old, new);
        case 4:  return __cmpxchg_u32(ptr, old, new);
        default: __cmpxchg_called_with_bad_pointer();
                 return old;