From: "Jan Beulich" Subject: [PATCH] x86: restore x2apic pre-enabled check logic Date: Tue, 11 Jan 2011 10:26:06 +0000 Message-ID: <4D2C3E4E020000780002B93D@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part173B7B2E.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part173B7B2E.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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 =3D NULL; - uint64_t msr_content; =20 if ( !cpu_has_x2apic ) return; =20 - /* 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 =3D 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) =20 void __init generic_apic_probe(void)=20 {=20 - int i; - int changed =3D cmdline_apic =3D (genapic !=3D NULL); + int i, changed; + + check_x2apic_preenabled(); + cmdline_apic =3D changed =3D (genapic !=3D NULL); =20 for (i =3D 0; !changed && apic_probe[i]; i++) {=20 if (apic_probe[i]->probe()) { --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include =20 @@ -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 =3D 1; + genapic =3D 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; =20 +void check_x2apic_preenabled(void); void x2apic_bsp_setup(void); void x2apic_ap_setup(void); const struct genapic *apic_x2apic_probe(void); --=__Part173B7B2E.0__= Content-Type: text/plain; name="x86-x2apic-check-preenabled.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-x2apic-check-preenabled.patch" c/s 22475 removed the early checking without replacement, neglecting=0Athe = fact that x2apic_enabled must be set early for APIC register=0Aaccesses = done during second stage ACPI table parsing (rooted at=0Aacpi_boot_init()) = to work correctly. Without this, particularly=0Adetermination of the boot = CPU won't work, resulting in an attempt to=0Abring up that CPU again as a = secondary one (which fails).=0A=0ARestore the functionality, now calling = it from generic_apic_probe().=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/apic.c=0A+++ b/xen/arch/x86/apic.c=0A@@ = -957,19 +957,10 @@ void x2apic_ap_setup(void)=0A void __init x2apic_bsp_set= up(void)=0A {=0A struct IO_APIC_route_entry **ioapic_entries =3D = NULL;=0A- uint64_t msr_content;=0A =0A if ( !cpu_has_x2apic )=0A = return;=0A =0A- /* Check whether x2apic mode was already enabled = by the BIOS. */=0A- rdmsrl(MSR_IA32_APICBASE, msr_content);=0A- if ( = msr_content & MSR_IA32_APICBASE_EXTD )=0A- {=0A- printk("x2APIC = mode is already enabled by BIOS.\n");=0A- x2apic_enabled =3D 1;=0A- = }=0A-=0A if ( !opt_x2apic )=0A {=0A if ( !x2apic_enabled= )=0A--- a/xen/arch/x86/genapic/probe.c=0A+++ b/xen/arch/x86/genapic/probe.= c=0A@@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force)=0A =0A = void __init generic_apic_probe(void) =0A { =0A- int i;=0A- int = changed =3D cmdline_apic =3D (genapic !=3D NULL);=0A+ int i, changed;=0A+= =0A+ check_x2apic_preenabled();=0A+ cmdline_apic =3D changed =3D = (genapic !=3D NULL);=0A =0A for (i =3D 0; !changed && apic_probe[i]; = i++) { =0A if (apic_probe[i]->probe()) {=0A--- a/xen/arch/x86/= genapic/x2apic.c=0A+++ b/xen/arch/x86/genapic/x2apic.c=0A@@ -24,6 +24,8 = @@=0A #include =0A #include =0A #include = =0A+#include =0A+#include =0A = #include =0A #include =0A = =0A@@ -123,3 +125,20 @@ const struct genapic *__init apic_x2apic=0A {=0A = return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;=0A = }=0A+=0A+void __init check_x2apic_preenabled(void)=0A+{=0A+ u32 lo, = hi;=0A+=0A+ if ( !cpu_has_x2apic )=0A+ return;=0A+=0A+ /* = Check whether x2apic mode was already enabled by the BIOS. */=0A+ = rdmsr(MSR_IA32_APICBASE, lo, hi);=0A+ if ( lo & MSR_IA32_APICBASE_EXTD = )=0A+ {=0A+ printk("x2APIC mode is already enabled by BIOS.\n");= =0A+ x2apic_enabled =3D 1;=0A+ genapic =3D apic_x2apic_probe(= );=0A+ }=0A+}=0A--- a/xen/include/asm-x86/apic.h=0A+++ b/xen/include/asm= -x86/apic.h=0A@@ -25,6 +25,7 @@ extern int apic_verbosity;=0A extern = bool_t x2apic_enabled;=0A extern bool_t directed_eoi_enabled;=0A =0A+void = check_x2apic_preenabled(void);=0A void x2apic_bsp_setup(void);=0A void = x2apic_ap_setup(void);=0A const struct genapic *apic_x2apic_probe(void);=0A --=__Part173B7B2E.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part173B7B2E.0__=--