* [PATCH] riscv: enable HAVE_CMPXCHG_{DOUBLE,LOCAL}
@ 2026-02-20 7:44 Miquel Sabaté Solà
2026-03-11 8:17 ` Miquel Sabaté Solà
0 siblings, 1 reply; 2+ messages in thread
From: Miquel Sabaté Solà @ 2026-02-20 7:44 UTC (permalink / raw)
To: pjw
Cc: palmer, alex, corbet, linux-riscv, linux-doc, linux-kernel,
Miquel Sabaté Solà
Support for atomic Compare-And-Swap instructions has been in the RISC-V
port of the Linux kernel for a long time. That being said, we apparently
never bothered to set HAVE_CMPXCHG_DOUBLE and HAVE_CMPXCHG_LOCAL in the
Kconfig, despite having all the framework to support them.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
---
I have built this patch with multiple configurations and ran it with KVM
(the VisionFive2 board that I have lacks the needed extensions). All seems
to work, but I do wonder if we did not enable these for a reason or this
just slipped through. So far in the code I believe everything is in place,
and I haven't seen any commit in the git log stating otherwise.
Documentation/features/locking/cmpxchg-local/arch-support.txt | 2 +-
arch/riscv/Kconfig | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/features/locking/cmpxchg-local/arch-support.txt b/Documentation/features/locking/cmpxchg-local/arch-support.txt
index 2c3a4b91f16d..28d5fa8c3b4f 100644
--- a/Documentation/features/locking/cmpxchg-local/arch-support.txt
+++ b/Documentation/features/locking/cmpxchg-local/arch-support.txt
@@ -20,7 +20,7 @@
| openrisc: | TODO |
| parisc: | TODO |
| powerpc: | TODO |
- | riscv: | TODO |
+ | riscv: | ok |
| s390: | ok |
| sh: | TODO |
| sparc: | TODO |
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 7e76b6316425..7c6726a8d738 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -151,6 +151,8 @@ config RISCV
select HAVE_ARCH_USERFAULTFD_WP if 64BIT && MMU && USERFAULTFD && RISCV_ISA_SVRSW60T59B
select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
select HAVE_ASM_MODVERSIONS
+ select HAVE_CMPXCHG_DOUBLE if RISCV_ISA_ZACAS && RISCV_ISA_ZABHA
+ select HAVE_CMPXCHG_LOCAL if RISCV_ISA_ZACAS && RISCV_ISA_ZABHA
select HAVE_CONTEXT_TRACKING_USER
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_CONTIGUOUS if MMU
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] riscv: enable HAVE_CMPXCHG_{DOUBLE,LOCAL}
2026-02-20 7:44 [PATCH] riscv: enable HAVE_CMPXCHG_{DOUBLE,LOCAL} Miquel Sabaté Solà
@ 2026-03-11 8:17 ` Miquel Sabaté Solà
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Sabaté Solà @ 2026-03-11 8:17 UTC (permalink / raw)
To: pjw; +Cc: palmer, alex, corbet, linux-riscv, linux-doc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]
Miquel Sabaté Solà @ 2026-02-20 08:44 +01:
> Support for atomic Compare-And-Swap instructions has been in the RISC-V
> port of the Linux kernel for a long time. That being said, we apparently
> never bothered to set HAVE_CMPXCHG_DOUBLE and HAVE_CMPXCHG_LOCAL in the
> Kconfig, despite having all the framework to support them.
>
> Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
> ---
> I have built this patch with multiple configurations and ran it with KVM
> (the VisionFive2 board that I have lacks the needed extensions). All seems
> to work, but I do wonder if we did not enable these for a reason or this
> just slipped through. So far in the code I believe everything is in place,
> and I haven't seen any commit in the git log stating otherwise.
>
> Documentation/features/locking/cmpxchg-local/arch-support.txt | 2 +-
> arch/riscv/Kconfig | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/features/locking/cmpxchg-local/arch-support.txt b/Documentation/features/locking/cmpxchg-local/arch-support.txt
> index 2c3a4b91f16d..28d5fa8c3b4f 100644
> --- a/Documentation/features/locking/cmpxchg-local/arch-support.txt
> +++ b/Documentation/features/locking/cmpxchg-local/arch-support.txt
> @@ -20,7 +20,7 @@
> | openrisc: | TODO |
> | parisc: | TODO |
> | powerpc: | TODO |
> - | riscv: | TODO |
> + | riscv: | ok |
> | s390: | ok |
> | sh: | TODO |
> | sparc: | TODO |
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 7e76b6316425..7c6726a8d738 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -151,6 +151,8 @@ config RISCV
> select HAVE_ARCH_USERFAULTFD_WP if 64BIT && MMU && USERFAULTFD && RISCV_ISA_SVRSW60T59B
> select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
> select HAVE_ASM_MODVERSIONS
> + select HAVE_CMPXCHG_DOUBLE if RISCV_ISA_ZACAS && RISCV_ISA_ZABHA
> + select HAVE_CMPXCHG_LOCAL if RISCV_ISA_ZACAS && RISCV_ISA_ZABHA
> select HAVE_CONTEXT_TRACKING_USER
> select HAVE_DEBUG_KMEMLEAK
> select HAVE_DMA_CONTIGUOUS if MMU
Gentle ping :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 897 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-11 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 7:44 [PATCH] riscv: enable HAVE_CMPXCHG_{DOUBLE,LOCAL} Miquel Sabaté Solà
2026-03-11 8:17 ` Miquel Sabaté Solà
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox