From 19bff88e65b552f54c191e600498bd50ff47e1ef Mon Sep 17 00:00:00 2001 From: wchen Date: Sat, 20 May 2023 23:01:16 +0800 Subject: 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 Reviewed-by: Anup Patel Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/riscv/include/asm/csr.h') diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index b6acb7ed115f..917814a0f99e 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -82,7 +82,9 @@ #define EXC_INST_ACCESS 1 #define EXC_INST_ILLEGAL 2 #define EXC_BREAKPOINT 3 +#define EXC_LOAD_MISALIGNED 4 #define EXC_LOAD_ACCESS 5 +#define EXC_STORE_MISALIGNED 6 #define EXC_STORE_ACCESS 7 #define EXC_SYSCALL 8 #define EXC_HYPERVISOR_SYSCALL 9 -- cgit v1.2.3-59-g8ed1b