Skip to content

Introduce Virtual IRQ (VIRQ) framework

Raymond Mao opensbi 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 0 repliesNew
  2. v110 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Rebase on master and adapt to its irqchip interfaces, dropping the old scratch-local provider lookup workaround.
- Replace the private VIRQ POP/COMPLETE ecall extension with RPMI SYSTEM_IRQ 2.0 services over SBI MPXY, including batched SYSIRQ_CLAIM.
- Add an optional experimental Yield ecall for explicit completion after device handling; retain implicit completion through the next valid CLAIM.
- Track outstanding claims per channel and target, preserve failed completions for retry, and block return switches until all pending and claimed work is drained.
- Keep SEPC separate from the M-mode trap frame's MEPC and preserve the advanced ecall return state across domain switches.
- Key routes by (chip_uid, hwirq), allowing identical HWIRQ numbers on different physical controllers without routing collisions.
- Select boot harts during domain finalization and activate couriers only after boot-hart selection and all mapping/channel setup.
- Add irqchip-independent courier registration with DT IRQ flags, target affinity and rollback; use APLIC IDC indices for affinity.
- Reject malformed DT argument lists, extra IRQ specifier cells and invalid scalar properties; update the binding documentation.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12lib: utils: add RPMI SYSTEM_IRQ service supportinclude/sbi_utils/mailbox/rpmi_msgprot.h include/sbi_utils/sysirq/rpmi_sysirq.h lib/utils/mpxy/objects.mk +1 more+323 -00 replies
2/12lib: sbi: add experimental Yield ECALL extensioninclude/sbi/sbi_ecall_interface.h lib/sbi/Kconfig lib/sbi/objects.mk +1 more+60 -00 replies
3/12lib: irqchip: add S-mode notification helpersinclude/sbi/sbi_irqchip.h lib/sbi/sbi_irqchip.c+28 -20 replies
4/12lib: sbi: domain: support VIRQ couriering domain context switchinclude/sbi/sbi_domain.h include/sbi/sbi_domain_context.h lib/sbi/sbi_domain_context.c +1 more+166 -10 replies
5/12lib: sbi: domain: ensure boot_hartid is assignedlib/sbi/sbi_domain.c+35 -00 replies
6/12lib: sbi: Add Virtual IRQ (VIRQ) subsysteminclude/sbi/sbi_domain.h include/sbi/sbi_virq.h lib/sbi/objects.mk +2 more+1759 -00 replies
7/12lib: sbi: domain: add domain lookup by nameinclude/sbi/sbi_domain.h lib/sbi/sbi_domain.c+18 -00 replies
8/12lib: utils: irqchip: derive APLIC targets from sysirq nodesinclude/sbi_utils/irqchip/aplic.h lib/utils/irqchip/fdt_irqchip_aplic.c+104 -00 replies
9/12lib: utils: irqchip: Add helper to register VIRQ courier handlerinclude/sbi_utils/irqchip/aplic.h lib/utils/irqchip/aplic.c+58 -20 replies
10/12lib: utils: fdt: parse sysirq routing from DTinclude/sbi_utils/fdt/fdt_helper.h lib/sbi/sbi_domain.c lib/utils/fdt/fdt_domain.c +1 more+179 -50 replies
11/12docs: domain: document sysirq VIRQ mapping and routing rulesdocs/domain_support.md+55 -00 replies
12/12platform: generic: Add sample dts overlays for testing hwirq/domain route rulesplatform/generic/virt/hwirq_bind_domain.dts platform/generic/virt/hwirq_bind_domain_linux_bmapp.dts+232 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/12] Introduce Virtual IRQ (VIRQ) framework

From: Raymond Mao <[email protected]>

This series introduces a Virtual IRQ (VIRQ) framework for OpenSBI to support domain-aware wired interrupt couriering.

The main use case is to let OpenSBI receive a host HWIRQ in M-mode, map it into a per-channel VIRQ number space, route it to a target domain, notify the target S-mode payload, and let that payload claim the pending VIRQs through RPMI SYSTEM_IRQ over SBI MPXY.

The implementation is organized as follows:

- add RPMI SYSTEM_IRQ service support, including SYSIRQ_CLAIM
- add an optional experimental Yield ecall for explicit completion
- add irqchip helpers for S-mode pending notification
- extend domain context switching to support VIRQ-driven cross-domain couriering and return-to-previous-domain flow
- add the core VIRQ mapping, routing, and per-(domain,hart) pending queue framework
- parse sysirq routing rules from DT under /chosen/opensbi-domains
- derive APLIC target hart routing from sysirq nodes
- update the irqchip/APLIC path to support deferred completion and per-HWIRQ APLIC targets
- select domain boot harts before activating physical sources
- document the DT binding and routing rules

The DT routing model is based on "opensbi,mpxy-sysirq" nodes. Each interrupts-extended entry contributes one routed physical source, its entry index becomes the VIRQ number within the selected opensbi,mpxy-channel-id, and opensbi,domain selects the destination OpenSBI domain.

