diff options
Diffstat (limited to 'arch/x86/include/asm/hypervisor.h')
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 0ead9dbb9130..1b0a5abcd8ae 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -23,11 +23,22 @@ | |||
23 | #ifdef CONFIG_HYPERVISOR_GUEST | 23 | #ifdef CONFIG_HYPERVISOR_GUEST |
24 | 24 | ||
25 | #include <asm/kvm_para.h> | 25 | #include <asm/kvm_para.h> |
26 | #include <asm/x86_init.h> | ||
26 | #include <asm/xen/hypervisor.h> | 27 | #include <asm/xen/hypervisor.h> |
27 | 28 | ||
28 | /* | 29 | /* |
29 | * x86 hypervisor information | 30 | * x86 hypervisor information |
30 | */ | 31 | */ |
32 | |||
33 | enum x86_hypervisor_type { | ||
34 | X86_HYPER_NATIVE = 0, | ||
35 | X86_HYPER_VMWARE, | ||
36 | X86_HYPER_MS_HYPERV, | ||
37 | X86_HYPER_XEN_PV, | ||
38 | X86_HYPER_XEN_HVM, | ||
39 | X86_HYPER_KVM, | ||
40 | }; | ||
41 | |||
31 | struct hypervisor_x86 { | 42 | struct hypervisor_x86 { |
32 | /* Hypervisor name */ | 43 | /* Hypervisor name */ |
33 | const char *name; | 44 | const char *name; |
@@ -35,40 +46,19 @@ struct hypervisor_x86 { | |||
35 | /* Detection routine */ | 46 | /* Detection routine */ |
36 | uint32_t (*detect)(void); | 47 | uint32_t (*detect)(void); |
37 | 48 | ||
38 | /* Platform setup (run once per boot) */ | 49 | /* Hypervisor type */ |
39 | void (*init_platform)(void); | 50 | enum x86_hypervisor_type type; |
40 | |||
41 | /* X2APIC detection (run once per boot) */ | ||
42 | bool (*x2apic_available)(void); | ||
43 | 51 | ||
44 | /* pin current vcpu to specified physical cpu (run rarely) */ | 52 | /* init time callbacks */ |
45 | void (*pin_vcpu)(int); | 53 | struct x86_hyper_init init; |
46 | 54 | ||
47 | /* called during init_mem_mapping() to setup early mappings. */ | 55 | /* runtime callbacks */ |
48 | void (*init_mem_mapping)(void); | 56 | struct x86_hyper_runtime runtime; |
49 | }; | 57 | }; |
50 | 58 | ||
51 | extern const struct hypervisor_x86 *x86_hyper; | 59 | extern enum x86_hypervisor_type x86_hyper_type; |
52 | |||
53 | /* Recognized hypervisors */ | ||
54 | extern const struct hypervisor_x86 x86_hyper_vmware; | ||
55 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | ||
56 | extern const struct hypervisor_x86 x86_hyper_xen_pv; | ||
57 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; | ||
58 | extern const struct hypervisor_x86 x86_hyper_kvm; | ||
59 | |||
60 | extern void init_hypervisor_platform(void); | 60 | extern void init_hypervisor_platform(void); |
61 | extern bool hypervisor_x2apic_available(void); | ||
62 | extern void hypervisor_pin_vcpu(int cpu); | ||
63 | |||
64 | static inline void hypervisor_init_mem_mapping(void) | ||
65 | { | ||
66 | if (x86_hyper && x86_hyper->init_mem_mapping) | ||
67 | x86_hyper->init_mem_mapping(); | ||
68 | } | ||
69 | #else | 61 | #else |
70 | static inline void init_hypervisor_platform(void) { } | 62 | static inline void init_hypervisor_platform(void) { } |
71 | static inline bool hypervisor_x2apic_available(void) { return false; } | ||
72 | static inline void hypervisor_init_mem_mapping(void) { } | ||
73 | #endif /* CONFIG_HYPERVISOR_GUEST */ | 63 | #endif /* CONFIG_HYPERVISOR_GUEST */ |
74 | #endif /* _ASM_X86_HYPERVISOR_H */ | 64 | #endif /* _ASM_X86_HYPERVISOR_H */ |