With sparc limited to leon3 the next step was to address the atomic support which this patch set does. Gaisler already had an implementation in their kernel patch stack, that co-existed with sparc v8 without CAS support. As the sparc v8 without CAS is no longer supported this patch set takes a different approach. Using the current best practices the atomic support is implemented in three steps. The cmpxchg is updated to use casa/swap. The atomic bitops are implemented in their own file and uses a minimal of inline assembly. The atomic operations are implemented based on the template found in asm-generic. Some notes: - The code uses __always_inlin almost everywhere, where inline could be enough. Not sure what is best here. - The new (and replaced) files uses the SPDX tag: GPL-2.0 No sure if this is best practice today, I am happy to change the license. - Build tested and booted using qemu. The patches are on top of the sun4m and sun4d sunset patches. Review feedback appreciated! Sam --- Sam Ravnborg (4): sparc32: Add support for specifying -mcpu sparc32: Add cmpxchg support using CAS sparc32: Add atomic bitops support using CAS sparc32: Add atomic support using CAS arch/sparc/Kconfig | 24 +++++++++++ arch/sparc/Makefile | 13 +++--- arch/sparc/include/asm/atomic_32.h | 151 ++++++++++++++++++++++++++++++++++++++++++++----------------------- arch/sparc/include/asm/bitops/atomic_32.h | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/sparc/include/asm/bitops_32.h | 71 +------------------------------- arch/sparc/include/asm/cmpxchg_32.h | 72 ++++++++++++++++++-------------- arch/sparc/lib/Makefile | 2 +- arch/sparc/lib/atomic32.c | 202 ------------------------------------------------------------------------------------------ 8 files changed, 296 insertions(+), 363 deletions(-)