Claimed sources remain masked while the payload handles their device conditions. The next valid CLAIM completes the previous batch, or the payload can complete it explicitly through Yield. Return to a previously interrupted domain is deferred until pending and claimed work is drained. The Yield EID is experimental and is not an official SBI assignment.

This version reuses the existing irqchip infrastructure.

Patch 12 contains sample DT overlays for reference only and is marked [NOT-FOR-UPSTREAM].

The series are also placed at:
https://gitlab.com/riseproject/riscv-optee/opensbi/-/tree/rp022-m1

Test instructions are available at:
https://riscv-optee-docs-c9fea0.gitlab.io/rp022/milestone1/

Changes in v2:

- Rebase on master and adapt to its irqchip interfaces, dropping the old scratch-local provider lookup workaround.
- Replace the private VIRQ POP/COMPLETE ecall extension with RPMI SYSTEM_IRQ 2.0 services over SBI MPXY, including batched SYSIRQ_CLAIM.
- Add an optional experimental Yield ecall for explicit completion after device handling; retain implicit completion through the next valid CLAIM.
- Track outstanding claims per channel and target, preserve failed completions for retry, and block return switches until all pending and claimed work is drained.
- Keep SEPC separate from the M-mode trap frame's MEPC and preserve the advanced ecall return state across domain switches.
- Key routes by (chip_uid, hwirq), allowing identical HWIRQ numbers on different physical controllers without routing collisions.
- Select boot harts during domain finalization and activate couriers only after boot-hart selection and all mapping/channel setup.
- Add irqchip-independent courier registration with DT IRQ flags, target affinity and rollback; use APLIC IDC indices for affinity.
- Reject malformed DT argument lists, extra IRQ specifier cells and invalid scalar properties; update the binding documentation.

Raymond Mao (12):
lib: utils: add RPMI SYSTEM_IRQ service support
lib: sbi: add experimental Yield ECALL extension
lib: irqchip: add S-mode notification helpers
lib: sbi: domain: support VIRQ couriering domain context switch
lib: sbi: domain: ensure boot_hartid is assigned
lib: sbi: Add Virtual IRQ (VIRQ) subsystem
lib: sbi: domain: add domain lookup by name
lib: utils: irqchip: derive APLIC targets from sysirq nodes
lib: utils: irqchip: Add helper to register VIRQ courier handler
lib: utils: fdt: parse sysirq routing from DT
docs: domain: document sysirq VIRQ mapping and routing rules [NOT-FOR-UPSTREAM] platform: generic: Add sample dts overlays for
testing hwirq/domain route rules

 docs/domain_support.md                        |   55 +
 include/sbi/sbi_domain.h                      |    7 +
 include/sbi/sbi_domain_context.h              |   24 +
 include/sbi/sbi_ecall_interface.h             |    6 +
 include/sbi/sbi_irqchip.h                     |    9 +
 include/sbi/sbi_virq.h                        |  513 +++++++
 include/sbi_utils/fdt/fdt_helper.h            |    8 +
 include/sbi_utils/irqchip/aplic.h             |    4 +
 include/sbi_utils/mailbox/rpmi_msgprot.h      |   25 +
 include/sbi_utils/sysirq/rpmi_sysirq.h        |   30 +
 lib/sbi/Kconfig                               |    9 +
 lib/sbi/objects.mk                            |    4 +
 lib/sbi/sbi_domain.c                          |   61 +
 lib/sbi/sbi_domain_context.c                  |  130 +-
 lib/sbi/sbi_ecall_yield.c                     |   42 +
 lib/sbi/sbi_irqchip.c                         |   21 +-
 lib/sbi/sbi_trap.c                            |   11 +
 lib/sbi/sbi_virq.c                            | 1235 +++++++++++++++++
 lib/utils/fdt/fdt_domain.c                    |  116 +-
 lib/utils/fdt/fdt_helper.c                    |   57 +-
 lib/utils/irqchip/aplic.c                     |   57 +-
 lib/utils/irqchip/fdt_irqchip_aplic.c         |  103 ++
 lib/utils/mpxy/objects.mk                     |    2 +
 lib/utils/sysirq/rpmi_sysirq.c                |  266 ++++
 platform/generic/virt/hwirq_bind_domain.dts   |  107 ++
 .../virt/hwirq_bind_domain_linux_bmapp.dts    |  125 ++
 26 files changed, 3017 insertions(+), 10 deletions(-)
 create mode 100644 include/sbi/sbi_virq.h
 create mode 100644 include/sbi_utils/sysirq/rpmi_sysirq.h
 create mode 100644 lib/sbi/sbi_ecall_yield.c
 create mode 100644 lib/sbi/sbi_virq.c
 create mode 100644 lib/utils/sysirq/rpmi_sysirq.c
 create mode 100644 platform/generic/virt/hwirq_bind_domain.dts
 create mode 100644 platform/generic/virt/hwirq_bind_domain_linux_bmapp.dts
Signature · 7 lines
2.25.1


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