All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: restore x2apic pre-enabled check logic
@ 2011-01-11 10:26 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2011-01-11 10:26 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2781 bytes --]

c/s 22475 removed the early checking without replacement, neglecting
the fact that x2apic_enabled must be set early for APIC register
accesses done during second stage ACPI table parsing (rooted at
acpi_boot_init()) to work correctly. Without this, particularly
determination of the boot CPU won't work, resulting in an attempt to
bring up that CPU again as a secondary one (which fails).

Restore the functionality, now calling it from generic_apic_probe().

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -957,19 +957,10 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
-    uint64_t msr_content;
 
     if ( !cpu_has_x2apic )
         return;
 
-    /* Check whether x2apic mode was already enabled by the BIOS. */
-    rdmsrl(MSR_IA32_APICBASE, msr_content);
-    if ( msr_content & MSR_IA32_APICBASE_EXTD )
-    {
-        printk("x2APIC mode is already enabled by BIOS.\n");
-        x2apic_enabled = 1;
-    }
-
     if ( !opt_x2apic )
     {
         if ( !x2apic_enabled )
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force)
 
 void __init generic_apic_probe(void) 
 { 
-	int i;
-	int changed = cmdline_apic = (genapic != NULL);
+	int i, changed;
+
+	check_x2apic_preenabled();
+	cmdline_apic = changed = (genapic != NULL);
 
 	for (i = 0; !changed && apic_probe[i]; i++) { 
 		if (apic_probe[i]->probe()) {
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -24,6 +24,8 @@
 #include <asm/genapic.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <xen/smp.h>
 #include <asm/mach-default/mach_mpparse.h>
 
@@ -123,3 +125,20 @@ const struct genapic *__init apic_x2apic
 {
     return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
 }
+
+void __init check_x2apic_preenabled(void)
+{
+    u32 lo, hi;
+
+    if ( !cpu_has_x2apic )
+        return;
+
+    /* Check whether x2apic mode was already enabled by the BIOS. */
+    rdmsr(MSR_IA32_APICBASE, lo, hi);
+    if ( lo & MSR_IA32_APICBASE_EXTD )
+    {
+        printk("x2APIC mode is already enabled by BIOS.\n");
+        x2apic_enabled = 1;
+        genapic = apic_x2apic_probe();
+    }
+}
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -25,6 +25,7 @@ extern int apic_verbosity;
 extern bool_t x2apic_enabled;
 extern bool_t directed_eoi_enabled;
 
+void check_x2apic_preenabled(void);
 void x2apic_bsp_setup(void);
 void x2apic_ap_setup(void);
 const struct genapic *apic_x2apic_probe(void);




[-- Attachment #2: x86-x2apic-check-preenabled.patch --]
[-- Type: text/plain, Size: 2775 bytes --]

c/s 22475 removed the early checking without replacement, neglecting
the fact that x2apic_enabled must be set early for APIC register
accesses done during second stage ACPI table parsing (rooted at
acpi_boot_init()) to work correctly. Without this, particularly
determination of the boot CPU won't work, resulting in an attempt to
bring up that CPU again as a secondary one (which fails).

Restore the functionality, now calling it from generic_apic_probe().

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -957,19 +957,10 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
-    uint64_t msr_content;
 
     if ( !cpu_has_x2apic )
         return;
 
-    /* Check whether x2apic mode was already enabled by the BIOS. */
-    rdmsrl(MSR_IA32_APICBASE, msr_content);
-    if ( msr_content & MSR_IA32_APICBASE_EXTD )
-    {
-        printk("x2APIC mode is already enabled by BIOS.\n");
-        x2apic_enabled = 1;
-    }
-
     if ( !opt_x2apic )
     {
         if ( !x2apic_enabled )
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force)
 
 void __init generic_apic_probe(void) 
 { 
-	int i;
-	int changed = cmdline_apic = (genapic != NULL);
+	int i, changed;
+
+	check_x2apic_preenabled();
+	cmdline_apic = changed = (genapic != NULL);
 
 	for (i = 0; !changed && apic_probe[i]; i++) { 
 		if (apic_probe[i]->probe()) {
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -24,6 +24,8 @@
 #include <asm/genapic.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <xen/smp.h>
 #include <asm/mach-default/mach_mpparse.h>
 
@@ -123,3 +125,20 @@ const struct genapic *__init apic_x2apic
 {
     return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
 }
+
+void __init check_x2apic_preenabled(void)
+{
+    u32 lo, hi;
+
+    if ( !cpu_has_x2apic )
+        return;
+
+    /* Check whether x2apic mode was already enabled by the BIOS. */
+    rdmsr(MSR_IA32_APICBASE, lo, hi);
+    if ( lo & MSR_IA32_APICBASE_EXTD )
+    {
+        printk("x2APIC mode is already enabled by BIOS.\n");
+        x2apic_enabled = 1;
+        genapic = apic_x2apic_probe();
+    }
+}
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -25,6 +25,7 @@ extern int apic_verbosity;
 extern bool_t x2apic_enabled;
 extern bool_t directed_eoi_enabled;
 
+void check_x2apic_preenabled(void);
 void x2apic_bsp_setup(void);
 void x2apic_ap_setup(void);
 const struct genapic *apic_x2apic_probe(void);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-11 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 10:26 [PATCH] x86: restore x2apic pre-enabled check logic Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.