Skip to contentSkip to conversation

Add RISC-V Worlds ISA support to OpenSBI

PATCH New Yu-Chien Peter Lin 1 participant 10 messages Nov 24 RISC-V

lore
Share & tools
lore
#0 lore raw

v6 cover Add RISC-V Worlds ISA support to OpenSBI

This patch series adds support for the RISC-V Worlds ISA extensions in OpenSBI, introducing a WID-based hart protection backend to enforce hardware isolation boundaries across domains.

Trust Model and Boot-time Roles
-------------------------------

The implementation adheres to the two-phase M-mode trust model:

- RoT M-mode phase: An earlier boot stage (e.g., ROM or SPL) may program mwid and mlwidlist, locking mwid prior to handing off execution to OpenSBI.

- Regular M-mode phase (OpenSBI): OpenSBI treats the non-ISA platform constraints (pmwid, pmwidlist, pmlwidlist) and CSR states (mwid, mlwidlist) as immutable input policies from the hardware/RoT. It locks mwid if still unlocked, preventing subsequent M-mode software from altering its own WID, and programs per-domain mlwid and mwiddeleg based on device tree configuration.

Device Tree Bindings
--------------------

Per-hart properties defined in Linux kernel DT bindings v3 [1]:
- riscv,pmwid: M-mode World ID
- riscv,pmwidlist: M-mode permitted WID bitmap
- riscv,pmlwidlist: S-mode permitted WID bitmap

Per-domain properties (see docs/domain_support.md):
- wid: World ID assigned to this domain for S-mode
- widdeleg: WID delegation bitmap for this domain

[1] https://lore.kernel.org/all/[email protected]/

Base commit: 61f1973bd50338b36c52dc34006f76d464ca4f34

Yu-Chien Peter Lin (9):
lib: sbi_hart: add RISC-V Worlds ISA extensions
lib: utils: fdt_helper: parse RISC-V Worlds per-hart WID properties
lib: fdt_domain: parse domain WID properties
lib: sbi_hart: lock mwid CSR for RoT immutability
lib: sbi_domain_context: propagate error from
sbi_hart_protection_reconfigure
lib: sbi_hart_worlds: Implement WID hart protection backend
include: sbi_types: add PRIx64 format macro
lib: sbi: display World ID configuration at boot
docs: document WID DT properties

 docs/domain_support.md        |  38 ++++++++
 include/sbi/riscv_encoding.h  |  12 +++
 include/sbi/sbi_domain.h      |   6 ++
 include/sbi/sbi_hart.h        |  15 +++
 include/sbi/sbi_hart_worlds.h |  24 +++++
 include/sbi/sbi_types.h       |   2 +
 lib/sbi/objects.mk            |   1 +
 lib/sbi/sbi_domain.c          |  20 ++++
 lib/sbi/sbi_domain_context.c  |   5 +-
 lib/sbi/sbi_hart.c            |  37 ++++++++
 lib/sbi/sbi_hart_worlds.c     | 174 ++++++++++++++++++++++++++++++++++
 lib/sbi/sbi_init.c            |  13 +++
 lib/utils/fdt/fdt_domain.c    | 102 ++++++++++++++++++++
 lib/utils/fdt/fdt_helper.c    |  69 ++++++++++++--
 14 files changed, 510 insertions(+), 8 deletions(-)
 create mode 100644 include/sbi/sbi_hart_worlds.h
 create mode 100644 lib/sbi/sbi_hart_worlds.c
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#1 lore raw

PATCH v6 1/9 lib: sbi_hart: add RISC-V Worlds ISA extensions

Add CSR definitions for RISC-V Worlds (mwid, mlwid, mlwidlist, mwiddeleg, slwid).

---
 include/sbi/riscv_encoding.h | 12 ++++++++++++
 include/sbi/sbi_hart.h       | 10 ++++++++++
 lib/sbi/sbi_hart.c           |  5 +++++
 3 files changed, 27 insertions(+)
include/sbi/riscv_encoding.h +12 -0
index ffe7666c..e0262bfc 100644
@@ -400,6 +400,9 @@
 /* Supervisor Resource Management Configuration CSRs */
 #define CSR_SRMCFG			0x181
 
+/* Supervisor lower-privilege mode World ID CSR (Sswid) */
+#define CSR_SLWID			0x190
+
 /* Machine-Level Control transfer records CSRs */
 #define CSR_MCTRCTL                     0x34e
 
