[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86:x2apic: Disable x2apic on x86-32 permanently



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1295625507 0
# Node ID 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa
# Parent  5852612cd4c461e5219db73cc52de0c643c414e8
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@xxxxxxxxx>
---
 xen/arch/x86/apic.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)

diff -r 5852612cd4c4 -r 9bd5f65050f8 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       Fri Jan 21 15:57:18 2011 +0000
+++ b/xen/arch/x86/apic.c       Fri Jan 21 15:58:27 2011 +0000
@@ -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 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.