diff options
-rw-r--r-- | arch/x86/hyperv/hv_init.c | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 46 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 24 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/x2apic_uv_x.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/hypervisor.c | 64 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mshyperv.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/vmware.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/kvm.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 9 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/enlighten_hvm.c | 12 | ||||
-rw-r--r-- | arch/x86/xen/enlighten_pv.c | 6 | ||||
-rw-r--r-- | drivers/hv/vmbus_drv.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/vmmouse.c | 10 | ||||
-rw-r--r-- | drivers/misc/vmw_balloon.c | 2 | ||||
-rw-r--r-- | include/linux/hypervisor.h | 8 |
17 files changed, 121 insertions, 93 deletions
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index a5db63f728a2..a0b86cf486e0 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c | |||
@@ -113,7 +113,7 @@ void hyperv_init(void) | |||
113 | u64 guest_id; | 113 | u64 guest_id; |
114 | union hv_x64_msr_hypercall_contents hypercall_msr; | 114 | union hv_x64_msr_hypercall_contents hypercall_msr; |
115 | 115 | ||
116 | if (x86_hyper != &x86_hyper_ms_hyperv) | 116 | if (x86_hyper_type != X86_HYPER_MS_HYPERV) |
117 | return; | 117 | return; |
118 | 118 | ||
119 | /* Allocate percpu VP index */ | 119 | /* Allocate percpu VP index */ |
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 */ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 8a1ebf9540dd..ad15a0fda917 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -115,6 +115,18 @@ struct x86_init_pci { | |||
115 | }; | 115 | }; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * struct x86_hyper_init - x86 hypervisor init functions | ||
119 | * @init_platform: platform setup | ||
120 | * @x2apic_available: X2APIC detection | ||
121 | * @init_mem_mapping: setup early mappings during init_mem_mapping() | ||
122 | */ | ||
123 | struct x86_hyper_init { | ||
124 | void (*init_platform)(void); | ||
125 | bool (*x2apic_available)(void); | ||
126 | void (*init_mem_mapping)(void); | ||
127 | }; | ||
128 | |||
129 | /** | ||
118 | * struct x86_init_ops - functions for platform specific setup | 130 | * struct x86_init_ops - functions for platform specific setup |
119 | * | 131 | * |
120 | */ | 132 | */ |
@@ -127,6 +139,7 @@ struct x86_init_ops { | |||
127 | struct x86_init_timers timers; | 139 | struct x86_init_timers timers; |
128 | struct x86_init_iommu iommu; | 140 | struct x86_init_iommu iommu; |
129 | struct x86_init_pci pci; | 141 | struct x86_init_pci pci; |
142 | struct x86_hyper_init hyper; | ||
130 | }; | 143 | }; |
131 | 144 | ||
132 | /** | 145 | /** |
@@ -200,6 +213,15 @@ struct x86_legacy_features { | |||
200 | }; | 213 | }; |
201 | 214 | ||
202 | /** | 215 | /** |
216 | * struct x86_hyper_runtime - x86 hypervisor specific runtime callbacks | ||
217 | * | ||
218 | * @pin_vcpu: pin current vcpu to specified physical cpu (run rarely) | ||
219 | */ | ||
220 | struct x86_hyper_runtime { | ||
221 | void (*pin_vcpu)(int cpu); | ||
222 | }; | ||
223 | |||
224 | /** | ||
203 | * struct x86_platform_ops - platform specific runtime functions | 225 | * struct x86_platform_ops - platform specific runtime functions |
204 | * @calibrate_cpu: calibrate CPU | 226 | * @calibrate_cpu: calibrate CPU |
205 | * @calibrate_tsc: calibrate TSC, if different from CPU | 227 | * @calibrate_tsc: calibrate TSC, if different from CPU |
@@ -218,6 +240,7 @@ struct x86_legacy_features { | |||
218 | * possible in x86_early_init_platform_quirks() by | 240 | * possible in x86_early_init_platform_quirks() by |
219 | * only using the current x86_hardware_subarch | 241 | * only using the current x86_hardware_subarch |
220 | * semantics. | 242 | * semantics. |
243 | * @hyper: x86 hypervisor specific runtime callbacks | ||
221 | */ | 244 | */ |
222 | struct x86_platform_ops { | 245 | struct x86_platform_ops { |
223 | unsigned long (*calibrate_cpu)(void); | 246 | unsigned long (*calibrate_cpu)(void); |
@@ -233,6 +256,7 @@ struct x86_platform_ops { | |||
233 | void (*apic_post_init)(void); | 256 | void (*apic_post_init)(void); |
234 | struct x86_legacy_features legacy; | 257 | struct x86_legacy_features legacy; |
235 | void (*set_legacy_features)(void); | 258 | void (*set_legacy_features)(void); |
259 | struct x86_hyper_runtime hyper; | ||
236 | }; | 260 | }; |
237 | 261 | ||
238 | struct pci_dev; | 262 | struct pci_dev; |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index ff891772c9f8..89c7c8569e5e 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1645,7 +1645,7 @@ static __init void try_to_enable_x2apic(int remap_mode) | |||
1645 | * under KVM | 1645 | * under KVM |
1646 | */ | 1646 | */ |
1647 | if (max_physical_apicid > 255 || | 1647 | if (max_physical_apicid > 255 || |
1648 | !hypervisor_x2apic_available()) { | 1648 | !x86_init.hyper.x2apic_available()) { |
1649 | pr_info("x2apic: IRQ remapping doesn't support X2APIC mode\n"); | 1649 | pr_info("x2apic: IRQ remapping doesn't support X2APIC mode\n"); |
1650 | x2apic_disable(); | 1650 | x2apic_disable(); |
1651 | return; | 1651 | return; |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 0d57bb9079c9..c0b694810ff4 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -920,9 +920,8 @@ static __init void uv_rtc_init(void) | |||
920 | /* | 920 | /* |
921 | * percpu heartbeat timer | 921 | * percpu heartbeat timer |
922 | */ | 922 | */ |
923 | static void uv_heartbeat(unsigned long ignored) | 923 | static void uv_heartbeat(struct timer_list *timer) |
924 | { | 924 | { |
925 | struct timer_list *timer = &uv_scir_info->timer; | ||
926 | unsigned char bits = uv_scir_info->state; | 925 | unsigned char bits = uv_scir_info->state; |
927 | 926 | ||
928 | /* Flip heartbeat bit: */ | 927 | /* Flip heartbeat bit: */ |
@@ -947,7 +946,7 @@ static int uv_heartbeat_enable(unsigned int cpu) | |||
947 | struct timer_list *timer = &uv_cpu_scir_info(cpu)->timer; | 946 | struct timer_list *timer = &uv_cpu_scir_info(cpu)->timer; |
948 | 947 | ||
949 | uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY); | 948 | uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY); |
950 | setup_pinned_timer(timer, uv_heartbeat, cpu); | 949 | timer_setup(timer, uv_heartbeat, TIMER_PINNED); |
951 | timer->expires = jiffies + SCIR_CPU_HB_INTERVAL; | 950 | timer->expires = jiffies + SCIR_CPU_HB_INTERVAL; |
952 | add_timer_on(timer, cpu); | 951 | add_timer_on(timer, cpu); |
953 | uv_cpu_scir_info(cpu)->enabled = 1; | 952 | uv_cpu_scir_info(cpu)->enabled = 1; |
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c index 4fa90006ac68..bea8d3e24f50 100644 --- a/arch/x86/kernel/cpu/hypervisor.c +++ b/arch/x86/kernel/cpu/hypervisor.c | |||
@@ -26,6 +26,12 @@ | |||
26 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
27 | #include <asm/hypervisor.h> | 27 | #include <asm/hypervisor.h> |
28 | 28 | ||
29 | extern const struct hypervisor_x86 x86_hyper_vmware; | ||
30 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | ||
31 | extern const struct hypervisor_x86 x86_hyper_xen_pv; | ||
32 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; | ||
33 | extern const struct hypervisor_x86 x86_hyper_kvm; | ||
34 | |||
29 | static const __initconst struct hypervisor_x86 * const hypervisors[] = | 35 | static const __initconst struct hypervisor_x86 * const hypervisors[] = |
30 | { | 36 | { |
31 | #ifdef CONFIG_XEN_PV | 37 | #ifdef CONFIG_XEN_PV |
@@ -41,54 +47,52 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] = | |||
41 | #endif | 47 | #endif |
42 | }; | 48 | }; |
43 | 49 | ||
44 | const struct hypervisor_x86 *x86_hyper; | 50 | enum x86_hypervisor_type x86_hyper_type; |
45 | EXPORT_SYMBOL(x86_hyper); | 51 | EXPORT_SYMBOL(x86_hyper_type); |
46 | 52 | ||
47 | static inline void __init | 53 | static inline const struct hypervisor_x86 * __init |
48 | detect_hypervisor_vendor(void) | 54 | detect_hypervisor_vendor(void) |
49 | { | 55 | { |
50 | const struct hypervisor_x86 *h, * const *p; | 56 | const struct hypervisor_x86 *h = NULL, * const *p; |
51 | uint32_t pri, max_pri = 0; | 57 | uint32_t pri, max_pri = 0; |
52 | 58 | ||
53 | for (p = hypervisors; p < hypervisors + ARRAY_SIZE(hypervisors); p++) { | 59 | for (p = hypervisors; p < hypervisors + ARRAY_SIZE(hypervisors); p++) { |
54 | h = *p; | 60 | pri = (*p)->detect(); |
55 | pri = h->detect(); | 61 | if (pri > max_pri) { |
56 | if (pri != 0 && pri > max_pri) { | ||
57 | max_pri = pri; | 62 | max_pri = pri; |
58 | x86_hyper = h; | 63 | h = *p; |
59 | } | 64 | } |
60 | } | 65 | } |
61 | 66 | ||
62 | if (max_pri) | 67 | if (h) |
63 | pr_info("Hypervisor detected: %s\n", x86_hyper->name); | 68 | pr_info("Hypervisor detected: %s\n", h->name); |
69 | |||
70 | return h; | ||
64 | } | 71 | } |
65 | 72 | ||
66 | void __init init_hypervisor_platform(void) | 73 | static void __init copy_array(const void *src, void *target, unsigned int size) |
67 | { | 74 | { |
75 | unsigned int i, n = size / sizeof(void *); | ||
76 | const void * const *from = (const void * const *)src; | ||
77 | const void **to = (const void **)target; | ||
68 | 78 | ||
69 | detect_hypervisor_vendor(); | 79 | for (i = 0; i < n; i++) |
70 | 80 | if (from[i]) | |
71 | if (!x86_hyper) | 81 | to[i] = from[i]; |
72 | return; | ||
73 | |||
74 | if (x86_hyper->init_platform) | ||
75 | x86_hyper->init_platform(); | ||
76 | } | 82 | } |
77 | 83 | ||
78 | bool __init hypervisor_x2apic_available(void) | 84 | void __init init_hypervisor_platform(void) |
79 | { | 85 | { |
80 | return x86_hyper && | 86 | const struct hypervisor_x86 *h; |
81 | x86_hyper->x2apic_available && | ||
82 | x86_hyper->x2apic_available(); | ||
83 | } | ||
84 | 87 | ||
85 | void hypervisor_pin_vcpu(int cpu) | 88 | h = detect_hypervisor_vendor(); |
86 | { | 89 | |
87 | if (!x86_hyper) | 90 | if (!h) |
88 | return; | 91 | return; |
89 | 92 | ||
90 | if (x86_hyper->pin_vcpu) | 93 | copy_array(&h->init, &x86_init.hyper, sizeof(h->init)); |
91 | x86_hyper->pin_vcpu(cpu); | 94 | copy_array(&h->runtime, &x86_platform.hyper, sizeof(h->runtime)); |
92 | else | 95 | |
93 | WARN_ONCE(1, "vcpu pinning requested but not supported!\n"); | 96 | x86_hyper_type = h->type; |
97 | x86_init.hyper.init_platform(); | ||
94 | } | 98 | } |
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 236324e83a3a..85eb5fc180c8 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c | |||
@@ -254,9 +254,9 @@ static void __init ms_hyperv_init_platform(void) | |||
254 | #endif | 254 | #endif |
255 | } | 255 | } |
256 | 256 | ||
257 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { | 257 | const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
258 | .name = "Microsoft Hyper-V", | 258 | .name = "Microsoft Hyper-V", |
259 | .detect = ms_hyperv_platform, | 259 | .detect = ms_hyperv_platform, |
260 | .init_platform = ms_hyperv_init_platform, | 260 | .type = X86_HYPER_MS_HYPERV, |
261 | .init.init_platform = ms_hyperv_init_platform, | ||
261 | }; | 262 | }; |
262 | EXPORT_SYMBOL(x86_hyper_ms_hyperv); | ||
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index 40ed26852ebd..8e005329648b 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c | |||
@@ -205,10 +205,10 @@ static bool __init vmware_legacy_x2apic_available(void) | |||
205 | (eax & (1 << VMWARE_PORT_CMD_LEGACY_X2APIC)) != 0; | 205 | (eax & (1 << VMWARE_PORT_CMD_LEGACY_X2APIC)) != 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | const __refconst struct hypervisor_x86 x86_hyper_vmware = { | 208 | const __initconst struct hypervisor_x86 x86_hyper_vmware = { |
209 | .name = "VMware", | 209 | .name = "VMware", |
210 | .detect = vmware_platform, | 210 | .detect = vmware_platform, |
211 | .init_platform = vmware_platform_setup, | 211 | .type = X86_HYPER_VMWARE, |
212 | .x2apic_available = vmware_legacy_x2apic_available, | 212 | .init.init_platform = vmware_platform_setup, |
213 | .init.x2apic_available = vmware_legacy_x2apic_available, | ||
213 | }; | 214 | }; |
214 | EXPORT_SYMBOL(x86_hyper_vmware); | ||
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 8bb9594d0761..a94de09edbed 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -544,12 +544,12 @@ static uint32_t __init kvm_detect(void) | |||
544 | return kvm_cpuid_base(); | 544 | return kvm_cpuid_base(); |
545 | } | 545 | } |
546 | 546 | ||
547 | const struct hypervisor_x86 x86_hyper_kvm __refconst = { | 547 | const __initconst struct hypervisor_x86 x86_hyper_kvm = { |
548 | .name = "KVM", | 548 | .name = "KVM", |
549 | .detect = kvm_detect, | 549 | .detect = kvm_detect, |
550 | .x2apic_available = kvm_para_available, | 550 | .type = X86_HYPER_KVM, |
551 | .init.x2apic_available = kvm_para_available, | ||
551 | }; | 552 | }; |
552 | EXPORT_SYMBOL_GPL(x86_hyper_kvm); | ||
553 | 553 | ||
554 | static __init int activate_jump_labels(void) | 554 | static __init int activate_jump_labels(void) |
555 | { | 555 | { |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index a088b2c47f73..5b2d10c1973a 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -28,6 +28,8 @@ void x86_init_noop(void) { } | |||
28 | void __init x86_init_uint_noop(unsigned int unused) { } | 28 | void __init x86_init_uint_noop(unsigned int unused) { } |
29 | int __init iommu_init_noop(void) { return 0; } | 29 | int __init iommu_init_noop(void) { return 0; } |
30 | void iommu_shutdown_noop(void) { } | 30 | void iommu_shutdown_noop(void) { } |
31 | bool __init bool_x86_init_noop(void) { return false; } | ||
32 | void x86_op_int_noop(int cpu) { } | ||
31 | 33 | ||
32 | /* | 34 | /* |
33 | * The platform setup functions are preset with the default functions | 35 | * The platform setup functions are preset with the default functions |
@@ -81,6 +83,12 @@ struct x86_init_ops x86_init __initdata = { | |||
81 | .init_irq = x86_default_pci_init_irq, | 83 | .init_irq = x86_default_pci_init_irq, |
82 | .fixup_irqs = x86_default_pci_fixup_irqs, | 84 | .fixup_irqs = x86_default_pci_fixup_irqs, |
83 | }, | 85 | }, |
86 | |||
87 | .hyper = { | ||
88 | .init_platform = x86_init_noop, | ||
89 | .x2apic_available = bool_x86_init_noop, | ||
90 | .init_mem_mapping = x86_init_noop, | ||
91 | }, | ||
84 | }; | 92 | }; |
85 | 93 | ||
86 | struct x86_cpuinit_ops x86_cpuinit = { | 94 | struct x86_cpuinit_ops x86_cpuinit = { |
@@ -101,6 +109,7 @@ struct x86_platform_ops x86_platform __ro_after_init = { | |||
101 | .get_nmi_reason = default_get_nmi_reason, | 109 | .get_nmi_reason = default_get_nmi_reason, |
102 | .save_sched_clock_state = tsc_save_sched_clock_state, | 110 | .save_sched_clock_state = tsc_save_sched_clock_state, |
103 | .restore_sched_clock_state = tsc_restore_sched_clock_state, | 111 | .restore_sched_clock_state = tsc_restore_sched_clock_state, |
112 | .hyper.pin_vcpu = x86_op_int_noop, | ||
104 | }; | 113 | }; |
105 | 114 | ||
106 | EXPORT_SYMBOL_GPL(x86_platform); | 115 | EXPORT_SYMBOL_GPL(x86_platform); |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index af5c1ed21d43..a22c2b95e513 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -671,7 +671,7 @@ void __init init_mem_mapping(void) | |||
671 | load_cr3(swapper_pg_dir); | 671 | load_cr3(swapper_pg_dir); |
672 | __flush_tlb_all(); | 672 | __flush_tlb_all(); |
673 | 673 | ||
674 | hypervisor_init_mem_mapping(); | 674 | x86_init.hyper.init_mem_mapping(); |
675 | 675 | ||
676 | early_memtest(0, max_pfn_mapped << PAGE_SHIFT); | 676 | early_memtest(0, max_pfn_mapped << PAGE_SHIFT); |
677 | } | 677 | } |
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index de503c225ae1..754d5391d9fa 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c | |||
@@ -226,12 +226,12 @@ static uint32_t __init xen_platform_hvm(void) | |||
226 | return xen_cpuid_base(); | 226 | return xen_cpuid_base(); |
227 | } | 227 | } |
228 | 228 | ||
229 | const struct hypervisor_x86 x86_hyper_xen_hvm = { | 229 | const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = { |
230 | .name = "Xen HVM", | 230 | .name = "Xen HVM", |
231 | .detect = xen_platform_hvm, | 231 | .detect = xen_platform_hvm, |
232 | .init_platform = xen_hvm_guest_init, | 232 | .type = X86_HYPER_XEN_HVM, |
233 | .pin_vcpu = xen_pin_vcpu, | 233 | .init.init_platform = xen_hvm_guest_init, |
234 | .x2apic_available = xen_x2apic_para_available, | 234 | .init.x2apic_available = xen_x2apic_para_available, |
235 | .init_mem_mapping = xen_hvm_init_mem_mapping, | 235 | .init.init_mem_mapping = xen_hvm_init_mem_mapping, |
236 | .runtime.pin_vcpu = xen_pin_vcpu, | ||
236 | }; | 237 | }; |
237 | EXPORT_SYMBOL(x86_hyper_xen_hvm); | ||
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index e55d276afc70..fbd054d6ac97 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c | |||
@@ -1459,9 +1459,9 @@ static uint32_t __init xen_platform_pv(void) | |||
1459 | return 0; | 1459 | return 0; |
1460 | } | 1460 | } |
1461 | 1461 | ||
1462 | const struct hypervisor_x86 x86_hyper_xen_pv = { | 1462 | const __initconst struct hypervisor_x86 x86_hyper_xen_pv = { |
1463 | .name = "Xen PV", | 1463 | .name = "Xen PV", |
1464 | .detect = xen_platform_pv, | 1464 | .detect = xen_platform_pv, |
1465 | .pin_vcpu = xen_pin_vcpu, | 1465 | .type = X86_HYPER_XEN_PV, |
1466 | .runtime.pin_vcpu = xen_pin_vcpu, | ||
1466 | }; | 1467 | }; |
1467 | EXPORT_SYMBOL(x86_hyper_xen_pv); | ||
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 937801ac2fe0..2cd134dd94d2 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
@@ -1534,7 +1534,7 @@ static int __init hv_acpi_init(void) | |||
1534 | { | 1534 | { |
1535 | int ret, t; | 1535 | int ret, t; |
1536 | 1536 | ||
1537 | if (x86_hyper != &x86_hyper_ms_hyperv) | 1537 | if (x86_hyper_type != X86_HYPER_MS_HYPERV) |
1538 | return -ENODEV; | 1538 | return -ENODEV; |
1539 | 1539 | ||
1540 | init_completion(&probe_event); | 1540 | init_completion(&probe_event); |
diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index 0f586780ceb4..1ae5c1ef3f5b 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c | |||
@@ -316,11 +316,9 @@ static int vmmouse_enable(struct psmouse *psmouse) | |||
316 | /* | 316 | /* |
317 | * Array of supported hypervisors. | 317 | * Array of supported hypervisors. |
318 | */ | 318 | */ |
319 | static const struct hypervisor_x86 *vmmouse_supported_hypervisors[] = { | 319 | static enum x86_hypervisor_type vmmouse_supported_hypervisors[] = { |
320 | &x86_hyper_vmware, | 320 | X86_HYPER_VMWARE, |
321 | #ifdef CONFIG_KVM_GUEST | 321 | X86_HYPER_KVM, |
322 | &x86_hyper_kvm, | ||
323 | #endif | ||
324 | }; | 322 | }; |
325 | 323 | ||
326 | /** | 324 | /** |
@@ -331,7 +329,7 @@ static bool vmmouse_check_hypervisor(void) | |||
331 | int i; | 329 | int i; |
332 | 330 | ||
333 | for (i = 0; i < ARRAY_SIZE(vmmouse_supported_hypervisors); i++) | 331 | for (i = 0; i < ARRAY_SIZE(vmmouse_supported_hypervisors); i++) |
334 | if (vmmouse_supported_hypervisors[i] == x86_hyper) | 332 | if (vmmouse_supported_hypervisors[i] == x86_hyper_type) |
335 | return true; | 333 | return true; |
336 | 334 | ||
337 | return false; | 335 | return false; |
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 1e688bfec567..9047c0a529b2 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -1271,7 +1271,7 @@ static int __init vmballoon_init(void) | |||
1271 | * Check if we are running on VMware's hypervisor and bail out | 1271 | * Check if we are running on VMware's hypervisor and bail out |
1272 | * if we are not. | 1272 | * if we are not. |
1273 | */ | 1273 | */ |
1274 | if (x86_hyper != &x86_hyper_vmware) | 1274 | if (x86_hyper_type != X86_HYPER_VMWARE) |
1275 | return -ENODEV; | 1275 | return -ENODEV; |
1276 | 1276 | ||
1277 | for (is_2m_pages = 0; is_2m_pages < VMW_BALLOON_NUM_PAGE_SIZES; | 1277 | for (is_2m_pages = 0; is_2m_pages < VMW_BALLOON_NUM_PAGE_SIZES; |
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h index b4054fd5b6f6..b19563f9a8eb 100644 --- a/include/linux/hypervisor.h +++ b/include/linux/hypervisor.h | |||
@@ -7,8 +7,12 @@ | |||
7 | * Juergen Gross <jgross@suse.com> | 7 | * Juergen Gross <jgross@suse.com> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef CONFIG_HYPERVISOR_GUEST | 10 | #ifdef CONFIG_X86 |
11 | #include <asm/hypervisor.h> | 11 | #include <asm/x86_init.h> |
12 | static inline void hypervisor_pin_vcpu(int cpu) | ||
13 | { | ||
14 | x86_platform.hyper.pin_vcpu(cpu); | ||
15 | } | ||
12 | #else | 16 | #else |
13 | static inline void hypervisor_pin_vcpu(int cpu) | 17 | static inline void hypervisor_pin_vcpu(int cpu) |
14 | { | 18 | { |