@@ -520,6 +523,15 @@
 #define CSR_MTINST			0x34a
 #define CSR_MTVAL2			0x34b
 
+/* Machine World ID CSRs (Smwid, Smlwid, Smlwidlist, Smwiddeleg) */
+#define CSR_MLWID			0x390
+#define CSR_MWID			0x749
+#define CSR_MWIDDELEG			0x748
+#define CSR_MLWIDLIST			0x74A
+
+/* mwid lock bit */
+#define MWID_LOCK			(_UL(1) << (__riscv_xlen - 1))
+
 /* Machine Memory Protection */
 #define CSR_PMPCFG0			0x3a0
 #define CSR_PMPCFG1			0x3a1
include/sbi/sbi_hart.h +10 -0
index a020cf03..ed344783 100644
@@ -97,6 +97,16 @@ enum sbi_hart_extensions {
 	SBI_HART_EXT_F,
 	/** Hart has D extension */
 	SBI_HART_EXT_D,
+	/** Hart has Smwid extension */
+	SBI_HART_EXT_SMWID,
+	/** Hart has Smlwid extension */
+	SBI_HART_EXT_SMLWID,
+	/** Hart has Smlwidlist extension */
+	SBI_HART_EXT_SMLWIDLIST,
+	/** Hart has Smwiddeleg extension */
+	SBI_HART_EXT_SMWIDDELEG,
+	/** Hart has Sswid extension */
+	SBI_HART_EXT_SSWID,
 
 	/** Maximum index of Hart extension */
 	SBI_HART_EXT_MAX,
lib/sbi/sbi_hart.c +5 -0
index d1f5500d..d86abf07 100644
@@ -355,6 +355,11 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
 	__SBI_HART_EXT_DATA(v, SBI_HART_EXT_V),
 	__SBI_HART_EXT_DATA(f, SBI_HART_EXT_F),
 	__SBI_HART_EXT_DATA(d, SBI_HART_EXT_D),
+	__SBI_HART_EXT_DATA(smwid, SBI_HART_EXT_SMWID),
+	__SBI_HART_EXT_DATA(smlwid, SBI_HART_EXT_SMLWID),
+	__SBI_HART_EXT_DATA(smlwidlist, SBI_HART_EXT_SMLWIDLIST),
+	__SBI_HART_EXT_DATA(smwiddeleg, SBI_HART_EXT_SMWIDDELEG),
+	__SBI_HART_EXT_DATA(sswid, SBI_HART_EXT_SSWID),
 };
 
 _Static_assert(SBI_HART_EXT_MAX == array_size(sbi_hart_ext),
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#2 lore raw

PATCH v6 2/9 lib: utils: fdt_helper: parse RISC-V Worlds per-hart WID properties

In reply to Yu-Chien Peter Lin

Extend fdt_parse_isa_extensions_all_harts() to also parse the platform-defined RISC-V Worlds DT properties in /cpus/cpu@X:
- riscv,pmwid: M-mode World ID
- riscv,pmwidlist: bitmap of permitted M-mode WIDs
- riscv,pmlwidlist: bitmap of permitted lower-privilege WIDs and store the parsed values in struct sbi_hart_features.

These platform-defined values serve as the root-of-trust constraints for per-domain WID assignment during domain creation and context switching.

---
 include/sbi/sbi_hart.h     |  5 +++
 lib/utils/fdt/fdt_helper.c | 69 ++++++++++++++++++++++++++++++++++----
 2 files changed, 67 insertions(+), 7 deletions(-)
include/sbi/sbi_hart.h +5 -0
index ed344783..629e3f64 100644
@@ -138,6 +138,11 @@ struct sbi_hart_features {
 	unsigned int mhpm_mask;
 	unsigned int mhpm_bits;
 	unsigned long expected_trap;
+	u32 pmwid;
+	u64 pmwidlist;
+	u64 pmlwidlist;
+	bool has_pmwid;
+	bool has_pmlwidlist;
 };
 
 extern unsigned long hart_features_offset;
lib/utils/fdt/fdt_helper.c +62 -7

78 lines not on this page · raw message

Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#3 lore raw

PATCH v6 3/9 lib: fdt_domain: parse domain WID properties

In reply to Yu-Chien Peter Lin

Add wid and widdeleg fields to struct sbi_domain to store the RISC-V Worlds mlwid and mwiddeleg CSR values for each domain. Also, parse the root and user-defined domains' WID during fdt_domains_populate().

The root domain WID is described in the "root" subnode, which carries the "opensbi,domain,instance" compatible string. Skip this node in fdt_iterate_each_domain() so that it is not treated as a regular domain instance.

When Smlwid is implemented, the "wid" property is mandatory for all domains; fail domain population if it is missing.

---
 include/sbi/sbi_domain.h   |   6 +++
 lib/sbi/sbi_domain.c       |   2 +
 lib/utils/fdt/fdt_domain.c | 102 +++++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+)
