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 6/6] riscv: hwprobe: Report SiFive vector extensions only when available
Date: Tue, 10 Nov 2026 18:50:48 +0100 [thread overview]
Message-ID: <20261110175048.82208-7-radim.krcmar@oss.qualcomm.com> (raw)
In-Reply-To: <20261110175048.82208-1-radim.krcmar@oss.qualcomm.com>
User-mode use of the SiFive vector extensions requires non-Off
sstatus.VS, which we set only when has_vector() (Zve32x on all harts).
Xsfvfnrclipxfqf and Xsfvfwmaccqqq also execute floating-point
instructions, which additionally require non-Off sstatus.FS and hence
has_fpu() (D on all harts).
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: 1a6274f03534 ("riscv: hwprobe: Add SiFive vendor extension support and probe for xsfqmaccdod and xsfqmaccqoq")
Fixes: 1d91224394c9 ("riscv: hwprobe: Add SiFive xsfvfnrclipxfqf vendor extension")
Fixes: d9669e33c8fa ("riscv: hwprobe: Add SiFive xsfvfwmaccqqq vendor extension")
Reviewed-by: Andy Chiu <tchiu@tenstorrent.com>
Signed-off-by: Radim Krčmář <radim.krcmar@oss.qualcomm.com>
---
v2:
* slightly reworded commit message
* added r-b
---
.../kernel/vendor_extensions/sifive_hwprobe.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/kernel/vendor_extensions/sifive_hwprobe.c b/arch/riscv/kernel/vendor_extensions/sifive_hwprobe.c
index 1f77f6309763..bcea4f7a81c4 100644
--- a/arch/riscv/kernel/vendor_extensions/sifive_hwprobe.c
+++ b/arch/riscv/kernel/vendor_extensions/sifive_hwprobe.c
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
+#include <asm/switch_to.h>
+#include <asm/vector.h>
#include <asm/vendor_extensions/sifive.h>
#include <asm/vendor_extensions/sifive_hwprobe.h>
#include <asm/vendor_extensions/vendor_hwprobe.h>
@@ -14,9 +16,13 @@ void hwprobe_isa_vendor_ext_sifive_0(struct riscv_hwprobe *pair, const struct cp
{
VENDOR_EXTENSION_SUPPORTED(pair, cpus,
riscv_isa_vendor_ext_list_sifive.per_hart_isa_bitmap, {
- VENDOR_EXT_KEY(XSFVQMACCDOD);
- VENDOR_EXT_KEY(XSFVQMACCQOQ);
- VENDOR_EXT_KEY(XSFVFNRCLIPXFQF);
- VENDOR_EXT_KEY(XSFVFWMACCQQQ);
+ if (has_vector()) {
+ VENDOR_EXT_KEY(XSFVQMACCDOD);
+ VENDOR_EXT_KEY(XSFVQMACCQOQ);
+ if (has_fpu()) {
+ VENDOR_EXT_KEY(XSFVFNRCLIPXFQF);
+ VENDOR_EXT_KEY(XSFVFWMACCQQQ);
+ }
+ }
});
}
--
2.55.0
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 ` [PATCH v2 1/6] riscv: hwprobe: Report FP extensions only when available Radim Krčmář
2026-11-10 17:50 ` [PATCH v2 2/6] riscv: hwprobe: Report Zicbom and Zicboz " 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 ` Radim Krčmář [this message]
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-7-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®