OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v2 3/3] [NOT-FOR-UPSTREAM] platform: generic: virt: add APLIC M-mode IRQ test overlay
Date: Mon,  4 May 2026 13:13:42 -0400	[thread overview]
Message-ID: <20260504171342.1655882-3-raymondmaoca@gmail.com> (raw)
In-Reply-To: <20260504171342.1655882-1-raymondmaoca@gmail.com>

From: Raymond Mao <raymond.mao@riscstar.com>

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 <raymond.mao@riscstar.com>
---
 .../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
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

  parent reply	other threads:[~2026-05-04 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 17:13 [PATCH v2 1/3] lib: utils: irqchip: implement APLIC hwirq operation hooks Raymond Mao
2026-05-04 17:13 ` [PATCH v2 2/3] [NOT-FOR-UPSTREAM] lib: utils: irqchip: add QEMU virt test for APLIC wired IRQs Raymond Mao
2026-05-04 17:13 ` Raymond Mao [this message]
2026-06-11  5:15 ` [PATCH v2 1/3] lib: utils: irqchip: implement APLIC hwirq operation hooks Anup Patel
2026-06-16 20:30   ` Raymond Mao
2026-06-16 20:49     ` Pawandeep Oza
2026-06-16 21:25       ` Raymond Mao
2026-06-16 22:08         ` Pawandeep Oza
2026-06-16 22:19           ` 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=20260504171342.1655882-3-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