Skip to content

Commit e799bef

Browse files
committed
xtensa: Emulate one-byte cmpxchg
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 <[email protected]> Tested-by: Yujie Liu <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: "Peter Zijlstra (Intel)" <[email protected]>
1 parent c81a748 commit e799bef

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

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)