[PATCH v9 0/4] riscv: hwprobe: Expose RVA23U64 base behavior

From: Guodong Xu

Date: Mon Nov 09 2026 - 07:53:06 EST


This series builds on Andrew Jones's earlier RFC [1]. It lets userspace
check for RVA23U64 conformance in one call, instead of walking hwprobe +
prctl across every mandatory extension.

The series adds a small framework that resolves profile-class bases
(currently RVA23U64) from the kernel's ISA extension bitmap at init time,
and surfaces the result, together with the IMA base, through both
/proc/cpuinfo and hwprobe. Later patches can add other bases, such as
RVA23S64 or RVA20U64, to riscv_set_isa_bases() without changes to the
surrounding code.

Between v9 and v8, this series was discussed at the RISE Platform WG
bi-weekly meeting (16 Sep), the GNU Tools Cauldron (3 Oct) and the Linux
Plumbers Conf. 2026 RISC-V microconference (6 Oct). v9 takes in the
feedback collected there.

Patches 1-8 of v8 were applied by Paul and are in v7.4-rc1. v9 carries
the remaining three, rebased onto v7.4-rc1, and adds one documentation
patch.

Three changes since v8.

>From Radim's review of v8 11/11 [3]:
- In hwprobe, RVA23U64 is now reported only when F, D, C, V, Zicbom and
Zicboz are present on every hart, as the kernel handles these across all
harts.
- A new patch 4 adds a note to hwprobe.rst that clarifies what "supported"
means for a hwprobe bit. Radim's series (v1) [4] applies the same rule
to the extension keys.

Note: patch 4 states the rule for all hwprobe keys, but some keys only
follow it with Radim's series [4]. I am fine with patch 4 being applied
after [4]. Patches 1-3 do not depend on [4].

>From the discussion at the LPC 2026 RISC-V microconference [5]:
- The IMA base is left as it is in mainline. v8 derived
RISCV_HWPROBE_BASE_BEHAVIOR_IMA from I, M and A. v9 reverts it to
hardcoded in patch 3 and sets it unconditionally in patch 1, since the
IMA base is not just those three extensions.

Palmer, I would appreciate your view on the IMA handling in patches 1
and 3.

Series outline (v9):

1 (9 in v8): cpufeature: per-hart and host-wide isa_bases bitmaps;
RVA23U64 detection lives here.
2 (10 in v8): /proc/cpuinfo: print "isa bases:" and "hart isa
bases:", e.g. "rv64ima rva23u64".
3 (11 in v8): hwprobe: expose RVA23U64 as
RISCV_HWPROBE_BASE_BEHAVIOR_RVA23U64.
4 (new): hwprobe.rst: note on what "supported" means for a
hwprobe bit.

Follow-ups I plan to post separately:

- A series exposing these extensions to KVM guests (extending the KVM
ISA extension ONE_REG interface), on top of this one.
- A series adding further bases: RVA20U64 first, then RVA22U64 and
RVA23S64. RVA20U64 also needs Za128rs support in the kernel, which
will be part of that series.

Tested on QEMU (virt machine, 4 harts):
1) With '-cpu rva23s64,sv39=on', /proc/cpuinfo reports
"isa bases : rv64ima rva23u64"
on both the aggregated and per-hart lines, and hwprobe
RISCV_HWPROBE_KEY_BASE_BEHAVIOR returns
BASE_BEHAVIOR_IMA | BASE_BEHAVIOR_RVA23U64
through both the vDSO and the raw syscall. The riscv/hwprobe
kselftests pass.
2) With '-cpu rva22s64', /proc/cpuinfo reports "isa bases : rv64ima"
and hwprobe returns BASE_BEHAVIOR_IMA only.
3) With device trees in which one hart lacks an extension: when that
extension is D, C, V, Zicbom or Zicboz, RVA23U64 is not reported for
any CPU.

A branch is available for all patches in the series: [2].

Thanks,
Guodong Xu

