summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kvm/vm.c
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-05-06 16:00:47 +0200
committerHuacai Chen <chenhuacai@loongson.cn>2024-05-06 16:00:47 +0200
commit163e9fc6957fc24d1d6c0a30a3febfd2ecade039 (patch)
tree00967c144a87dd2512a823725a2c60be600695e1 /arch/loongarch/kvm/vm.c
parentLoongArch: KVM: Add PV IPI support on guest side (diff)
downloadlinux-163e9fc6957fc24d1d6c0a30a3febfd2ecade039.tar.xz
linux-163e9fc6957fc24d1d6c0a30a3febfd2ecade039.zip
LoongArch: KVM: Add software breakpoint support
When VM runs in kvm mode, system will not exit to host mode when executing a general software breakpoint instruction such as INSN_BREAK, trap exception happens in guest mode rather than host mode. In order to debug guest kernel on host side, one mechanism should be used to let VM exit to host mode. Here a hypercall instruction with a special code is used for software breakpoint usage. VM exits to host mode and kvm hypervisor identifies the special hypercall code and sets exit_reason with KVM_EXIT_DEBUG. And then let qemu handle it. Idea comes from ppc kvm, one api KVM_REG_LOONGARCH_DEBUG_INST is added to get the hypercall code. VMM needs get sw breakpoint instruction with this api and set the corresponding sw break point for guest kernel. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to '')
-rw-r--r--arch/loongarch/kvm/vm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
index 191d82309a1e..6b2e4f66ad26 100644
--- a/arch/loongarch/kvm/vm.c
+++ b/arch/loongarch/kvm/vm.c
@@ -76,6 +76,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_IMMEDIATE_EXIT:
case KVM_CAP_IOEVENTFD:
case KVM_CAP_MP_STATE:
+ case KVM_CAP_SET_GUEST_DEBUG:
r = 1;
break;
case KVM_CAP_NR_VCPUS: