Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

locking/atomic: csky: move to ARCH_ATOMIC

We'd like all architectures to convert to ARCH_ATOMIC, as once all
architectures are converted it will be possible to make significant
cleanups to the atomics headers, and this will make it much easier to
generically enable atomic functionality (e.g. debug logic in the
instrumented wrappers).

As a step towards that, this patch migrates csky to ARCH_ATOMIC. The
arch code provides arch_{atomic,atomic64,xchg,cmpxchg}*(), and common
code wraps these with optional instrumentation to provide the regular
functions.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Guo Ren <guoren@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210525140232.53872-17-mark.rutland@arm.com

authored by

Mark Rutland and committed by
Peter Zijlstra
a5fb82d7 fc63a6e0

+5 -4
+1
arch/csky/Kconfig
··· 2 2 config CSKY 3 3 def_bool y 4 4 select ARCH_32BIT_OFF_T 5 + select ARCH_ATOMIC 5 6 select ARCH_HAS_DMA_PREP_COHERENT 6 7 select ARCH_HAS_GCOV_PROFILE_ALL 7 8 select ARCH_HAS_SYNC_DMA_FOR_CPU
+4 -4
arch/csky/include/asm/cmpxchg.h
··· 31 31 __ret; \ 32 32 }) 33 33 34 - #define xchg_relaxed(ptr, x) \ 34 + #define arch_xchg_relaxed(ptr, x) \ 35 35 (__xchg_relaxed((x), (ptr), sizeof(*(ptr)))) 36 36 37 37 #define __cmpxchg_relaxed(ptr, old, new, size) \ ··· 61 61 __ret; \ 62 62 }) 63 63 64 - #define cmpxchg_relaxed(ptr, o, n) \ 64 + #define arch_cmpxchg_relaxed(ptr, o, n) \ 65 65 (__cmpxchg_relaxed((ptr), (o), (n), sizeof(*(ptr)))) 66 66 67 - #define cmpxchg(ptr, o, n) \ 67 + #define arch_cmpxchg(ptr, o, n) \ 68 68 ({ \ 69 69 __typeof__(*(ptr)) __ret; \ 70 70 __smp_release_fence(); \ 71 - __ret = cmpxchg_relaxed(ptr, o, n); \ 71 + __ret = arch_cmpxchg_relaxed(ptr, o, n); \ 72 72 __smp_acquire_fence(); \ 73 73 __ret; \ 74 74 })