include/sbi/sbi_domain.h +6 -0
index 56a21397..5a291d1f 100644
@@ -19,6 +19,8 @@
 
 struct sbi_scratch;
 
+#define INVALID_WID	((unsigned int)~0U)
+
 /** Domain access types */
 enum sbi_domain_access {
 	SBI_DOMAIN_READ = (1UL << 0),
@@ -218,6 +220,10 @@ struct sbi_domain {
 	bool system_reset_allowed;
 	/** Is domain allowed to suspend the system */
 	bool system_suspend_allowed;
+	/** World ID for this domain (mlwid value) */
+	u32 wid;
+	/** World ID delegation bitmask for this domain (mwiddeleg value) */
+	u64 widdeleg;
 	/** Identifies whether to include the firmware region */
 	bool fw_region_inited;
 };
lib/sbi/sbi_domain.c +2 -0
index 42fe5632..be9020d0 100644
@@ -30,6 +30,8 @@ struct sbi_domain root = {
 	.possible_harts = NULL,
 	.system_reset_allowed = true,
 	.system_suspend_allowed = true,
+	.wid = INVALID_WID,
+	.widdeleg = 0,
 	.fw_region_inited = false,
 };
 
lib/utils/fdt/fdt_domain.c +102 -0

144 lines not on this page · raw message

Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#4 lore raw

PATCH v6 4/9 lib: sbi_hart: lock mwid CSR for RoT immutability

In reply to Yu-Chien Peter Lin

Lock the M-mode World ID (mwid) CSR during hart re-initialization to enforce immutability of the WID established by the root-of-trust.

OpenSBI does not assign the WID value itself; it only sets MWID_LOCK to freeze the value established by prior RoT stage. The MWID_LOCK bit at XLEN-1 is sticky and makes the CSR read-only until reset, enforcing a temporal security boundary per the RISC-V Worlds specification.

---
Changes v5->v6:
- Add warning message when pmwid != mwid (Anup)

---
 lib/sbi/sbi_hart.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
lib/sbi/sbi_hart.c +27 -0
index d86abf07..8e8f84cd 100644
@@ -469,6 +469,31 @@ static int hart_mhpm_get_allowed_bits(void)
 	return num_bits;
 }
 
+static void smwid_hart_init(struct sbi_scratch *scratch)
+{
+	struct sbi_hart_features *hfeatures = sbi_hart_features_ptr(scratch);
+	unsigned long mwid;
+
+	if (!sbi_hart_has_extension(scratch, SBI_HART_EXT_SMWID))
+		return;
+
+	/*
+	 * MWID is expected to have been set/restored by the RoT's
+	 * M-mode implementation during an earlier boot/resume stage.
+	 * Lock it to preserve the RoT-defined WID as immutable.
+	 *
+	 * MWID may differ from pmwid if the RoT has demoted M-mode.
+	 */
+	mwid = csr_read(CSR_MWID) & ~MWID_LOCK;
+	if (hfeatures->has_pmwid && mwid != hfeatures->pmwid) {
+		sbi_printf("WARNING: %s: hart%u mwid (%lu) differs from"
+			   " pmwid (%u)\n", __func__, current_hartid(),
+			   mwid, hfeatures->pmwid);
+	}
+
+	csr_set(CSR_MWID, MWID_LOCK);
+}
+
 static int smrnmi_hart_init(struct sbi_scratch *scratch)
 {
 	const struct sbi_platform *plat;
@@ -721,6 +746,8 @@ int sbi_hart_reinit(struct sbi_scratch *scratch)
 {
 	int rc;
 
+	smwid_hart_init(scratch);
+
 	rc = smrnmi_hart_init(scratch);
 	if (rc)
 		return rc;
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#5 lore raw

PATCH v6 5/9 lib: sbi_domain_context: propagate error from sbi_hart_protection_reconfigure

In reply to Yu-Chien Peter Lin

Propagate the return value of sbi_hart_protection_reconfigure in switch_to_next_domain_context to ensure that domain transition failures are correctly handled by the caller.

---
 lib/sbi/sbi_domain_context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/sbi/sbi_domain_context.c +4 -1
index 987ac7fa..1751d016 100644
@@ -110,6 +110,7 @@ static int switch_to_next_domain_context(struct hart_context *ctx,
 	MUST_NOT_HOLD(&ctx->dom->assigned_harts_lock)
 	MUST_NOT_HOLD(&dom_ctx->dom->assigned_harts_lock)
 {
+	int rc;
 	u32 hartindex = current_hartindex();
 	struct sbi_trap_context *trap_ctx;
 	struct sbi_domain *current_dom, *target_dom;
@@ -173,7 +174,9 @@ static int switch_to_next_domain_context(struct hart_context *ctx,
 	 * is also required for some of the above CSR updates (such
 	 * as satp CSR).
 	 */
-	sbi_hart_protection_reconfigure(scratch, current_dom, target_dom);
+	rc = sbi_hart_protection_reconfigure(scratch, current_dom, target_dom);
+	if (rc)
+		return rc;
 
 	/* Mark current context structure initialized because context saved */
 	ctx->initialized = true;
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#6 lore raw

PATCH v6 6/9 lib: sbi_hart_worlds: Implement WID hart protection backend

In reply to Yu-Chien Peter Lin

Introduce a WID-based hart protection backend that switches World ID configurations across domains.

Access to slwid is gated by mwiddeleg (Sswid), which means slwid cannot be handled by generic hart_context save/restore. Instead, manage slwid as domain state with explicit sequencing:

- configure:
- Validate and program mlwid and mwiddeleg according to domain policy and platform constraints (pmlwidlist/mlwidlist).
- Restore slwid after mwiddeleg is enabled.
- unconfigure:
- Save slwid prior to clearing mwiddeleg.
- Reset mwiddeleg to 0 to disable Sswid.

---
 include/sbi/sbi_hart_worlds.h |  24 +++++
 lib/sbi/objects.mk            |   1 +
 lib/sbi/sbi_hart.c            |   5 +
 lib/sbi/sbi_hart_worlds.c     | 174 ++++++++++++++++++++++++++++++++++
 4 files changed, 204 insertions(+)
 create mode 100644 include/sbi/sbi_hart_worlds.h
 create mode 100644 lib/sbi/sbi_hart_worlds.c
include/sbi/sbi_hart_worlds.h new file +24 -0
new file mode 100644
index 00000000..91b11023
@@ -0,0 +1,24 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 SiFive Inc.
+ */
+
+#ifndef __SBI_HART_WORLDS_H__
+#define __SBI_HART_WORLDS_H__
+
+struct sbi_scratch;
+
+/**
+ * Initialize WID hart protection for current HART
+ *
+ * Registers the WID protection mechanism if Smlwid
+ * extension is present.
+ *
+ * @param scratch pointer to scratch space of current HART
+ *
+ * @return 0 on success and negative error code on failure
+ */
+int sbi_hart_worlds_init(struct sbi_scratch *scratch);
+
+#endif /* __SBI_HART_WORLDS_H__ */
lib/sbi/objects.mk +1 -0
index ae27d0c5..355ae6e9 100644
@@ -77,6 +77,7 @@ libsbi-objs-y += sbi_fwft.o
 libsbi-objs-y += sbi_hart.o
 libsbi-objs-y += sbi_hart_pmp.o
 libsbi-objs-y += sbi_hart_protection.o
+libsbi-objs-y += sbi_hart_worlds.o
 libsbi-objs-y += sbi_heap.o
 libsbi-objs-y += sbi_math.o
 libsbi-objs-y += sbi_hfence.o
lib/sbi/sbi_hart.c +5 -0
index 8e8f84cd..ae24720e 100644
@@ -17,6 +17,7 @@
 #include <sbi/sbi_error.h>
 #include <sbi/sbi_hart.h>
 #include <sbi/sbi_hart_pmp.h>
+#include <sbi/sbi_hart_worlds.h>
 #include <sbi/sbi_platform.h>
 #include <sbi/sbi_pmu.h>
 #include <sbi/sbi_string.h>
@@ -784,6 +785,10 @@ int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot)
 		rc = sbi_hart_pmp_init(scratch);
 		if (rc)
 			return rc;
+
+		rc = sbi_hart_worlds_init(scratch);
+		if (rc)
+			return rc;
 	}
 
 	return sbi_hart_reinit(scratch);
lib/sbi/sbi_hart_worlds.c new file +174 -0

174 lines not on this page · raw message

Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#7 lore raw

PATCH v6 7/9 include: sbi_types: add PRIx64 format macro

In reply to Yu-Chien Peter Lin

Add PRIx64 for portable 64-bit hex printing. Expands to 016lx on RV64 and 016llx on RV32, enabling consistent printf-style formatting of uint64_t values.

---
 include/sbi/sbi_types.h | 2 ++
 1 file changed, 2 insertions(+)
include/sbi/sbi_types.h +2 -0
index b8a7e6cb..780a4c2a 100644
@@ -34,12 +34,14 @@ typedef unsigned long		u64;
 typedef long			int64_t;
 typedef unsigned long		uint64_t;
 #define PRILX			"016lx"
+#define PRIx64			"016lx"
 #elif __riscv_xlen == 32
 typedef long long		s64;
 typedef unsigned long long	u64;
 typedef long long		int64_t;
 typedef unsigned long long	uint64_t;
 #define PRILX			"08lx"
+#define PRIx64			"016llx"
 #else
 #error "Unexpected __riscv_xlen"
 #endif
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#8 lore raw

PATCH v6 8/9 lib: sbi: display World ID configuration at boot

In reply to Yu-Chien Peter Lin

Print per-domain Wid/Widdeleg and boot HART's M-mode World ID (mwid/pmwid fallback).

---
 lib/sbi/sbi_domain.c | 18 ++++++++++++++++++
 lib/sbi/sbi_init.c   | 13 +++++++++++++
 2 files changed, 31 insertions(+)
lib/sbi/sbi_domain.c +18 -0
index be9020d0..f92ebc2f 100644
@@ -10,6 +10,7 @@
 #include <sbi/riscv_asm.h>
 #include <sbi/sbi_console.h>
 #include <sbi/sbi_domain.h>
+#include <sbi/sbi_hart.h>
 #include <sbi/sbi_hartmask.h>
 #include <sbi/sbi_heap.h>
 #include <sbi/sbi_hsm.h>
@@ -613,6 +614,7 @@ void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix)
 	u32 i, j, k;
 	unsigned long rstart, rend;
 	const struct sbi_domain_memregion *reg;
+	struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
 
 	sbi_printf("Domain%d Name        %s: %s\n",
 		   dom->index, suffix, dom->name);
@@ -691,6 +693,22 @@ void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix)
 		break;
 	}
 
