riscv: Add cpufeature parsing and hwprobe export for RVA23 extensions
Get series with b4
b4 am [email protected] change-id 20260116-isa-ext-parse-export-047c0003e12cVersions newest first
- v1 Latest8 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | riscv: cpufeature: Add parsing for Barch/ arch/ | +11 | 3 replies | |
| 2/8 | riscv: hwprobe: Add support for probing BDocumentation/ arch/ arch/ | +8 | 1 reply | |
| 3/8 | riscv: cpufeature: Enforce Ziccrse dependency on Zalrscarch/ | +10 | 0 replies | |
| 4/8 | riscv: cpufeature: Add parsing for Za64rs, Ziccamoa, Ziccif, and Zicclsmarch/ arch/ | +17 | 0 replies | |
| 5/8 | riscv: hwprobe: Add support for probing ZicclsmDocumentation/ arch/ arch/ | +6 | 0 replies | |
| 6/8 | riscv: hwprobe: Add support for probing ZiccifDocumentation/ arch/ arch/ | +5 | 0 replies | |
| 7/8 | riscv: cpufeature: Add parsing for Ssccptr, Sscounterenw, Sstvala, Sstvecd, and Ssu64xlarch/ arch/ | +10 | 0 replies | |
| 8/8 | riscv: cpufeature: Add parsing for Sha and its comprised extensionsarch/ arch/ | +32 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/8] riscv: Add cpufeature parsing and hwprobe export for RVA23 extensions
Complete the previous series [1] (Patch 6-9), which added DT bindings for extensions mandatory in the RVA23 Profile, by adding cpufeature parsing and hwprobe exports.
This patchset is organized so that cpufeature parsing and hwprobe export (when needed) are grouped together.
Patches 1-2: B extension
Patches 3: Enforce dependency checking for Ziccrse.
Patches 4-6: Handle the RVA23U64 extensions, namely Za64rs,
Ziccamoa, Ziccif, Zicclsm.
Patches 7-8: Handle the RVA23S64 extensions, namely 1) Ssccptr,
Sscounterenw, Sstvala, Sstvecd, Ssu64xl, 2) Sha and its comprised sub-extensions.
Noted that among all these extensions, I chose to hwprobe only three:
B, Ziccif and Zicclsm. My observation is all recently merged hwprobe extensions (such as Zaamo, Zicntr, Zicbom) expose instructions or CSR that userspace directly executes, or hints for userspace prefetch.
Whereas Za64rs and Ziccamoa are named features, currently I don't see a need for userspace to hwprobe them. They can be added later if a concrete userspace use case emerges.
Zicclsm is hwprobe exported, previous LKML discussion can be found here:
Conor Dooley noted the need for "bindings, detection and hwprobe key for Zicclsm" [2] after Palmer's misaligned access clarification [3].
Ziccif guarantees atomic instruction fetches for naturally aligned instructions. Exposing it through hwprobe allows userspace performing concurrent code modification (CMODX) to confirm the underlying hardware guarantee at runtime. See Documentation/arch/riscv/cmodx.rst
[4] for background.
The B extension hwprobe bit uses a system-wide check against the global ISA bitmap, following the same pattern as C in hwprobe_isa_ext0().
Zicclsm and Ziccif use the per-CPU EXT_KEY() mechanism, consistent with individual extension exports.
This series is based on next-20260123, plus the sump patchset. Tested on SpacemiT K3 PICO ITX board, checked both cat /proc/cpuinfo and a hwprobe userspace testing stub.
---
Guodong Xu (8):
riscv: cpufeature: Add parsing for B
riscv: hwprobe: Add support for probing B
riscv: cpufeature: Enforce Ziccrse dependency on Zalrsc
riscv: cpufeature: Add parsing for Za64rs, Ziccamoa, Ziccif, and Zicclsm
riscv: hwprobe: Add support for probing Zicclsm
riscv: hwprobe: Add support for probing Ziccif
riscv: cpufeature: Add parsing for Ssccptr, Sscounterenw, Sstvala, Sstvecd, and Ssu64xl
riscv: cpufeature: Add parsing for Sha and its comprised extensions
Documentation/arch/riscv/hwprobe.rst | 11 ++++++ arch/riscv/include/asm/hwcap.h | 18 ++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 3 ++ arch/riscv/kernel/cpufeature.c | 63 ++++++++++++++++++++++++++++++++++- arch/riscv/kernel/sys_hwprobe.c | 5 +++ 5 files changed, 99 insertions(+), 1 deletion(-)
---
base-commit: 4af4e95edc37ae54f64cbd75b46f16ce15f3a6b8
change-id: 20260116-isa-ext-parse-export-047c0003e12c
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: f10e134f9f9291ace47876fa4b2171094838a40b
prerequisite-patch-id: 59a67878b96d6de42a9bad35fc610ef10dabff55
prerequisite-patch-id: 30a3e1b50fc95ab5a521f4dab693d914713992f2
Best regards,
Signature · 1 line
Guodong Xu <[email protected]>