linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RISC-V:KVM: Add AMO load/store access fault traps to redirect to guest
@ 2024-04-29  9:21 Yu-Wei Hsu
  2024-06-07  7:07 ` Anup Patel
  0 siblings, 1 reply; 2+ messages in thread
From: Yu-Wei Hsu @ 2024-04-29  9:21 UTC (permalink / raw)
  To: anup
  Cc: atishp, paul.walmsley, palmer, aou, kvm, kvm-riscv, linux-riscv,
	linux-kernel, Yu-Wei Hsu

When unhandled AMO load/store access fault traps are not delegated to
VS mode (hedeleg), M mode redirects them back to S mode.
However, upon returning from M mode,the KVM executed in HS mode terminates
VS mode software.
KVM should redirect traps back to VS mode and let the VS mode trap handler
determine the next steps.
This is one approach to handling access fault traps in KVM,
not only redirecting them to VS mode or terminating it.

Signed-off-by: Yu-Wei Hsu <betterman5240@gmail.com>
---
 arch/riscv/kvm/vcpu_exit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
index 2415722c01b8..ef8c5e3ec8a0 100644
--- a/arch/riscv/kvm/vcpu_exit.c
+++ b/arch/riscv/kvm/vcpu_exit.c
@@ -185,6 +185,8 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
 	case EXC_INST_ILLEGAL:
 	case EXC_LOAD_MISALIGNED:
 	case EXC_STORE_MISALIGNED:
+	case EXC_LOAD_ACCESS:
+	case EXC_STORE_ACCESS:
 		if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) {
 			kvm_riscv_vcpu_trap_redirect(vcpu, trap);
 			ret = 1;
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-06-07  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  9:21 [PATCH] RISC-V:KVM: Add AMO load/store access fault traps to redirect to guest Yu-Wei Hsu
2024-06-07  7:07 ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).