+	if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMLWID)) {
+		sbi_printf("Domain%d Wid         %s: %u\n",
+			   dom->index, suffix, dom->wid);
+	} else {
+		sbi_printf("Domain%d Wid         %s: unsupported\n",
+			   dom->index, suffix);
+	}
+
+	if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMWIDDELEG)) {
+		sbi_printf("Domain%d Widdeleg    %s: 0x%" PRIx64 "\n",
+			   dom->index, suffix, dom->widdeleg);
+	} else {
+		sbi_printf("Domain%d Widdeleg    %s: unsupported\n",
+			   dom->index, suffix);
+	}
+
 	sbi_printf("Domain%d SysReset    %s: %s\n",
 		   dom->index, suffix, (dom->system_reset_allowed) ? "yes" : "no");
 
lib/sbi/sbi_init.c +13 -0
index 64b8c777..16dd79d7 100644
@@ -167,6 +167,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;
@@ -208,6 +209,18 @@ static void sbi_boot_print_hart(struct sbi_scratch *scratch, u32 hartid)
 			   (ops && ops->smrnmi_handlers_init) ?
 			   "Platform" : "Default");
 	}
+	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;
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#9 lore raw

PATCH v6 9/9 docs: document WID DT properties

In reply to Yu-Chien Peter Lin

