On Thu, May 30, 2024 at 10:24:05AM -0700, Paul E. McKenney wrote:
> And for an untested first attempt at a fix.
> 
> What did I mess up this time?  ;-)

An include for cmpxchg-emu.h ;)

  In file included from arch/arm/include/asm/atomic.h:16,
                   from include/linux/atomic.h:7,
                   from include/asm-generic/bitops/lock.h:5,
                   from arch/arm/include/asm/bitops.h:245,
                   from include/linux/bitops.h:63,
                   from include/linux/log2.h:12,
                   from kernel/bounds.c:13:
  arch/arm/include/asm/cmpxchg.h: In function '__cmpxchg':
  arch/arm/include/asm/cmpxchg.h:167:26: error: implicit declaration of 
function 'cmpxchg_emu_u8' [-Werror=implicit-function-declaration]
    167 |                 oldval = cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
        |                          ^~~~~~~~~~~~~~
  cc1: some warnings being treated as errors

>                                                       Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit 6e43483dd111cf1be58b02a45d0ca729ca2634ba
> Author: Paul E. McKenney <[email protected]>
> Date:   Thu May 30 10:11:31 2024 -0700
> 
>     ARM: Emulate one-byte cmpxchg
>     
>     Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on ARM systems
>     with ARCH < ARMv6K.
>     
>     Reported-by: Mark Brown <[email protected]>
>     Closes: 
> https://lore.kernel.org/all/[email protected]/
>     Reported-by: Naresh Kamboju <[email protected]>
>     Closes: 
> https://lore.kernel.org/all/CA+G9fYuZ+pf6p8AXMZWtdFtX-gbG8HMaBKp=xbxcdza_qel...@mail.gmail.com/
>     Signed-off-by: Paul E. McKenney <[email protected]>
>     Cc: "Russell King (Oracle)" <[email protected]>
>     Cc: Arnd Bergmann <[email protected]>
>     Cc: Andrew Davis <[email protected]>
>     Cc: Andrew Morton <[email protected]>
>     Cc: Linus Walleij <[email protected]>
>     Cc: Eric DeVolder <[email protected]>
>     Cc: Rob Herring <[email protected]>
>     Cc: <[email protected]>
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index ee5115252aac4..a867a7d967aa5 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -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
> diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
> index 44667bdb4707a..fd9b99f4dca46 100644
> --- a/arch/arm/include/asm/cmpxchg.h
> +++ b/arch/arm/include/asm/cmpxchg.h
> @@ -162,7 +162,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 /* min ARCH >= ARMv6K */
> +     case 1:
> +             oldval = cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
> +             break;
> +#else
>       case 1:
>               do {
>                       asm volatile("@ __cmpxchg1\n"
> 
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reply via email to