RISC-V: KVM: Redirect AMO load/store misaligned traps to guest
authorwchen <waylingii@gmail.com>
Sat, 20 May 2023 15:01:16 +0000 (23:01 +0800)
committerAnup Patel <anup@brainfault.org>
Tue, 6 Jun 2023 03:34:11 +0000 (09:04 +0530)
commit19bff88e65b552f54c191e600498bd50ff47e1ef
treeb7b06a0ac002f1773476916f9d3c6079dadaba78
parent78329084b86436b9a77cedd3e1331734c442d413
RISC-V: KVM: Redirect AMO load/store misaligned traps to guest

The M-mode redirects an unhandled misaligned 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.
Here is a way to handle misaligned traps in KVM,
not only directing them to VS-mode or terminate it.

Signed-off-by: wchen <waylingII@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/csr.h
arch/riscv/kvm/vcpu_exit.c