Link: https://lore.kernel.org/linux-riscv/20260206002349.96740-1-andrew.jones@xxxxxxxxxxxxxxxx/ [1]
Link: https://github.com/docularxu/linux/commits/b4/rva23u64-hwprobe-v9/ [2]
Link: https://lore.kernel.org/linux-riscv/DLUD4XZN9F16.2LBMTP1H5Q1VC@xxxxxxxxxxxxxxxx/ [3]
Link: https://lore.kernel.org/linux-riscv/20261006075303.205216-1-radim.krcmar@xxxxxxxxxxxxxxxx/ [4]
Link: https://lpc.events/event/20/contributions/2626/attachments/1995/5001/FYI-post-talk-speakers-summary-2026-10-11.pdf [5]
Link: https://lore.kernel.org/all/c24e720e279fed0296f1f78630b6a471.guodong.xu@xxxxxxxxxxxxxxxx/ [6]

Changes in v9:
- Dropped patches 1-8 of v8, which have been applied by Paul. Rebased
the remaining three onto v7.4-rc1; patch 2 (10 in v8) has no other
change.
- Patch 1 (9 in v8): set the IMA base unconditionally; do not derive it
from I, M and A.
- Patch 3 (11 in v8):
- Report RVA23U64 only when F, D, C, V, Zicbom and Zicboz are present
on every hart (Radim).
- Revert RISCV_HWPROBE_BASE_BEHAVIOR_IMA to hardcoded; do not compute
it from I, M and A.
- Reword the commit message.
- Update the hwprobe.rst.
- New patch 4: add a note to hwprobe.rst that clarifies what
"supported" means for a hwprobe bit (Radim).
- Link to v8: https://patch.msgid.link/20260920-rva23u64-hwprobe-v2-v8-0-5f14bc5c23d3@xxxxxxxxxxxxxxxx

Changes in v8:
- Patch 10: Andrew Jones is the author; most of the code is still his
from the RFC. Added my Co-developed-by (Conor).
- Patches 09 and 11: added Co-developed-by for Andrew Jones ahead of
his Signed-off-by; the RVA23U64 bit, the hwprobe.rst text and the
mandate list came from his RFC (Conor).
- Rebased onto riscv/for-next at e11160948333. Patch 11 drops its own
pair->value = 0 in the BASE_BEHAVIOR case, since commit d0fc6fab2046
("riscv: hwprobe: initialize pair->value in hwprobe_one_pair()") now
zeroes it for every key. No other code change since v7.
- Link to v7: https://patch.msgid.link/20260915-rva23u64-hwprobe-v2-v7-0-aa35ebd9ae96@xxxxxxxxxxxxxxxx

Changes in v7:
- Patch 09: register riscv_init_isa_bases() at arch_initcall so the vDSO
hwprobe snapshot (arch_initcall_sync) sees the ISA bases; v6 returned 0
for RISCV_HWPROBE_KEY_BASE_BEHAVIOR through the vDSO, IMA bit included,
while the syscall path was correct [6].
- Patch 09: keep riscv_isa_bases static and add riscv_isa_base_available(),
mirroring the extension accessor; patches 10 and 11 use it.
- Collected Acked-by from Conor Dooley on patches 02 and 03.
- Rebased onto riscv/for-next at 77ae27fd98f3 (post 7.3 merge window);
no code adaptation needed.
- Link to v6: https://patch.msgid.link/20260812-rva23u64-hwprobe-v2-v6-0-c985af3256b8@xxxxxxxxxxxxxxxx

