From: Sam Ravnborg <sam@ravnborg.org>
To: "David S. Miller" <davem@davemloft.net>,
Arnd Bergmann <arnd@kernel.org>,
Andreas Larsson <andreas@gaisler.com>,
sparclinux@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 0/4] sparc32: Use CAS for atomic support
Date: Fri, 29 Dec 2023 21:06:04 +0100 [thread overview]
Message-ID: <20231229200604.GA4033529@ravnborg.org> (raw)
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(-)
next reply other threads:[~2023-12-29 20:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-29 20:06 Sam Ravnborg [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231229200604.GA4033529@ravnborg.org \
--to=sam@ravnborg.org \
--cc=andreas@gaisler.com \
--cc=arnd@kernel.org \
--cc=davem@davemloft.net \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.