KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly
PATCH 1/1 KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly
KVM_CAP_SET_GUEST_DEBUG should be supported for x86 however it's not declared as supported. My wild guess is that userspaces like QEMU are using "#ifdef KVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be wrong because the compilation host may not be the runtime host.
The userspace might still want to keep the old "#ifdef" though to not break the guest debug on old kernels.
---
I also think both ppc and s390 may need similar thing, but I didn't touch them yet because of not confident enough to cover all cases.
--- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/x86.c +1 -0
@@ -3385,6 +3385,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_GET_MSR_FEATURES :case KVM_CAP_MSR_PLATFORM_INFO :case KVM_CAP_EXCEPTION_PAYLOAD : +case KVM_CAP_SET_GUEST_DEBUG : r =1 ;break ;case KVM_CAP_SYNC_REGS :
Signature · 1 line
2.26.2
Paolo Bonzini
maintainerQuoted 5 lines · Peter Xu
KVM_CAP_SET_GUEST_DEBUGshould be supported for x86 however it's not declared as supported. My wild guess is that userspaces like QEMU are using "#ifdefKVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be wrong because the compilation host may not be the runtime host.
Quoted 8 lines
The userspace might still want to keep the old "#ifdef" though to not break the guest debug on old kernels.
Signed-off-by Peter Xu <[email protected]>---
I also think both ppc and s390 may need similar thing, but I didn't touch them yet because of not confident enough to cover all cases.
Indeed, I'll squash this:
arch/powerpc/kvm/powerpc.c +1 -0
@@ -521,6 +521,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_IOEVENTFD :case KVM_CAP_DEVICE_CTRL :case KVM_CAP_IMMEDIATE_EXIT : +case KVM_CAP_SET_GUEST_DEBUG : r =1 ;break ;case KVM_CAP_PPC_GUEST_DEBUG_SSTEP :
arch/s390/kvm/kvm-s390.c +1 -0
@@ -545,6 +545,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_S390_AIS :case KVM_CAP_S390_AIS_MIGRATION :case KVM_CAP_S390_VCPU_RESETS : +case KVM_CAP_SET_GUEST_DEBUG : r =1 ;break ;case KVM_CAP_S390_HPAGE_1M :