[RFC PATCH v2 6/8] lib: sbi: Preserve supervisor AIA interrupt priorities

Radim Krcmar rkrcmar at qti.qualcomm.com
Tue Oct 27 11:51:28 PDT 2026


2026-10-23T00:09:23-07:00, Theodorus Wensan Februanto <theodoruswensanfebruanto025 at gmail.com>:
> The siselect/sireg window exposes supervisor interrupt priority state
> at selector values 0x30 through 0x3f.  Save and restore the implemented
> bank across domain switches when Smaia is available.
>
> Only sireg is accessed in this selector range.  The other sireg windows
> can trap and must not be read.  IMSIC indirect registers at 0x70-0xff
> are not handled in this change.

Simply context switching IMSIC files through 0x70-0xff wouldn't bring us
much closer to implementing AIA for domains.

In systems without Smsdia, I think it would be better to give AIA only
to a single domain on each hart and prevent access from other domains,
because it's not like concurent domains can sanely share AIA anyway.

To prevent other domains from accessing AIA, we'd need machinery to
define the set of available features for each domain, and manipulate
mstateen.

> Link: https://github.com/riscv-software-src/opensbi/issues/433
> Signed-off-by: Theodorus Wensan Februanto <theodoruswensanfebruanto025 at gmail.com>
> ---
> diff --git a/lib/sbi/sbi_domain_context.c b/lib/sbi/sbi_domain_context.c
> @@ -93,6 +93,8 @@ struct hart_context {
> +	/** AIA supervisor interrupt priority register bank */
> +	unsigned long siprio[16];

The priorities are u32[16] or u64[8], although the code wastes memory to
look very clean, so I'm not sure we want to optimize...

Thanks.


More information about the opensbi mailing list