debuggers.hg

changeset 22835:9bd5f65050f8

x86:x2apic: Disable x2apic on x86-32 permanently

x2apic initialization on x86_32 uses vcpu pointer before it is
initialized. As x2apic is unlikely to be used on x86_32, this patch
disables x2apic permanently on x86_32. It also asserts the sanity of
vcpu pointer before dereference to prevent further misuse.

Signed-off-by: Fengzhe Zhang <fengzhe.zhang@intel.com>
author Keir Fraser <keir@xen.org>
date Fri Jan 21 15:58:27 2011 +0000 (2011-01-21)
parents 5852612cd4c4
children 43592043cefc
files xen/arch/x86/apic.c
line diff
     1.1 --- a/xen/arch/x86/apic.c	Fri Jan 21 15:57:18 2011 +0000
     1.2 +++ b/xen/arch/x86/apic.c	Fri Jan 21 15:58:27 2011 +0000
     1.3 @@ -961,6 +961,22 @@ void __init x2apic_bsp_setup(void)
     1.4      if ( !cpu_has_x2apic )
     1.5          return;
     1.6  
     1.7 +#ifdef __i386__
     1.8 +    clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
     1.9 +    if ( x2apic_enabled )
    1.10 +    {
    1.11 +        uint64_t msr_content;
    1.12 +        rdmsrl(MSR_IA32_APICBASE, msr_content);
    1.13 +        msr_content &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD);
    1.14 +        wrmsrl(MSR_IA32_APICBASE, msr_content);
    1.15 +        msr_content |= MSR_IA32_APICBASE_ENABLE;
    1.16 +        wrmsrl(MSR_IA32_APICBASE, msr_content);
    1.17 +        x2apic_enabled = 0;
    1.18 +    }
    1.19 +    printk("x2APIC disabled permanently on x86_32.\n");
    1.20 +    return;
    1.21 +#endif
    1.22 +
    1.23      if ( !opt_x2apic )
    1.24      {
    1.25          if ( !x2apic_enabled )