[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 18/31] xen/x86: Improve disabling of features which have dependencies
APIC and XSAVE have dependent features, which also need disabling if Xen chooses to disable a feature. Use setup_clear_cpu_cap() rather than clear_bit(), as it takes care of dependent features as well. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- xen/arch/x86/apic.c | 4 ++-- xen/arch/x86/cpu/common.c | 12 +++--------- xen/arch/x86/xstate.c | 7 ++++++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 2c9ae4e..1cfcf87 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1365,7 +1365,7 @@ void pmu_apic_interrupt(struct cpu_user_regs *regs) int __init APIC_init_uniprocessor (void) { if (enable_local_apic < 0) - clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); + setup_clear_cpu_cap(X86_FEATURE_APIC); if (!smp_found_config && !cpu_has_apic) { skip_ioapic_setup = 1; @@ -1378,7 +1378,7 @@ int __init APIC_init_uniprocessor (void) if (!cpu_has_apic && APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", boot_cpu_physical_apicid); - clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); + setup_clear_cpu_cap(X86_FEATURE_APIC); skip_ioapic_setup = 1; return -1; } diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index ba42ac0..7b89ebd 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -16,9 +16,6 @@ #include "cpu.h" -static bool_t __cpuinitdata use_xsave = 1; -boolean_param("xsave", use_xsave); - bool_t __devinitdata opt_arat = 1; boolean_param("arat", opt_arat); @@ -335,12 +332,6 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) if (this_cpu->c_init) this_cpu->c_init(c); - /* Initialize xsave/xrstor features */ - if ( !use_xsave ) - clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability); - - if ( cpu_has_xsave ) - xstate_init(c); /* * The vendor-specific functions might have changed features. Now @@ -363,6 +354,9 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) /* Now the feature flags better reflect actual CPU features! */ + if ( cpu_has_xsave ) + xstate_init(c); + #ifdef NOISY_CAPS printk(KERN_DEBUG "CPU: After all inits, caps:"); for (i = 0; i < NCAPINTS; i++) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index c6238d9..55d1360 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -278,11 +278,16 @@ unsigned int xstate_ctxt_size(u64 xcr0) /* Collect the information of processor's extended state */ void xstate_init(struct cpuinfo_x86 *c) { + static bool_t __initdata use_xsave = 1; + bool_t bsp = c == &boot_cpu_data; u32 eax, ebx, ecx, edx; u64 feature_mask; - if ( boot_cpu_data.cpuid_level < XSTATE_CPUID ) + boolean_param("xsave", use_xsave); + + if ( (bsp && !use_xsave) || + boot_cpu_data.cpuid_level < XSTATE_CPUID ) { BUG_ON(!bsp); setup_clear_cpu_cap(X86_FEATURE_XSAVE); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |