KVM: selftests: riscv: Improve unexpected guest trap handling
authorAnup Patel <apatel@ventanamicro.com>
Sat, 9 Apr 2022 04:32:36 +0000 (10:02 +0530)
committerAnup Patel <anup@brainfault.org>
Fri, 20 May 2022 03:38:56 +0000 (09:08 +0530)
commitac6c85e962d4c009c499d93657f25f46fd8212b9
tree3c0304dac9f34accef6220fa4e3a2e8d0b815dee
parent42226c989789d8da4af1de0c31070c96726d990c
KVM: selftests: riscv: Improve unexpected guest trap handling

Currently, we simply hang using "while (1) ;" upon any unexpected
guest traps because the default guest trap handler is guest_hang().

The above approach is not useful to anyone because KVM selftests
users will only see a hung application upon any unexpected guest
trap.

This patch improves unexpected guest trap handling for KVM RISC-V
selftests by doing the following:
1) Return to host user-space
2) Dump VCPU registers
3) Die using TEST_ASSERT(0, ...)

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Tested-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
tools/testing/selftests/kvm/include/riscv/processor.h
tools/testing/selftests/kvm/lib/riscv/processor.c
tools/testing/selftests/kvm/lib/riscv/ucall.c