Skip to content

Commit 3cf5406

Browse files
paulmckrcugregkh
authored andcommitted
xtensa: Emulate one-byte cmpxchg
commit e799bef upstream. 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> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ac499b4 commit 3cf5406

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

arch/xtensa/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config XTENSA
1414
select ARCH_HAS_DMA_SET_UNCACHED if MMU
1515
select ARCH_HAS_STRNCPY_FROM_USER if !KASAN
1616
select ARCH_HAS_STRNLEN_USER
17+
select ARCH_NEED_CMPXCHG_1_EMU
1718
select ARCH_USE_MEMTEST
1819
select ARCH_USE_QUEUED_RWLOCKS
1920
select ARCH_USE_QUEUED_SPINLOCKS

arch/xtensa/include/asm/cmpxchg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <linux/bits.h>
1717
#include <linux/stringify.h>
18+
#include <linux/cmpxchg-emu.h>
1819

1920
/*
2021
* cmpxchg
@@ -74,6 +75,7 @@ static __inline__ unsigned long
7475
__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
7576
{
7677
switch (size) {
78+
case 1: return cmpxchg_emu_u8(ptr, old, new);
7779
case 4: return __cmpxchg_u32(ptr, old, new);
7880
default: __cmpxchg_called_with_bad_pointer();
7981
return old;

0 commit comments

Comments
 (0)