xen/22789-i386-no-x2apic.patch
Charles Arnold 0c76f22ef1 - Update to Xen 4.0.2 rc2-pre, changeset 21443
- bnc#633573 - System fail to boot after running several warm
  reboot tests
  22749-vtd-workarounds.patch
- Upstream patches from Jan
  22744-ept-pod-locking.patch
  22777-vtd-ats-fixes.patch
  22781-pod-hap-logdirty.patch
  22782-x86-emul-smsw.patch
  22789-i386-no-x2apic.patch
  22790-svm-resume-migrate-pirqs.patch
  22816-x86-pirq-drop-priv-check.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=94
2011-02-04 21:19:54 +00:00

83 lines
2.4 KiB
Diff

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# 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@intel.com>
jb: Moved logic into check_x2apic_preenabled(), disabled dead code on
x86_32.
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -959,6 +959,10 @@ void x2apic_setup(void)
if ( !cpu_has_x2apic )
return;
+#ifdef __i386__
+ BUG();
+#else
+
if ( !opt_x2apic )
{
if ( !x2apic_enabled )
@@ -1020,6 +1024,7 @@ restore_out:
unmask_8259A();
out:
+#endif /* !__i386__ */
if ( ioapic_entries )
free_ioapic_entries(ioapic_entries);
}
Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c
+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
@@ -25,6 +25,8 @@
#include <xen/smp.h>
#include <asm/mach-default/mach_mpparse.h>
+#ifndef __i386__
+
static int x2apic_phys; /* By default we use logical cluster mode. */
boolean_param("x2apic_phys", x2apic_phys);
@@ -137,6 +139,8 @@ const struct genapic *apic_x2apic_probe(
return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
}
+#endif /* !__i386__ */
+
void __init check_x2apic_preenabled(void)
{
u32 lo, hi;
@@ -149,7 +153,19 @@ void __init check_x2apic_preenabled(void
if ( lo & MSR_IA32_APICBASE_EXTD )
{
printk("x2APIC mode is already enabled by BIOS.\n");
+#ifndef __i386__
x2apic_enabled = 1;
genapic = apic_x2apic_probe();
+#else
+ lo &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD);
+ wrmsr(MSR_IA32_APICBASE, lo, hi);
+ lo |= MSR_IA32_APICBASE_ENABLE;
+ wrmsr(MSR_IA32_APICBASE, lo, hi);
+ printk("x2APIC disabled permanently on x86_32.\n");
+#endif
}
+
+#ifdef __i386__
+ clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
+#endif
}