All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] sparc32: Use CAS for atomic support
@ 2023-12-29 20:06 Sam Ravnborg
  2023-12-29 20:07 ` [PATCH 1/4] sparc32: Add support for specifying -mcpu Sam Ravnborg
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sam Ravnborg @ 2023-12-29 20:06 UTC (permalink / raw)
  To: David S. Miller, Arnd Bergmann, Andreas Larsson, sparclinux; +Cc: Sam Ravnborg

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-26 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-29 20:06 [PATCH 0/4] sparc32: Use CAS for atomic support Sam Ravnborg
2023-12-29 20:07 ` [PATCH 1/4] sparc32: Add support for specifying -mcpu Sam Ravnborg
2024-04-26 16:52   ` Andreas Larsson
2023-12-29 20:07 ` [PATCH 2/4] sparc32: Add cmpxchg support using CAS Sam Ravnborg
2023-12-29 20:08 ` [PATCH 3/4] sparc32: Add atomic bitops " Sam Ravnborg
2023-12-29 20:08 ` [PATCH 4/4] sparc32: Add atomic " Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.