[RFC PATCH 08/12] lib: sbi_init: print M-mode World ID at boot
Yu-Chien Peter Lin
peter.lin at sifive.com
Fri Jun 26 03:14:29 PDT 2026
This extends sbi_boot_print_hart() to display M-mode World ID
configuration during initialization. Shows mwid value from CSR_MWID
and lock status for Smwid extension, pmwid value from DT when
available, or "unsupported" message. Provides visibility into Worlds
configuration at boot for verification.
Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
---
lib/sbi/sbi_init.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 658fe37f..1fb79eae 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -169,6 +169,7 @@ static void sbi_boot_print_hart(struct sbi_scratch *scratch, u32 hartid)
int xlen;
char str[256];
const struct sbi_domain *dom = sbi_domain_thishart_ptr();
+ struct sbi_hart_features *hf = sbi_hart_features_ptr(scratch);
if (scratch->options & SBI_SCRATCH_NO_BOOT_PRINTS)
return;
@@ -201,6 +202,18 @@ static void sbi_boot_print_hart(struct sbi_scratch *scratch, u32 hartid)
sbi_printf("Boot HART Debug Triggers : %d triggers\n",
sbi_dbtr_get_total_triggers());
sbi_hart_delegation_dump(scratch, "Boot HART ", " ");
+ if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMWID)) {
+ ulong mwid = csr_read(CSR_MWID);
+
+ sbi_printf("Boot HART M-mode World ID : %lu (%s)\n",
+ mwid & ~MWID_LOCK,
+ (mwid & MWID_LOCK) ? "locked" : "unlocked");
+ } else if (hf->has_pmwid) {
+ sbi_printf("Boot HART M-mode World ID : %u (pmwid)\n",
+ hf->pmwid);
+ } else {
+ sbi_printf("Boot HART M-mode World ID : unsupported\n");
+ }
}
static unsigned long coldboot_done;
--
2.43.7
More information about the opensbi
mailing list