From: "Radim Krčmář" <radim.krcmar@oss.qualcomm.com>
To: linux-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alexandre Ghiti <alex@ghiti.fr>,
Samuel Holland <samuel.holland@sifive.com>,
Andy Chiu <andybnac@gmail.com>, Guodong Xu <guodong@riscstar.com>,
Zong Li <zong.li@sifive.com>,
Charlie Jenkins <thecharlesjenkins@gmail.com>,
Andy Chiu <tchiu@tenstorrent.com>
Subject: [PATCH v2 1/6] riscv: hwprobe: Report FP extensions only when available
Date: Tue, 10 Nov 2026 18:50:43 +0100 [thread overview]
Message-ID: <20261110175048.82208-2-radim.krcmar@oss.qualcomm.com> (raw)
In-Reply-To: <20261110175048.82208-1-radim.krcmar@oss.qualcomm.com>
User-mode use of floating-point extensions requires non-Off sstatus.FS,
which we set only when has_fpu() (CONFIG_FPU and D on all harts).
The vector floating-point extensions require non-Off sstatus.FS too, but
hwprobe gates them only on has_vector() (CONFIG_ISA_V and Zve32x on all
harts).
CONFIG_ISA_V depends on CONFIG_FPU, because V extension implies Zve64d,
but has_vector() only requires Zve32x, so has_vector() doesn't imply
has_fpu(), hence we can boot on a machine where all harts have Zve32x,
but not all harts have D.
hwprobe currently reports the extensions from the per-hart ISA bitmaps
alone, so it can advertise extensions that are always disabled in
user-mode. Report correct environment to user-mode.
Fixes: 2e2cf5581fcc ("riscv: cpufeature: add validation for zfa, zfh and zfhmin")
Fixes: de8f8282a969 ("riscv: hwprobe: add zve Vector subextensions into hwprobe interface")
Fixes: 5dadda5e6a59 ("riscv: hwprobe: export Zvfh[min] ISA extensions")
Fixes: a4863e002cf0 ("riscv: hwprobe: export bfloat16 ISA extension")
Reviewed-by: Andy Chiu <tchiu@tenstorrent.com>
Signed-off-by: Radim Krčmář <radim.krcmar@oss.qualcomm.com>
---
v2:
* added one more "Fixes:" for bfloat
* hopefully clarified the commit message around CONFIGs
* added r-b
---
arch/riscv/kernel/sys_hwprobe.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
index cd7cf272e6e1..feae40466e2b 100644
--- a/arch/riscv/kernel/sys_hwprobe.c
+++ b/arch/riscv/kernel/sys_hwprobe.c
@@ -146,15 +146,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
if (has_vector()) {
EXT_KEY(isainfo->isa, ZVBB, pair->value, missing);
EXT_KEY(isainfo->isa, ZVBC, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVE32F, pair->value, missing);
EXT_KEY(isainfo->isa, ZVE32X, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVE64D, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVE64F, pair->value, missing);
EXT_KEY(isainfo->isa, ZVE64X, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVFBFMIN, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVFBFWMA, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVFH, pair->value, missing);
- EXT_KEY(isainfo->isa, ZVFHMIN, pair->value, missing);
EXT_KEY(isainfo->isa, ZVKB, pair->value, missing);
EXT_KEY(isainfo->isa, ZVKG, pair->value, missing);
EXT_KEY(isainfo->isa, ZVKNED, pair->value, missing);
@@ -163,14 +156,26 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
EXT_KEY(isainfo->isa, ZVKSED, pair->value, missing);
EXT_KEY(isainfo->isa, ZVKSH, pair->value, missing);
EXT_KEY(isainfo->isa, ZVKT, pair->value, missing);
+
+ if (has_fpu()) {
+ EXT_KEY(isainfo->isa, ZVE32F, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVE64D, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVE64F, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVFBFMIN, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVFBFWMA, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVFH, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZVFHMIN, pair->value, missing);
+ }
}
- EXT_KEY(isainfo->isa, ZCD, pair->value, missing);
- EXT_KEY(isainfo->isa, ZCF, pair->value, missing);
- EXT_KEY(isainfo->isa, ZFA, pair->value, missing);
- EXT_KEY(isainfo->isa, ZFBFMIN, pair->value, missing);
- EXT_KEY(isainfo->isa, ZFH, pair->value, missing);
- EXT_KEY(isainfo->isa, ZFHMIN, pair->value, missing);
+ if (has_fpu()) {
+ EXT_KEY(isainfo->isa, ZCD, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZCF, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZFA, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZFBFMIN, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZFH, pair->value, missing);
+ EXT_KEY(isainfo->isa, ZFHMIN, pair->value, missing);
+ }
if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM))
EXT_KEY(isainfo->isa, SUPM, pair->value, missing);
--
2.55.0
next prev parent reply other threads:[~2026-11-10 17:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 17:50 [PATCH v2 0/6] riscv: hwprobe: do not report disabled extensions Radim Krčmář
2026-11-10 17:50 ` Radim Krčmář [this message]
2026-11-10 17:50 ` [PATCH v2 2/6] riscv: hwprobe: Report Zicbom and Zicboz only when available Radim Krčmář
2026-11-10 17:50 ` [PATCH v2 3/6] riscv: hwprobe: Report Zicfilp and Zicfiss " Radim Krčmář
2026-11-10 17:50 ` [PATCH v2 4/6] riscv: hwprobe: Report Supm " Radim Krčmář
2026-11-10 17:50 ` [PATCH v2 5/6] riscv: hwprobe: Report XTheadVector " Radim Krčmář
2026-11-10 17:50 ` [PATCH v2 6/6] riscv: hwprobe: Report SiFive vector extensions " Radim Krčmář
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=20261110175048.82208-2-radim.krcmar@oss.qualcomm.com \
--to=radim.krcmar@oss.qualcomm.com \
--cc=alex@ghiti.fr \
--cc=andybnac@gmail.com \
--cc=guodong@riscstar.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=samuel.holland@sifive.com \
--cc=tchiu@tenstorrent.com \
--cc=thecharlesjenkins@gmail.com \
--cc=zong.li@sifive.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®