[RFC PATCH 0/2] Preserve supervisor AIA priorities and CTR records on domain switches

whensun theodoruswensanfebruanto025 at gmail.com
Thu Oct 22 20:38:43 PDT 2026


From: Theodorus Wensan Februanto <theodoruswensanfebruanto025 at gmail.com>

This RFC series extends the earlier 5-patch S/HS CSR context series
for https://github.com/riscv-software-src/opensbi/issues/433.
The patches should be applied on top of that earlier series:
https://lists.infradead.org/pipermail/opensbi/2026-October/010804.html

Patch 1 saves and restores supervisor AIA priority registers via the
siselect/sireg indirect CSR window (selectors 0x30..0x3f).
Patch 2 saves and restores Ssctr control, depth, status, and records
through selectors 0x200..0x2ff when Ssctr and Sscsrind are available.

Validation:
  - Generic OpenSBI build passed using riscv64-linux-gnu-gcc.
  - On QEMU 11.0.50, one A->B->A domain transition test passed for
    supervisor priority state at selector 0x30.
  - One A->B->A domain transition test passed for the CTR source entry
    at selector 0x200 (expected/observed 0x80200001).

Both tests used an OpenSBI backend with a test-only SBI domain-switch
extension and CPU extension flags for AIA and CTR. A separate local
fix for an existing floating-point save issue was used to let the
tests execute; it is not part of this series and has already been
reported independently.

These tests cover only selected entries and do not establish correct
behavior for every extension combination or CSR side effect.

This series does not implement IMSIC indirect backing-state
virtualization (selectors 0x70..0xff). It also does not independently
save hip: some bits alias hvip and some depend on hardware interrupt
sources. Maintainer feedback on the appropriate isolation boundaries
for those states would be welcome.

Please review as an RFC rather than a complete fix for Issue #433.

Theodorus Wensan Februanto (2):
  lib: sbi: Preserve supervisor AIA interrupt priorities
  lib: sbi: Preserve supervisor CTR records across domain switches

 lib/sbi/sbi_domain_context.c | 125 ++++++++++++++++++++++++++++++++++-
 1 file changed, 124 insertions(+), 1 deletion(-)

-- 
2.47.3




More information about the opensbi mailing list