KVM: Add x86_hyper_kvm to complete detect_hypervisor_platform check
authorPrarit Bhargava <prarit@redhat.com>
Fri, 6 Jul 2012 17:47:39 +0000 (13:47 -0400)
committerAvi Kivity <avi@redhat.com>
Wed, 11 Jul 2012 16:33:32 +0000 (19:33 +0300)
While debugging I noticed that unlike all the other hypervisor code in the
kernel, kvm does not have an entry for x86_hyper which is used in
detect_hypervisor_platform() which results in a nice printk in the
syslog.  This is only really a stub function but it
does make kvm more consistent with the other hypervisors.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Marcelo Tostatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/hypervisor.h
arch/x86/kernel/cpu/hypervisor.c
arch/x86/kernel/kvm.c

index 7a15153c675ddc1a87c4e736bbd472a008cf5789..b518c7509933337225756646fcbd73a6882c2990 100644 (file)
@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper;
 extern const struct hypervisor_x86 x86_hyper_vmware;
 extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
 extern const struct hypervisor_x86 x86_hyper_xen_hvm;
+extern const struct hypervisor_x86 x86_hyper_kvm;
 
 static inline bool hypervisor_x2apic_available(void)
 {
index 755f64fb07432054f35026c74ce7a54ab57e97c9..6d6dd7afb2296b939470a66a091299dde4ddec94 100644 (file)
@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =
 #endif
        &x86_hyper_vmware,
        &x86_hyper_ms_hyperv,
+       &x86_hyper_kvm,
 };
 
 const struct hypervisor_x86 *x86_hyper;
index 75ab94c75c7a4a8dba8a68af23d46c97f9beb191..299cf1470923fc3559ca8d34c8ccf76b595c2f34 100644 (file)
@@ -41,6 +41,7 @@
 #include <asm/idle.h>
 #include <asm/apic.h>
 #include <asm/apicdef.h>
+#include <asm/hypervisor.h>
 
 static int kvmapf = 1;
 
@@ -483,6 +484,19 @@ void __init kvm_guest_init(void)
 #endif
 }
 
+static bool __init kvm_detect(void)
+{
+       if (!kvm_para_available())
+               return false;
+       return true;
+}
+
+const struct hypervisor_x86 x86_hyper_kvm __refconst = {
+       .name                   = "KVM",
+       .detect                 = kvm_detect,
+};
+EXPORT_SYMBOL_GPL(x86_hyper_kvm);
+
 static __init int activate_jump_labels(void)
 {
        if (has_steal_clock) {