[RFC PATCH 03/12] lib: sbi_hart: enforce riscv,pmwid for Worlds ISA
Yu-Chien Peter Lin <[email protected]> Fri, 26 Jun 2026 18:14:24 +0800
| Newsgroups | org.infradead.lists.opensbi |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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 " + "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 [email protected] http://lists.infradead.org/mailman/listinfo/opensbi