diff options
| author | Ingo Molnar <mingo@kernel.org> | 2017-12-01 04:34:04 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-12-17 07:50:01 -0500 |
| commit | e5d77a73f364ba0e3e3d6c72c334324bb12e04fc (patch) | |
| tree | a3feefe8605f022dd974fbaddb10c7b992c58408 /arch/x86 | |
| parent | 2ec077c186a02c0aae8fc213a7b1d4c35f9626ed (diff) | |
| parent | 03b2a320b19f1424e9ac9c21696be9c60b6d0d93 (diff) | |
Merge commit 'upstream-x86-virt' into WIP.x86/mm
Merge a minimal set of virt cleanups, for a base for the MM isolation patches.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
| -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 |
13 files changed, 109 insertions, 83 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); | ||
