public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support
@ 2014-12-11  8:07 zhanghailiang
  2014-12-11 11:48 ` Paolo Bonzini
  2014-12-11 13:08 ` Radim Krčmář
  0 siblings, 2 replies; 11+ messages in thread
From: zhanghailiang @ 2014-12-11  8:07 UTC (permalink / raw)
  To: kvm; +Cc: gleb, pbonzini, peter.huangpeng, zhanghailiang

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@huawei.com>
---
 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



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-12-18  9:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11  8:07 [PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support zhanghailiang
2014-12-11 11:48 ` Paolo Bonzini
2014-12-11 12:53   ` zhanghailiang
2014-12-11 13:28     ` Radim Krčmář
2014-12-11 17:15     ` Paolo Bonzini
2014-12-17 22:17       ` Stefan Fritsch
2014-12-18  3:37         ` zhanghailiang
2014-12-18  8:30           ` Paolo Bonzini
2014-12-18  8:57             ` Stefan Fritsch
2014-12-18  9:23               ` Paolo Bonzini
2014-12-11 13:08 ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox