Skip to content

Commit c4b729b

Browse files
committed
Merge tag 'cmpxchg.2024.07.12a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull arm byte cmpxchg from Paul McKenney: "ARM: Provide one-byte cmpxchg emulation This provides emulated one-byte cmpxchg() support for ARM using the cmpxchg_emu_u8() function that uses a four-byte cmpxchg() to emulate the one-byte variant. Similar patches for emulation of one-byte cmpxchg() for arc, sh, and xtensa have not yet received maintainer acks, so they are slated for the v6.12 merge window" * tag 'cmpxchg.2024.07.12a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: ARM: Emulate one-byte cmpxchg
2 parents 4fd9435 + f1b5644 commit c4b729b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ config ARM
3434
select ARCH_MIGHT_HAVE_PC_PARPORT
3535
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
3636
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
37+
select ARCH_NEED_CMPXCHG_1_EMU if CPU_V6
3738
select ARCH_SUPPORTS_ATOMIC_RMW
3839
select ARCH_SUPPORTS_CFI_CLANG
3940
select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE

arch/arm/include/asm/cmpxchg.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/irqflags.h>
66
#include <linux/prefetch.h>
77
#include <asm/barrier.h>
8+
#include <linux/cmpxchg-emu.h>
89

910
#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
1011
/*
@@ -162,7 +163,11 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
162163
prefetchw((const void *)ptr);
163164

164165
switch (size) {
165-
#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
166+
#ifdef CONFIG_CPU_V6 /* ARCH == ARMv6 */
167+
case 1:
168+
oldval = cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
169+
break;
170+
#else /* min ARCH > ARMv6 */
166171
case 1:
167172
do {
168173
asm volatile("@ __cmpxchg1\n"

0 commit comments

Comments
 (0)