[RFC PATCH v4 0/5] Preserve more architectural state across domain switches

Theodorus Wensan Februanto theodoruswensanfebruanto025 at gmail.com
Sat Nov 7 15:44:16 PST 2026


This RFC series extends OpenSBI domain context switching to preserve additional architectural state, including hypervisor and virtual supervisor CSRs, supervisor counter inhibit configuration, indirect CSR selectors, supervisor control transfer records, and vector configuration state.

Changes since v3:

- Check the privileged specification version before accessing HENVCFG.
- Save SENVCFG before switching HENVCFG and restore it afterward.
- Use the software timer delta to preserve HTIMEDELTA when Zicntr is unavailable, including RV32 support.
- Consolidate the Smaia checks.
- Move vsiselect into struct hart_context_hext.
- Remove the Sstc patch from this series. Preserving timer compare registers alone is insufficient to handle timer expiration for inactive domains. This requires additional work on timer scheduling.

Validation:

- All five commits build successfully for both RV32 and RV64 using the OpenSBI generic platform.
- The complete series also builds successfully for both architectures.
- Runtime regression testing has not been repeated for v4.

Feedback is welcome.

Theodorus Wensan Februanto (5):
  lib: sbi: Preserve hypervisor and VS state across domain switches
  lib: sbi: Preserve supervisor count inhibit configuration
  lib: sbi: Preserve S/VS indirect CSR selectors
  lib: sbi: Preserve supervisor CTR records across domain switches
  lib: sbi: Preserve vl and vtype during domain switches

 include/sbi/sbi_hart.h       |   2 +
 include/sbi/sbi_vector.h     |   2 +
 lib/sbi/sbi_domain_context.c | 303 ++++++++++++++++++++++++++++++++++-
 lib/sbi/sbi_hart.c           |  11 ++
 lib/sbi/sbi_vector.c         |  11 ++
 5 files changed, 327 insertions(+), 2 deletions(-)

-- 
2.43.0




More information about the opensbi mailing list