mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RISC-V: KVM: Redirect instruction access fault trap to guest
@ 2024-08-29  6:20 zhouquan
  2024-09-12  9:03 ` Quan Zhou
  0 siblings, 1 reply; 6+ messages in thread
From: zhouquan @ 2024-08-29  6:20 UTC (permalink / raw)
  To: anup, ajones, atishp, paul.walmsley, palmer, aou
  Cc: linux-kernel, linux-riscv, kvm, kvm-riscv, Quan Zhou

From: Quan Zhou <zhouquan@iscas.ac.cn>

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>
---
 arch/riscv/kvm/vcpu_exit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
index fa98e5c024b2..696b62850d0b 100644
--- a/arch/riscv/kvm/vcpu_exit.c
+++ b/arch/riscv/kvm/vcpu_exit.c
@@ -182,6 +182,7 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
 	ret = -EFAULT;
 	run->exit_reason = KVM_EXIT_UNKNOWN;
 	switch (trap->scause) {
+	case EXC_INST_ACCESS:
 	case EXC_INST_ILLEGAL:
 	case EXC_LOAD_MISALIGNED:
 	case EXC_STORE_MISALIGNED:

base-commit: 7c626ce4bae1ac14f60076d00eafe71af30450ba
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-11  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29  6:20 [PATCH] RISC-V: KVM: Redirect instruction access fault trap to guest zhouquan
2024-09-12  9:03 ` Quan Zhou
2024-09-13  0:39   ` Samuel Holland
2024-09-13  4:32     ` Anup Patel
2024-09-14 16:39       ` Samuel Holland
2024-12-11  8:00         ` Atish Patra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®