diff options
| -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) { |
