RISC-V: KVM: Handle breakpoint exits for VCPU
authorChao Du <duchao@eswincomputing.com>
Tue, 2 Apr 2024 06:26:27 +0000 (06:26 +0000)
committerAnup Patel <anup@brainfault.org>
Mon, 8 Apr 2024 08:36:27 +0000 (14:06 +0530)
Exit to userspace for breakpoint traps. Set the exit_reason as
KVM_EXIT_DEBUG before exit.

Signed-off-by: Chao Du <duchao@eswincomputing.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240402062628.5425-3-duchao@eswincomputing.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/vcpu_exit.c

index 2415722c01b8e9194a8a2c87d86d70e97a9ae6f4..5761f95abb60be3735171b4b7fff2c8ebabe600e 100644 (file)
@@ -204,6 +204,10 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
                if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV)
                        ret = kvm_riscv_vcpu_sbi_ecall(vcpu, run);
                break;
+       case EXC_BREAKPOINT:
+               run->exit_reason = KVM_EXIT_DEBUG;
+               ret = 0;
+               break;
        default:
                break;
        }