Commit e3256183 authored by Yu-Wei Hsu's avatar Yu-Wei Hsu Committed by Anup Patel

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: default avatarYu-Wei Hsu <betterman5240@gmail.com>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240429092113.70695-1-betterman5240@gmail.comSigned-off-by: default avatarAnup Patel <anup@brainfault.org>
parent da7b1b52
...@@ -185,6 +185,8 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, ...@@ -185,6 +185,8 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
case EXC_INST_ILLEGAL: case EXC_INST_ILLEGAL:
case EXC_LOAD_MISALIGNED: case EXC_LOAD_MISALIGNED:
case EXC_STORE_MISALIGNED: case EXC_STORE_MISALIGNED:
case EXC_LOAD_ACCESS:
case EXC_STORE_ACCESS:
if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) { if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) {
kvm_riscv_vcpu_trap_redirect(vcpu, trap); kvm_riscv_vcpu_trap_redirect(vcpu, trap);
ret = 1; ret = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment