Re: [PATCH 2/6] riscv: hwprobe: Report Zicbom and Zicboz only when available
From: Andy Chiu
Date: Fri Oct 16 2026 - 17:07:46 EST
On Tue, Oct 06, 2026 at 09:52:59AM +0200, Radim Krcmár wrote:
> User-mode use of Zicbom and Zicboz requires senvcfg.CBCFE and
> senvcfg.CBZE, respectively, which we set only when all harts have the
> extension. hwprobe 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: 1b57747e978f ("riscv: Enable cbo.zero only when all harts support Zicboz")
> Fixes: eb1003970940 ("RISC-V: hwprobe: Expose Zicbom extension and its block size")
> Signed-off-by: Radim Krcmár <radim.krcmar@xxxxxxxxxxxxxxxx>
Reviewed-by: Andy Chiu <tchiu@xxxxxxxxxxxxxxx>
> ---
> arch/riscv/kernel/sys_hwprobe.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
> index b57ccd116bb1..c74e36e8fcdd 100644
> --- a/arch/riscv/kernel/sys_hwprobe.c
> +++ b/arch/riscv/kernel/sys_hwprobe.c
> @@ -91,6 +91,12 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
> if (has_vector() && riscv_isa_extension_available(NULL, V))
> pair->value |= RISCV_HWPROBE_IMA_V;
>
> + if (riscv_isa_extension_available(NULL, ZICBOM))
> + pair->value |= RISCV_HWPROBE_EXT_ZICBOM;
> +
> + if (riscv_isa_extension_available(NULL, ZICBOZ))
> + pair->value |= RISCV_HWPROBE_EXT_ZICBOZ;
> +
> /*
> * Loop through and record extensions that 1) anyone has, and 2) anyone
> * doesn't have.
> @@ -120,9 +126,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
> EXT_KEY(isainfo->isa, ZCB, pair->value, missing);
> EXT_KEY(isainfo->isa, ZCLSD, pair->value, missing);
> EXT_KEY(isainfo->isa, ZCMOP, pair->value, missing);
> - EXT_KEY(isainfo->isa, ZICBOM, pair->value, missing);
> EXT_KEY(isainfo->isa, ZICBOP, pair->value, missing);
> - EXT_KEY(isainfo->isa, ZICBOZ, pair->value, missing);
> EXT_KEY(isainfo->isa, ZICFILP, pair->value, missing);
> EXT_KEY(isainfo->isa, ZICNTR, pair->value, missing);
> EXT_KEY(isainfo->isa, ZICOND, pair->value, missing);
> --
> 2.55.0
>