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

locking/atomic: make ARCH_ATOMIC a Kconfig symbol

Subsequent patches will move architectures over to the ARCH_ATOMIC API,
after preparing the asm-generic atomic implementations to function with
or without ARCH_ATOMIC.

As some architectures use the asm-generic implementations exclusively
(and don't have a local atomic.h), and to avoid the risk that
ARCH_ATOMIC isn't defined in some cases we expect, let's make the
ARCH_ATOMIC macro a Kconfig symbol instead, so that we can guarantee it
is consistently available where needed.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
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-2-mark.rutland@arm.com

authored by

Mark Rutland and committed by
Peter Zijlstra
9be85de9 a82adc76

+8 -7
+3
arch/Kconfig
··· 11 11 12 12 menu "General architecture-dependent options" 13 13 14 + config ARCH_ATOMIC 15 + bool 16 + 14 17 config CRASH_CORE 15 18 bool 16 19
+1
arch/arm64/Kconfig
··· 9 9 select ACPI_MCFG if (ACPI && PCI) 10 10 select ACPI_SPCR_TABLE if ACPI 11 11 select ACPI_PPTT if ACPI 12 + select ARCH_ATOMIC 12 13 select ARCH_HAS_DEBUG_WX 13 14 select ARCH_BINFMT_ELF_STATE 14 15 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
-2
arch/arm64/include/asm/atomic.h
··· 223 223 224 224 #define arch_atomic64_dec_if_positive arch_atomic64_dec_if_positive 225 225 226 - #define ARCH_ATOMIC 227 - 228 226 #endif /* __ASM_ATOMIC_H */
+1
arch/s390/Kconfig
··· 58 58 # Note: keep this list sorted alphabetically 59 59 # 60 60 imply IMA_SECURE_AND_OR_TRUSTED_BOOT 61 + select ARCH_ATOMIC 61 62 select ARCH_32BIT_USTAT_F_TINODE 62 63 select ARCH_BINFMT_ELF_STATE 63 64 select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
-2
arch/s390/include/asm/atomic.h
··· 147 147 #define arch_atomic64_fetch_sub(_i, _v) arch_atomic64_fetch_add(-(s64)(_i), _v) 148 148 #define arch_atomic64_sub(_i, _v) arch_atomic64_add(-(s64)(_i), _v) 149 149 150 - #define ARCH_ATOMIC 151 - 152 150 #endif /* __ARCH_S390_ATOMIC__ */
+1
arch/um/Kconfig
··· 5 5 config UML 6 6 bool 7 7 default y 8 + select ARCH_ATOMIC 8 9 select ARCH_EPHEMERAL_INODES 9 10 select ARCH_HAS_KCOV 10 11 select ARCH_NO_PREEMPT
+1
arch/x86/Kconfig
··· 58 58 # 59 59 select ACPI_LEGACY_TABLES_LOOKUP if ACPI 60 60 select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI 61 + select ARCH_ATOMIC 61 62 select ARCH_32BIT_OFF_T if X86_32 62 63 select ARCH_CLOCKSOURCE_INIT 63 64 select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION
-2
arch/x86/include/asm/atomic.h
··· 269 269 # include <asm/atomic64_64.h> 270 270 #endif 271 271 272 - #define ARCH_ATOMIC 273 - 274 272 #endif /* _ASM_X86_ATOMIC_H */
+1 -1
include/linux/atomic.h
··· 77 77 __ret; \ 78 78 }) 79 79 80 - #ifdef ARCH_ATOMIC 80 + #ifdef CONFIG_ARCH_ATOMIC 81 81 #include <linux/atomic-arch-fallback.h> 82 82 #include <asm-generic/atomic-instrumented.h> 83 83 #else