[RFC PATCH 03/12] lib: sbi_hart: enforce riscv,pmwid for Worlds ISA
Pawandeep Oza
pawandeep.oza at oss.qualcomm.com
Mon Jul 13 14:26:13 PDT 2026
On Fri, Jun 26, 2026 at 3:16 AM Yu-Chien Peter Lin <peter.lin at sifive.com> wrote:
>
> When Smwid/Smlwid extensions are detected during hart ISA detection,
> the riscv,pmwid device tree property is required to specify the M-mode
> WID default value.
>
> Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
> ---
> lib/sbi/sbi_hart.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 0c584bfc..cb0c66ea 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -768,6 +768,19 @@ skip_smwiddeleg:
> /* Mark hart feature detection done */
> hfeatures->detected = true;
>
> + /*
> + * Validate M-mode WID default value: if Worlds ISA extensions
> + * are present, riscv,pmwid must exist in DT.
> + */
> + if ((sbi_hart_has_extension(scratch, SBI_HART_EXT_SMWID) ||
> + sbi_hart_has_extension(scratch, SBI_HART_EXT_SMLWID)) &&
> + !hfeatures->has_pmwid) {
> + sbi_printf("WARNING: hart%u has Worlds ISA extension but DT "
:%s/WARNING/ERROR/gc as this is causing panic/hang
> + "lacks riscv,pmwid.\n",
> + current_hartid());
> + return SBI_EINVAL;
> + }
> +
> /*
> * On platforms with Smepmp, the previous booting stage must
> * enter OpenSBI with mseccfg.MML == 0. This allows OpenSBI
> --
> 2.43.7
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list