Skip to content

Commit e325618

Browse files
betterman5240avpatel
authored andcommitted
RISC-V: KVM: Redirect AMO load/store access fault traps to guest
The KVM RISC-V does not delegate AMO load/store access fault traps to VS-mode (hedeleg) so typically M-mode takes these traps and redirects them back to HS-mode. However, upon returning from M-mode, the KVM RISC-V running in HS-mode terminates VS-mode software. The KVM RISC-V should redirect AMO load/store access fault traps back to VS-mode and let the VS-mode trap handler determine the next steps. Signed-off-by: Yu-Wei Hsu <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
1 parent da7b1b5 commit e325618

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/riscv/kvm/vcpu_exit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
185185
case EXC_INST_ILLEGAL:
186186
case EXC_LOAD_MISALIGNED:
187187
case EXC_STORE_MISALIGNED:
188+
case EXC_LOAD_ACCESS:
189+
case EXC_STORE_ACCESS:
188190
if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) {
189191
kvm_riscv_vcpu_trap_redirect(vcpu, trap);
190192
ret = 1;

0 commit comments

Comments
 (0)