[PATCH v2 3/3] [NOT-FOR-UPSTREAM] platform: generic: virt: add APLIC M-mode IRQ test overlay

Raymond Mao <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
From: Raymond Mao <[email protected]>

Stock QEMU virt,aia=aplic delegates all wired IRQs from the M-mode
APLIC to its child S-mode APLIC, which prevents the local
APLIC_QEMU_WIRED_TEST path from exercising M-mode wired IRQ delivery.

Add a DT overlay that changes the M-mode APLIC delegation ranges from
1..96 to 1..9 and 11..96, leaving hwirq 10 local to the M-mode APLIC.
This matches the local test path, which uses UART RX on hwirq 10.

The overlay is intended to be applied on top of a base DTB dumped from
the same QEMU virt,aia=aplic command line, so the embedded child
phandle matches that dumped base DTB.

Usage:
- dump the base DTB from the target QEMU command line
- compile this file as a DT overlay and apply it to the dumped base DTB
- boot QEMU with the merged DTB and APLIC_QEMU_WIRED_TEST=y to verify
  M-mode wired IRQ delivery

Signed-off-by: Raymond Mao <[email protected]>
---
 .../virt/aplic_mmode_wired_irq_test.dts       | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 platform/generic/virt/aplic_mmode_wired_irq_test.dts

diff --git a/platform/generic/virt/aplic_mmode_wired_irq_test.dts b/platform/generic/virt/aplic_mmode_wired_irq_test.dts
new file mode 100644
index 00000000..8fb976b5
--- /dev/null
+++ b/platform/generic/virt/aplic_mmode_wired_irq_test.dts
@@ -0,0 +1,28 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+	fragment@0 {
+		target-path = "/soc/interrupt-controller@c000000";
+		__overlay__ {
+			/*
+			 * Stock QEMU virt,aia=aplic delegates all wired IRQs from
+			 * the M-mode APLIC to its child S-mode APLIC:
+			 *
+			 *   <child-phandle 1 96>
+			 *
+			 * Keep hwirq 10 local to the M-mode APLIC by delegating
+			 * only 1..9 and 11..96 to the child APLIC. This matches
+			 * the local OpenSBI APLIC_QEMU_WIRED_TEST path, which
+			 * exercises wired IRQ delivery via hwirq 10 (UART RX).
+			 *
+			 * This overlay is intended to be applied on top of a base
+			 * DTB dumped from the same QEMU virt,aia=aplic command
+			 * line. The child phandle value below therefore matches
+			 * that dumped base DTB.
+			 */
+			riscv,delegate = <0x04 0x01 0x09 0x04 0x0b 0x60>;
+			riscv,delegation = <0x04 0x01 0x09 0x04 0x0b 0x60>;
+		};
+	};
+};
-- 
2.25.1


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.