[RFC] OpenSBI: Lazy floating-point and vector context switching
dave.patel at riscstar.com
dave.patel at riscstar.com
Thu Mar 12 04:01:58 PDT 2026
Hi,
On , wrote:
>This does not work in Machine mode, where OpenSBI resides.
The code provided works in Machine mode. It has been tested in an M-mode
environment where OpenSBI executes using S-mode bare metal app.
>See privileged spec, section "Extension Context Status in mstatus
>Register": "Machine and Supervisor modes share a single copy of the FS,
>VS, and XS bits."
Yes, that is correct. Machine and Supervisor modes share a single copy
of the FS and VS bits.
>This means that a Supervisor mode program can set sstatus.FS to Dirty,
>access floating point state, and set sstatus.FS back to Off without
?Machine mode software noticing ever.
That is correct. However, in the proposed approach the lazy context
switch is triggered only when sstatus.FS is Dirty. If sstatus.FS is not
Dirty, then no save/restore operation is performed.
>See also https://github.com/riscv/riscv-isa-manual/issues/832
>"Impossible to implement HS-level sstatus.{FS,VS} = Off with
>software-emulated hypervisor extension?" where I ran into the same
>problem in a different context.
Could you please elaborate on how the issue described there applies in
this context?
>So basically, lazy saving/restoring F and V in Machine mode with
>multiple Supervisor mode programs is not a designed feature, and is not
>possible as the privileged architecture is currently designed. For these
>use cases non-lazy switching is required.
Could you provide more details on the limitations you are referring to?
In particular, it would be helpful to understand whether the concern is
related to the shared FS/VS state visibility between privilege levels,
or to some other aspect of the privileged architecture.
Thanks for the review.
Regards,
Dave
More information about the opensbi
mailing list