Changes in v6:
- Rebased onto riscv/for-next; dropped patches 1-6 of v5, which have been
applied by Paul.
- dt-bindings block-size: only match nodes that have
riscv,isa-extensions (fix suggested by Conor, breakage reported by
Rob's bot).
- Zic64b dt-binding: guard the zic64b rule the same way (same defect
class, found while fixing the above).
- Follow the _BITULL() style of commit 8da45c93dfa9 ("RISC-V: hwprobe:
Use BIT macro to avoid warnings") for the new hwprobe bits (EXT_B,
EXT_ZIC64B, BASE_BEHAVIOR_RVA23U64).
- Zic64b: RISCV_ISA_EXT_ZIC64B renumbered 110 to 116 after upstream
additions took 106-111.
- Link to v5: https://patch.msgid.link/20260701-rva23u64-hwprobe-v2-v5-0-2c61f94a695a@xxxxxxxxx

Changes in v5:
- Rebased onto v7.2-rc1.
- New patch: make riscv,cbom/cbop/cboz-block-size required whenever the
matching Zicbom/Zicbop/Zicboz extension is present (Conor).
- Ziccamoa/Za64rs: drop the Zaamo/Zalrsc validate callbacks (Conor).
- Zic64b dt-binding: fix a double space in the commit message (Conor).
- Collected Reviewed-by and Acked-by tags in v4.
- Link to v4: https://patch.msgid.link/20260611-rva23u64-hwprobe-v2-v4-0-3f01a2449488@xxxxxxxxx

Changes in v4:
- New patch: sort the multi-letter Z extensions alphanumerically in the
dt-binding (Conor), and place zic64b at its sorted position.
- Zic64b cpufeature: validate only the CBO block sizes that are present;
overlaps Qingwei Hu's earlier patch, so it is now authored by Qingwei.
- Document EXT_ZICFISS / EXT_ZICFILP: cite the riscv-cfi v1.0 tag commit.
- Picked up Inochi Amaoto's Acked-by (SG2044 dts) and Andrew Jones's
Reviewed-by (documentation patch).
- Link to v3: https://patch.msgid.link/20260603-rva23u64-hwprobe-v2-v3-0-5529a7b28384@xxxxxxxxx

Changes in v3:
- Add Zic64b as a first-class ISA extension: dt-binding, cpufeature
parsing with a validate check, hwprobe export, and device-tree
declarations for K3/K1/SG2044.
- Patch 1 is now a clean up of hwprobe.rst indentation.
- Document RISCV_HWPROBE_EXT_ZICFILP alongside ZICFISS.
- Move the Zicclsm hwprobe.rst entry to the IMA_EXT_1 section to match
its bit allocation.
- Collect Anup Patel's Acked-by/Reviewed-by on Patch 3, the capitalization.
- In cpufeature.c, set the local ext_mask with __set_bit().
- Update Guodong Xu's email to docular.xu@xxxxxxxxx.
- Link to v2: https://patch.msgid.link/20260511-rva23u64-hwprobe-v2-v2-0-21c5a544f1dc@xxxxxxxxxxxx

Changes in v2 (since Andrew's RFC v1):
- Rebased onto v7.1-rc2.
- Reworked rva23u64 detection into per-hart and host isa_bases bitmaps,
shared by /proc/cpuinfo and hwprobe.
- Scoped to IMA and RVA23U64 (RVA23S64, RVA20/RVA22 cpuinfo output deferred).
- Link to v1: https://lore.kernel.org/linux-riscv/20260206002349.96740-1-andrew.jones@xxxxxxxxxxxxxxxx

Signed-off-by: Guodong Xu <guodong.xu@xxxxxxxxxxxxxxxx>
---
Andrew Jones (1):
riscv: cpu: Output isa bases lines in cpuinfo

Guodong Xu (3):
riscv: cpufeature: Introduce ISA bases bitmap and rva23u64 detection
riscv: hwprobe: Introduce rva23u64 base behavior
riscv: hwprobe: Document that keys describe the user-mode environment

Documentation/arch/riscv/hwprobe.rst | 29 ++++++
arch/riscv/include/asm/cpufeature.h | 13 +++
arch/riscv/include/uapi/asm/hwprobe.h | 3 +-
arch/riscv/kernel/cpu.c | 26 +++++
arch/riscv/kernel/cpufeature.c | 109 +++++++++++++++++++++
arch/riscv/kernel/sys_hwprobe.c | 34 ++++++-
tools/testing/selftests/riscv/hwprobe/which-cpus.c | 2 +-
7 files changed, 211 insertions(+), 5 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260508-rva23u64-hwprobe-v2-1d20739cbb8e

Best regards,
--
Guodong Xu <guodong.xu@xxxxxxxxxxxxxxxx>