RISC-V: KVM: Implement kvm_arch_vcpu_ioctl_set_guest_debug()
authorChao Du <duchao@eswincomputing.com>
Tue, 2 Apr 2024 06:26:26 +0000 (06:26 +0000)
committerAnup Patel <anup@brainfault.org>
Mon, 8 Apr 2024 08:36:27 +0000 (14:06 +0530)
commitedcbe90f128922830228b9a5656c944a5d7ac306
tree84f82f5284512e4762e7d3c4bc5b21e28476c42b
parentfec50db7033ea478773b159e0e2efb135270e3b7
RISC-V: KVM: Implement kvm_arch_vcpu_ioctl_set_guest_debug()

kvm_vm_ioctl_check_extension(): Return 1 if KVM_CAP_SET_GUEST_DEBUG is
been checked.

kvm_arch_vcpu_ioctl_set_guest_debug(): Update the guest_debug flags
from userspace accordingly. Route the breakpoint exceptions to HS mode
if the VCPU is being debugged by userspace, by clearing the
corresponding bit in hedeleg.

Initialize the hedeleg configuration in kvm_riscv_vcpu_setup_config().
Write the actual CSR in kvm_arch_vcpu_load().

Signed-off-by: Chao Du <duchao@eswincomputing.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240402062628.5425-2-duchao@eswincomputing.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/main.c
arch/riscv/kvm/vcpu.c
arch/riscv/kvm/vm.c