Skip to content

sparc32: Use CAS for atomic support

Sam Ravnborg sparclinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sparc32: Add support for specifying -mcpuarch/sparc/Kconfig arch/sparc/Makefile+29 -81 reply
2/4sparc32: Add cmpxchg support using CASarch/sparc/include/asm/cmpxchg_32.h arch/sparc/lib/atomic32.c+42 -720 replies
3/4sparc32: Add atomic bitops support using CASarch/sparc/include/asm/bitops/atomic_32.h arch/sparc/include/asm/bitops_32.h arch/sparc/lib/atomic32.c+125 -1090 replies
4/4sparc32: Add atomic support using CASarch/sparc/include/asm/atomic_32.h arch/sparc/lib/Makefile arch/sparc/lib/atomic32.c+100 -1740 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] sparc32: Use CAS for atomic support

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(-)