Skip to content

Commit

Permalink
KVM: Add x86_hyper_kvm to complete detect_hypervisor_platform check
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Avi Kivity <[email protected]>
Cc: Gleb Natapov <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Marcelo Tostatti <[email protected]>
Cc: [email protected]
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
prarit authored and avikivity committed Jul 11, 2012
1 parent 58d8b17 commit fc73373
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/include/asm/hypervisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/hypervisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions arch/x86/kernel/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <asm/idle.h>
#include <asm/apic.h>
#include <asm/apicdef.h>
#include <asm/hypervisor.h>

static int kvmapf = 1;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fc73373

Please sign in to comment.