[PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



User space (i.e. QEMU) should be able to check whether KVM
supports apic-v. User space will use this to decide whether enable
emulated MSR-based APIC (i.e. hyperv-vapic).

Signed-off-by: zhanghailiang <zhang.zhanghailiang@xxxxxxxxxx>
---
 arch/x86/kvm/x86.c       | 6 ++++++
 include/uapi/linux/kvm.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0033df3..aad4437 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2775,6 +2775,12 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_TSC_DEADLINE_TIMER:
 		r = boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER);
 		break;
+	case KVM_CAP_VMX_APICV:
+		if (kvm)
+			r = kvm_apic_vid_enabled(kvm);
+		else
+			r = 0;
+		break;
 	default:
 		r = 0;
 		break;
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 6076882..1a55d1a 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -761,6 +761,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_FIXUP_HCALL 103
 #define KVM_CAP_PPC_ENABLE_HCALL 104
 #define KVM_CAP_CHECK_EXTENSION_VM 105
+#define KVM_CAP_VMX_APICV 106
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
1.8.3.4


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux