linux/Documentation/arch/riscv
JinRui 248dbaf777 riscv: report Zfhmin/Zvfhmin when Zfh/Zvfh are present
The RISC-V ISA manual specifies that Zfh implies Zfhmin, a normative
rule clarified in
https://github.com/riscv/riscv-isa-manual/pull/3070. Zvfh likewise
implies Zvfhmin, as stated by the vector extension specification.

The kernel currently reports ZFH and ZFHMIN (and ZVFH and ZVFHMIN) as
independent hwprobe bits derived only from what the device tree
declares. Platforms that declare just "zfh" (Zfh being a superset that
already contains all Zfhmin instructions) therefore report
RISCV_HWPROBE_EXT_ZFHMIN=0, which breaks userspace RVA23 conformance
checks (e.g. snapd installing core26 on riscv64).

Use the existing superset mechanism to set the implied subset bits:
  - zfh implies zfhmin
  - zvfh implies zvfhmin

Add a hwprobe selftest asserting the implication holds and update the
hwprobe documentation accordingly.

This is complementary to the rva23u64 base behavior discussion: the
RVA23 conformance query proposed there is derived from the
per-extension bits fixed here, so correct EXT_0 reporting is a
prerequisite for it to work on harts whose device tree declares only
"zfh".

Tested on a RISC-V QEMU VM whose device tree only declares "zfh" and
"zvfh": with this change both /proc/cpuinfo and the hwprobe
RISCV_HWPROBE_KEY_IMA_EXT_0 bitmap report ZFHMIN and ZVFHMIN, and the
hwprobe selftest (including the new implication check) passes.

Link: https://lore.kernel.org/kvm-riscv/20260206002349.96740-1-andrew.jones@oss.qualcomm.com/
Signed-off-by: JinRui <jinrui@haiwei.tech>
Link: https://patch.msgid.link/7190E4DB338251C3+20260811081513.2849980-1-jinrui@haiwei.tech
[pjw@kernel.org: trimmed superfluous blank line in tags]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2026-09-01 19:19:44 -06:00
..
acpi.rst docs: move riscv under arch 2023-10-10 13:37:43 -06:00
boot-image-header.rst docs: move riscv under arch 2023-10-10 13:37:43 -06:00
boot.rst docs: move riscv under arch 2023-10-10 13:37:43 -06:00
cmodx.rst Documentation: riscv: cmodx: fix typos 2026-04-30 19:51:24 -06:00
features.rst docs: kernel_feat.py: fix potential command injection 2024-01-11 09:21:01 -07:00
hwprobe.rst riscv: report Zfhmin/Zvfhmin when Zfh/Zvfh are present 2026-09-01 19:19:44 -06:00
index.rst RISC-V updates for v7.0 2026-02-12 19:17:44 -08:00
patch-acceptance.rst docs: move riscv under arch 2023-10-10 13:37:43 -06:00
uabi.rst Documentation: riscv: uabi: Clarify ISA spec version for canonical order 2026-01-14 17:16:23 -07:00
vector.rst Documentation: Fix spelling mistakes 2024-09-05 14:35:45 -06:00
vm-layout.rst Revert "RISC-V: mm: Document mmap changes" 2024-08-29 06:03:24 -07:00
zicfilp.rst riscv: Docs: fix unmatched quote warning 2026-05-13 22:21:32 -06:00
zicfiss.rst riscv: add documentation for shadow stack 2026-01-29 02:38:40 -07:00