Handling faults on new HLV/HSV instructions in Hypervisor Extension draft 0.6


Greg Favor
 

When one of the new HLV/HSV instructions faults, what virtualization and privilege modes are recorded in mstatus.mpp/mpv, or in sstatus.spp/spv and hstatus.spvp?  Are they based on the actual modes from within which the instruction executes (i.e. on HS or U, and V=0), or on the effective modes used by the instruction as it executes (i.e. on spvp and V=1).

Assuming, for example, the trap is taken into HS-mode:

- If the actual modes apply, then hstatus.spvp remains unchanged and sstatus.spp/spv are set to reflect the actual privilege mode and V=0.  The hypervisor would then presumably figure out from htinst what caused this trap?   (In certain cases would the hypervisor need to save the original 'spp/spv' values before doing any HLV/HSV instructions so that it can restore them afterwards?)

- If the effective modes apply, then sstatus.spp and hstatus.spvp are set to the effective privilege mode of the HLV/HSV instruction (as specified by spvp) and sstatus.spv is set to reflect V=1.  The hypervisor would then figure out in some way (such as from htinst?) that this was a re-entry into the hypervisor due to its own actions?  (Typically all three of these fields would end up not changing in their values.  But in certain cases would the hypervisor need to save the original 'spp/spv' values before doing any HLV/HSV instructions so that it can restore them afterwards?)

In any case, which is the intended behavior (which should probably then be clarified in the spec)?

Thanks,
Greg

Join tech-privileged@lists.riscv.org to automatically receive all group messages.