Commit c4b729b0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 4fd94356 f1b56448
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ config ARM
	select ARCH_MIGHT_HAVE_PC_PARPORT
	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
	select ARCH_NEED_CMPXCHG_1_EMU if CPU_V6
	select ARCH_SUPPORTS_ATOMIC_RMW
	select ARCH_SUPPORTS_CFI_CLANG
	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+6 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include <linux/irqflags.h>
#include <linux/prefetch.h>
#include <asm/barrier.h>
#include <linux/cmpxchg-emu.h>

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

	switch (size) {
#ifndef CONFIG_CPU_V6	/* min ARCH >= ARMv6K */
#ifdef CONFIG_CPU_V6	/* ARCH == ARMv6 */
	case 1:
		oldval = cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
		break;
#else /* min ARCH > ARMv6 */
	case 1:
		do {
			asm volatile("@ __cmpxchg1\n"