Skip to content

Commit 51c5895

Browse files
zcxGGmuavpatel
authored andcommitted
RISC-V: KVM: Redirect instruction access fault trap to guest
The M-mode redirects an unhandled instruction access fault trap back to S-mode when not delegating it to VS-mode(hedeleg). However, KVM running in HS-mode terminates the VS-mode software when back from M-mode. The KVM should redirect the trap back to VS-mode, and let VS-mode trap handler decide the next step. Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atishp@rivosinc.com> Link: https://lore.kernel.org/r/20241224-kvm_guest_stat-v2-1-08a77ac36b02@rivosinc.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 144dfe4 commit 51c5895

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/riscv/kvm/vcpu_exit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
187187
case EXC_STORE_MISALIGNED:
188188
case EXC_LOAD_ACCESS:
189189
case EXC_STORE_ACCESS:
190+
case EXC_INST_ACCESS:
190191
if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) {
191192
kvm_riscv_vcpu_trap_redirect(vcpu, trap);
192193
ret = 1;

0 commit comments

Comments
 (0)