diff options
author | Prarit Bhargava <prarit@redhat.com> | 2012-07-06 13:47:39 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-11 12:33:32 -0400 |
commit | fc73373b33f5f965f2f82bfbc40ef8e6072e986d (patch) | |
tree | acb8f9c464c6bd9f737f6c4f88c1941e2f401d53 | |
parent | 58d8b1728ea3da391ef01c43a384ea06ce4b7c8a (diff) |
KVM: Add x86_hyper_kvm to complete detect_hypervisor_platform check
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>
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/hypervisor.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/kvm.c | 14 |
3 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 7a15153c675d..b518c7509933 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper; | |||
49 | extern const struct hypervisor_x86 x86_hyper_vmware; | 49 | extern const struct hypervisor_x86 x86_hyper_vmware; |
50 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | 50 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; |
51 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; | 51 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; |
52 | extern const struct hypervisor_x86 x86_hyper_kvm; | ||
52 | 53 | ||
53 | static inline bool hypervisor_x2apic_available(void) | 54 | static inline bool hypervisor_x2apic_available(void) |
54 | { | 55 | { |
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c index 755f64fb0743..6d6dd7afb229 100644 --- a/arch/x86/kernel/cpu/hypervisor.c +++ b/arch/x86/kernel/cpu/hypervisor.c | |||
@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] = | |||
37 | #endif | 37 | #endif |
38 | &x86_hyper_vmware, | 38 | &x86_hyper_vmware, |
39 | &x86_hyper_ms_hyperv, | 39 | &x86_hyper_ms_hyperv, |
40 | &x86_hyper_kvm, | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | const struct hypervisor_x86 *x86_hyper; | 43 | const struct hypervisor_x86 *x86_hyper; |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 75ab94c75c7a..299cf1470923 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <asm/idle.h> | 41 | #include <asm/idle.h> |
42 | #include <asm/apic.h> | 42 | #include <asm/apic.h> |
43 | #include <asm/apicdef.h> | 43 | #include <asm/apicdef.h> |
44 | #include <asm/hypervisor.h> | ||
44 | 45 | ||
45 | static int kvmapf = 1; | 46 | static int kvmapf = 1; |
46 | 47 | ||
@@ -483,6 +484,19 @@ void __init kvm_guest_init(void) | |||
483 | #endif | 484 | #endif |
484 | } | 485 | } |
485 | 486 | ||
487 | static bool __init kvm_detect(void) | ||
488 | { | ||
489 | if (!kvm_para_available()) | ||
490 | return false; | ||
491 | return true; | ||
492 | } | ||
493 | |||
494 | const struct hypervisor_x86 x86_hyper_kvm __refconst = { | ||
495 | .name = "KVM", | ||
496 | .detect = kvm_detect, | ||
497 | }; | ||
498 | EXPORT_SYMBOL_GPL(x86_hyper_kvm); | ||
499 | |||
486 | static __init int activate_jump_labels(void) | 500 | static __init int activate_jump_labels(void) |
487 | { | 501 | { |
488 | if (has_steal_clock) { | 502 | if (has_steal_clock) { |