]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit7fe0d02ddc7d47e60bb6d5cd08e1b01eee9fc631
tree3c0304dac9f34accef6220fa4e3a2e8d0b815dee
parent06e6170e0ae33ea1ff98f01501371e23c4eee66a
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