diff options
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r-- | arch/x86/xen/enlighten.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 7e8d3bc80af6..e3c6a06cf725 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -238,6 +238,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
238 | static __init void xen_init_cpuid_mask(void) | 238 | static __init void xen_init_cpuid_mask(void) |
239 | { | 239 | { |
240 | unsigned int ax, bx, cx, dx; | 240 | unsigned int ax, bx, cx, dx; |
241 | unsigned int xsave_mask; | ||
241 | 242 | ||
242 | cpuid_leaf1_edx_mask = | 243 | cpuid_leaf1_edx_mask = |
243 | ~((1 << X86_FEATURE_MCE) | /* disable MCE */ | 244 | ~((1 << X86_FEATURE_MCE) | /* disable MCE */ |
@@ -249,24 +250,16 @@ static __init void xen_init_cpuid_mask(void) | |||
249 | cpuid_leaf1_edx_mask &= | 250 | cpuid_leaf1_edx_mask &= |
250 | ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ | 251 | ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ |
251 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ | 252 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ |
252 | |||
253 | ax = 1; | 253 | ax = 1; |
254 | cx = 0; | ||
255 | xen_cpuid(&ax, &bx, &cx, &dx); | 254 | xen_cpuid(&ax, &bx, &cx, &dx); |
256 | 255 | ||
257 | /* cpuid claims we support xsave; try enabling it to see what happens */ | 256 | xsave_mask = |
258 | if (cx & (1 << (X86_FEATURE_XSAVE % 32))) { | 257 | (1 << (X86_FEATURE_XSAVE % 32)) | |
259 | unsigned long cr4; | 258 | (1 << (X86_FEATURE_OSXSAVE % 32)); |
260 | |||
261 | set_in_cr4(X86_CR4_OSXSAVE); | ||
262 | |||
263 | cr4 = read_cr4(); | ||
264 | |||
265 | if ((cr4 & X86_CR4_OSXSAVE) == 0) | ||
266 | cpuid_leaf1_ecx_mask &= ~(1 << (X86_FEATURE_XSAVE % 32)); | ||
267 | 259 | ||
268 | clear_in_cr4(X86_CR4_OSXSAVE); | 260 | /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ |
269 | } | 261 | if ((cx & xsave_mask) != xsave_mask) |
262 | cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ | ||
270 | } | 263 | } |
271 | 264 | ||
272 | static void xen_set_debugreg(int reg, unsigned long val) | 265 | static void xen_set_debugreg(int reg, unsigned long val) |
@@ -1194,7 +1187,7 @@ asmlinkage void __init xen_start_kernel(void) | |||
1194 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | 1187 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; |
1195 | 1188 | ||
1196 | local_irq_disable(); | 1189 | local_irq_disable(); |
1197 | early_boot_irqs_off(); | 1190 | early_boot_irqs_disabled = true; |
1198 | 1191 | ||
1199 | memblock_init(); | 1192 | memblock_init(); |
1200 | 1193 | ||
@@ -1284,15 +1277,14 @@ static int init_hvm_pv_info(int *major, int *minor) | |||
1284 | 1277 | ||
1285 | xen_setup_features(); | 1278 | xen_setup_features(); |
1286 | 1279 | ||
1287 | pv_info = xen_info; | 1280 | pv_info.name = "Xen HVM"; |
1288 | pv_info.kernel_rpl = 0; | ||
1289 | 1281 | ||
1290 | xen_domain_type = XEN_HVM_DOMAIN; | 1282 | xen_domain_type = XEN_HVM_DOMAIN; |
1291 | 1283 | ||
1292 | return 0; | 1284 | return 0; |
1293 | } | 1285 | } |
1294 | 1286 | ||
1295 | void xen_hvm_init_shared_info(void) | 1287 | void __ref xen_hvm_init_shared_info(void) |
1296 | { | 1288 | { |
1297 | int cpu; | 1289 | int cpu; |
1298 | struct xen_add_to_physmap xatp; | 1290 | struct xen_add_to_physmap xatp; |
@@ -1331,6 +1323,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, | |||
1331 | switch (action) { | 1323 | switch (action) { |
1332 | case CPU_UP_PREPARE: | 1324 | case CPU_UP_PREPARE: |
1333 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; | 1325 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; |
1326 | if (xen_have_vector_callback) | ||
1327 | xen_init_lock_cpu(cpu); | ||
1334 | break; | 1328 | break; |
1335 | default: | 1329 | default: |
1336 | break; | 1330 | break; |
@@ -1355,6 +1349,7 @@ static void __init xen_hvm_guest_init(void) | |||
1355 | 1349 | ||
1356 | if (xen_feature(XENFEAT_hvm_callback_vector)) | 1350 | if (xen_feature(XENFEAT_hvm_callback_vector)) |
1357 | xen_have_vector_callback = 1; | 1351 | xen_have_vector_callback = 1; |
1352 | xen_hvm_smp_init(); | ||
1358 | register_cpu_notifier(&xen_hvm_cpu_notifier); | 1353 | register_cpu_notifier(&xen_hvm_cpu_notifier); |
1359 | xen_unplug_emulated_devices(); | 1354 | xen_unplug_emulated_devices(); |
1360 | have_vcpu_info_placement = 0; | 1355 | have_vcpu_info_placement = 0; |