Add "wid" and "widdeleg" properties to domain instance node documentation and example DT. Add a "Root Domain Node" section describing the "root" subnode under the domain configuration node for root domain WID configuration

---
 docs/domain_support.md | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
docs/domain_support.md +38 -0
index 86a25f22..c30c1c14 100644
@@ -56,6 +56,8 @@ has following details:
   domain. This can be either S-mode or U-mode.
 * **system_reset_allowed** - Is domain allowed to reset the system?
 * **system_suspend_allowed** - Is domain allowed to suspend the system?
+* **wid** - World ID for the domain
+* **widdeleg** - World ID delegation bitmask for the domain
 
 The memory regions represented by **regions** in **struct sbi_domain** have
 following additional constraints to align with RISC-V PMP requirements:
@@ -98,6 +100,8 @@ following manner:
   is the next mode for the ROOT domain
 * **system_reset_allowed** - The ROOT domain is allowed to reset the system
 * **system_suspend_allowed** - The ROOT domain is allowed to suspend the system
+* **wid** - Configurable World ID for the ROOT domain
+* **widdeleg** - Configurable World ID delegation bitmask for the ROOT domain
 
 Domain Effects
 --------------
@@ -131,6 +135,23 @@ The DT properties of a domain configuration DT node are as follows:
 * **compatible** (Mandatory) - The compatible string of the domain
   configuration. This DT property should have value *"opensbi,domain,config"*
 
+### Root Domain Node
+
+The root domain WID configuration is described in a **root** subnode under
+the domain configuration DT node.
+
+The DT properties of the root domain node are as follows:
+
+* **compatible** (Mandatory) - The compatible string of the root domain node.
+  This DT property should have value *"opensbi,domain,instance"*.
+* **wid** (Mandatory if Smlwid is present) - The World ID (must be less than XLEN) for
+  lower-privilege modes (S/U-mode) for the ROOT domain. If the hart
+  supports the Smlwid extension, this property must be provided.
+* **widdeleg** (Optional) - The World ID delegation bitmask (at most XLEN bits) for
+  the ROOT domain. If present, OpenSBI writes this value to **mwiddeleg**
+  when entering the ROOT domain (requires Smwiddeleg extension). If absent,
+  clears **mwiddeleg** to disable S-mode WID delegation.
+
 ### Domain Memory Region Node
 
 The domain memory region DT node describes details of a memory region and
@@ -205,6 +226,13 @@ The DT properties of a domain instance DT node are as follows:
   whether the domain instance is allowed to do system reset.
 * **system-suspend-allowed** (Optional) - A boolean flag representing
   whether the domain instance is allowed to do system suspend.
+* **wid** (Mandatory if Smlwid is present) - The World ID (must be less than XLEN) for
+  lower-privilege modes (S/U-mode) for the domain instance. If the hart
+  supports the Smlwid extension, this property must be provided.
+* **widdeleg** (Optional) - The World ID delegation bitmask (at most XLEN bits) for
+  the domain instance. If present, OpenSBI writes this value to **mwiddeleg**
+  on context switch into this domain (requires Smwiddeleg extension). If absent,
+  clears **mwiddeleg** to disable S-mode WID delegation.
 
 ### Assigning HART To Domain Instance
 
@@ -267,6 +295,12 @@ be done:
                 order = <64>;
             };
 
+            root {
+                compatible = "opensbi,domain,instance";
+                wid = <3>;
+                widdeleg = <0x0 0x0>;
+            };
+
             tdomain: trusted-domain {
                 compatible = "opensbi,domain,instance";
                 possible-harts = <&cpu0>;
@@ -275,6 +309,8 @@ be done:
                 next-arg1 = <0x0 0x0>;
                 next-addr = <0x0 0x80100000>;
                 next-mode = <0x0>;
+                wid = <1>;
+                widdeleg = <0x0 0x6>;
                 system-reset-allowed;
                 system-suspend-allowed;
             };
@@ -283,6 +319,8 @@ be done:
                 compatible = "opensbi,domain,instance";
                 possible-harts = <&cpu1 &cpu2 &cpu3 &cpu4>;
                 regions = <&tmem 0x0>, <&tuart 0x0>, <&allmem 0x3f>;
+                wid = <0>;
+                widdeleg = <0x0 0x1>;
             };
         };
     };
Signature · 7 lines
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi