From: Raymond Mao <raymondmaoca@gmail.com>
To: opensbi@lists.infradead.org
Cc: scott@riscstar.com, dave.patel@riscstar.com,
raymond.mao@riscstar.com, robin.randhawa@sifive.com,
samuel.holland@sifive.com, anup.patel@qti.qualcomm.com,
anuppate@qti.qualcomm.com, anup@brainfault.org,
dhaval@rivosinc.com, peter.lin@sifive.com
Subject: [PATCH 3/7] [NOT-FOR-UPSTREAM] platform: virt: add QEMU WorldGuard hwiso overlay
Date: Tue, 19 May 2026 16:33:27 -0400 [thread overview]
Message-ID: <20260519203331.2773185-4-raymondmaoca@gmail.com> (raw)
In-Reply-To: <20260519203331.2773185-1-raymondmaoca@gmail.com>
From: Raymond Mao <raymond.mao@riscstar.com>
Add a QEMU virt device-tree overlay that describes OpenSBI domain
WorldGuard metadata and checker permission policy for the current
HWISO test and demo flow.
Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
---
.../generic/virt/qemu-virt-hwiso-overlay.dts | 121 ++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 platform/generic/virt/qemu-virt-hwiso-overlay.dts
diff --git a/platform/generic/virt/qemu-virt-hwiso-overlay.dts b/platform/generic/virt/qemu-virt-hwiso-overlay.dts
new file mode 100644
index 00000000..e44d85b7
--- /dev/null
+++ b/platform/generic/virt/qemu-virt-hwiso-overlay.dts
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/dts-v1/;
+/plugin/;
+
+/*
+ * Test-only overlay for exercising HWISO with WorldGuard metadata.
+ *
+ * This overlay only adds OpenSBI domain metadata and worldguard_cfg resource
+ * policy. The base DTB is expected to already provide the WG checker nodes
+ * and per-CPU worldguard child nodes.
+ *
+ * Usage:
+ * Domain hart phandles are filled in after merge because fdtoverlay does not
+ * reliably resolve CPU-node references against QEMU dumpdtb output here.
+ * See below steps for filling the domain hart phandles (assume the dumped dtb
+ * and merged dtb are represented by 'qemu.dtb' and 'qemu-merged.dtb'
+ * respectively):
+ * cpu0_phandle=$(fdtget -t x qemu.dtb /cpus/cpu@0 phandle)
+ * cpu1_phandle=$(fdtget -t x qemu.dtb /cpus/cpu@1 phandle)
+ * fdtput -t x qemu-merged.dtb /chosen/opensbi-domains/domain@0 \
+ * possible-harts "$cpu0_phandle" "$cpu1_phandle"
+ * fdtput -t x qemu-merged.dtb /chosen/opensbi-domains/domain@0 \
+ * boot-hart "$cpu0_phandle"
+ * fdtput -t x qemu-merged.dtb /chosen/opensbi-domains/domain@1 \
+ * possible-harts "$cpu1_phandle"
+ * fdtput -t x qemu-merged.dtb /chosen/opensbi-domains/domain@1 \
+ * boot-hart "$cpu1_phandle"
+ */
+/ {
+ fragment@0 {
+ target-path = "/chosen";
+ __overlay__ {
+ opensbi-domains {
+ compatible = "opensbi,domain,config";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ memregion0: memregion@0 {
+ compatible = "opensbi,domain,memregion";
+ base = <0x00000000 0x80000000>;
+ order = <0x1f>;
+ };
+
+ guest0: domain@0 {
+ compatible = "opensbi,domain,instance";
+ regions = <&memregion0 0x3f>;
+ next-addr = <0x00000000 0x80200000>;
+ next-arg1 = <0x00000000 0x82200000>;
+ next-mode = <0x1>;
+
+ hw-isolation {
+ worldguard {
+ compatible = "sifive,wgchecker2";
+ worldguard,wid = <0>;
+ worldguard,widlist = <0 1 3>;
+ };
+ };
+ };
+
+ guest1: domain@1 {
+ compatible = "opensbi,domain,instance";
+ regions = <&memregion0 0x3f>;
+ next-addr = <0x00000000 0x80200000>;
+ next-mode = <0x1>;
+
+ hw-isolation {
+ worldguard {
+ compatible = "sifive,wgchecker2";
+ worldguard,wid = <1>;
+ worldguard,widlist = <1 3>;
+ };
+ };
+ };
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/cpus/cpu@0";
+ __overlay__ {
+ opensbi-domain = <&guest0>;
+ };
+ };
+
+ fragment@2 {
+ target-path = "/cpus/cpu@1";
+ __overlay__ {
+ opensbi-domain = <&guest0>;
+ };
+ };
+
+ fragment@3 {
+ target-path = "/memory@80000000";
+ __overlay__ {
+ worldguard_cfg {
+ reg = <0x00000000 0x80000000 0x00000000 0x40000000
+ 0x00000000 0xc0000000 0x00000000 0x01000000
+ 0x00000000 0xc1000000 0x00000000 0x3f000000>;
+ perms = <0x0 0xcf 0x0 0xcc 0x0 0xcf>;
+ };
+ };
+ };
+
+ fragment@4 {
+ target-path = "/flash@20000000";
+ __overlay__ {
+ worldguard_cfg {
+ perms = <0x0 0xc3>;
+ };
+ };
+ };
+
+ fragment@5 {
+ target-path = "/soc/serial@10000000";
+ __overlay__ {
+ worldguard_cfg {
+ perms = <0x0 0xc0>;
+ };
+ };
+ };
+};
--
2.25.1
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-05-19 20:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 20:33 [PATCH 0/7] Add WorldGuard hwiso support Raymond Mao
2026-05-19 20:33 ` [PATCH 1/7] hart: add WorldGuard CSR IDs and hart extension flags Raymond Mao
2026-05-19 20:33 ` [PATCH 2/7] docs: document hwiso WorldGuard DT bindings Raymond Mao
2026-05-19 20:33 ` Raymond Mao [this message]
2026-05-19 20:33 ` [PATCH 4/7] platform: generic: add WorldGuard hwiso support with wgchecker2 Raymond Mao
2026-05-19 20:33 ` [PATCH 5/7] test: add generic hwiso SBI unit coverage Raymond Mao
2026-05-19 20:33 ` [PATCH 6/7] platform: virt: add QEMU virt WorldGuard hwiso tests Raymond Mao
2026-05-19 20:33 ` [PATCH 7/7] platform: virt: add WorldGuard HWISO failure-mode SBIUNIT test Raymond Mao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519203331.2773185-4-raymondmaoca@gmail.com \
--to=raymondmaoca@gmail.com \
--cc=anup.patel@qti.qualcomm.com \
--cc=anup@brainfault.org \
--cc=anuppate@qti.qualcomm.com \
--cc=dave.patel@riscstar.com \
--cc=dhaval@rivosinc.com \
--cc=opensbi@lists.infradead.org \
--cc=peter.lin@sifive.com \
--cc=raymond.mao@riscstar.com \
--cc=robin.randhawa@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=scott@riscstar.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox