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, dhaval@rivosinc.com,
peter.lin@sifive.com
Subject: [PATCH RFC 2/3] platform: generic: Add sample dts overlay for testing hwirq/domain route rules
Date: Fri, 13 Feb 2026 14:04:58 -0500 [thread overview]
Message-ID: <20260213190459.2540597-3-raymondmaoca@gmail.com> (raw)
In-Reply-To: <20260213190459.2540597-1-raymondmaoca@gmail.com>
From: Raymond Mao <raymond.mao@riscstar.com>
Add sample dts overlay for testing hwirq/domain route rules.
Each domain uses property "opensbi,host-irqs" to describe one hwirq
route rule.
'opensbi,host-irqs = <first_hwirq count> ...;'
During cold boot, route rules are converted and cached for VIRQ
routing/couriering purpose.
Usage:
1. Compile the overlay.
$ dtc -@ -I dts -O dtb -o hwirq_bind_domain.dto \
platform/generic/virt/hwirq_bind_domain.dts
2. Dump the base dtb from QEMU.
$ qemu-system-riscv64 -M virt,aia=aplic-imsic -cpu rv64,zkr=on -m 4096 \
-nographic -bios out/platform/generic/firmware/fw_jump.bin \
-machine dumpdtb=qemu.dtb
3. Apply the overlay on the base.
$ fdtoverlay -i qemu.dtb -o qemu_merge.dtb hwirq_bind_domain.dto
4. Re-run QEMU with adding argument '-dtb qemu_merge.dtb'
Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
---
platform/generic/virt/hwirq_bind_domain.dts | 79 +++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 platform/generic/virt/hwirq_bind_domain.dts
diff --git a/platform/generic/virt/hwirq_bind_domain.dts b/platform/generic/virt/hwirq_bind_domain.dts
new file mode 100644
index 00000000..b836901e
--- /dev/null
+++ b/platform/generic/virt/hwirq_bind_domain.dts
@@ -0,0 +1,79 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ /*
+ * Fragment 0: OpenSBI domain configuration under /chosen
+ */
+ fragment@0 {
+ target-path = "/chosen";
+ __overlay__ {
+ opensbi-domains {
+ compatible = "opensbi,domain,config";
+
+ /*
+ * DRAM region for domain1 (2GB from 0x8000_0000).
+ * base is 64-bit: <hi lo>, order is log2(size).
+ */
+ memregion_dram_2g: memregion_dram_2g {
+ compatible = "opensbi,domain,memregion";
+ base = <0x0 0x80000000>;
+ order = <31>;
+ };
+
+ /*
+ * UART MMIO region so S-mode payload can access UART registers
+ * without fault. 0x1000_0000 size 4KB.
+ */
+ uart0_mmio: memregion_uart0 {
+ compatible = "opensbi,domain,memregion";
+ base = <0x0 0x10000000>;
+ order = <12>;
+ };
+
+ /*
+ * Domain instance:
+ * - possible-harts = <cpu0 phandle> (your cpu@0 phandle is 1)
+ * - regions use label references (fdtoverlay will fixup phandles)
+ * - opensbi,host-irqs uses <first count> pairs (NO chip phandle)
+ */
+ domain1: domain1 {
+ compatible = "opensbi,domain,instance";
+
+ /* cpu@0 phandle in your base qemu dtb is 1 */
+ possible-harts = <0x1>;
+
+ /*
+ * Keep permissive for test.
+ * access=0x3f: enable all M+SU R/W/X flags (test only).
+ */
+ regions = <&memregion_dram_2g 0x3f>,
+ <&uart0_mmio 0x3f>;
+
+ /*
+ * Route rule: Bind host HWIRQs ranges to this domain.
+ * Format: <first_hwirq count> ...
+ * If no route rule matches, HWIRQs default to root domain.
+ *
+ * UART RX is hwirq=10 on QEMU virt:
+ * fdtget -t i qemu_merge.dtb /soc/serial@10000000 interrupts
+ * => "10 4"
+ *
+ * Start with only <10 1> for clean bring-up.
+ */
+ opensbi,host-irqs = <10 1>;
+ };
+ };
+ };
+ };
+
+ /*
+ * Fragment 1: Assign cpu0 to domain1 using label reference
+ */
+ fragment@1 {
+ target-path = "/cpus/cpu@0";
+ __overlay__ {
+ opensbi-domain = <&domain1>;
+ };
+ };
+};
\ No newline at end of file
--
2.25.1
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-02-13 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 19:04 [PATCH RFC 0/2] VIRQ (Virtual IRQ) layer to support paravirtual interrupt delivery Raymond Mao
2026-02-13 19:04 ` [PATCH RFC 1/3] lib: sbi: Prototype of Virtual IRQ (VIRQ) layer for mapping/routing/courier/ IRQs Raymond Mao
2026-02-13 19:04 ` Raymond Mao [this message]
2026-02-13 19:04 ` [PATCH RFC 3/3] lib: sbi: Add VIRQ ecall extension Raymond Mao
2026-02-13 21:03 ` Andrew Jones
2026-02-13 22:07 ` 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=20260213190459.2540597-3-raymondmaoca@gmail.com \
--to=raymondmaoca@gmail.com \
--cc=anup.patel@qti.qualcomm.com \
--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