aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-01-21 15:58:27 +0000
committerKeir Fraser <keir@xen.org>2011-01-21 15:58:27 +0000
commit4b00b9efae1190d759e1f4e01e1af2e3767b575c (patch)
tree7288fd1c6970581861b164baf3e5746c865d56e2
parentf2154f99137f7021e76d2f5ad7e3155ff29fafde (diff)
downloadxen-4b00b9efae1190d759e1f4e01e1af2e3767b575c.tar.gz
xen-4b00b9efae1190d759e1f4e01e1af2e3767b575c.tar.bz2
xen-4b00b9efae1190d759e1f4e01e1af2e3767b575c.zip
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>
-rw-r--r--xen/arch/x86/apic.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 1590c3a171..ceefc6784d 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -961,6 +961,22 @@ void __init x2apic_bsp_setup(void)
if ( !cpu_has_x2apic )
return;
+#ifdef __i386__
+ clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
+ if ( x2apic_enabled )
+ {
+ uint64_t msr_content;
+ rdmsrl(MSR_IA32_APICBASE, msr_content);
+ msr_content &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD);
+ wrmsrl(MSR_IA32_APICBASE, msr_content);
+ msr_content |= MSR_IA32_APICBASE_ENABLE;
+ wrmsrl(MSR_IA32_APICBASE, msr_content);
+ x2apic_enabled = 0;
+ }
+ printk("x2APIC disabled permanently on x86_32.\n");
+ return;
+#endif
+
if ( !opt_x2apic )
{
if ( !x2apic_enabled )