debuggers.hg

changeset 22753:2ff199e2842b

x86: restore x2apic pre-enabled check logic

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>
author Keir Fraser <keir@xen.org>
date Tue Jan 11 11:40:50 2011 +0000 (2011-01-11)
parents ca10302ac285
children 7926538a6332
files xen/arch/x86/apic.c xen/arch/x86/genapic/probe.c xen/arch/x86/genapic/x2apic.c xen/include/asm-x86/apic.h
line diff
     1.1 --- a/xen/arch/x86/apic.c	Tue Jan 11 11:27:37 2011 +0000
     1.2 +++ b/xen/arch/x86/apic.c	Tue Jan 11 11:40:50 2011 +0000
     1.3 @@ -957,19 +957,10 @@ void x2apic_ap_setup(void)
     1.4  void __init x2apic_bsp_setup(void)
     1.5  {
     1.6      struct IO_APIC_route_entry **ioapic_entries = NULL;
     1.7 -    uint64_t msr_content;
     1.8  
     1.9      if ( !cpu_has_x2apic )
    1.10          return;
    1.11  
    1.12 -    /* Check whether x2apic mode was already enabled by the BIOS. */
    1.13 -    rdmsrl(MSR_IA32_APICBASE, msr_content);
    1.14 -    if ( msr_content & MSR_IA32_APICBASE_EXTD )
    1.15 -    {
    1.16 -        printk("x2APIC mode is already enabled by BIOS.\n");
    1.17 -        x2apic_enabled = 1;
    1.18 -    }
    1.19 -
    1.20      if ( !opt_x2apic )
    1.21      {
    1.22          if ( !x2apic_enabled )
     2.1 --- a/xen/arch/x86/genapic/probe.c	Tue Jan 11 11:27:37 2011 +0000
     2.2 +++ b/xen/arch/x86/genapic/probe.c	Tue Jan 11 11:40:50 2011 +0000
     2.3 @@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force)
     2.4  
     2.5  void __init generic_apic_probe(void) 
     2.6  { 
     2.7 -	int i;
     2.8 -	int changed = cmdline_apic = (genapic != NULL);
     2.9 +	int i, changed;
    2.10 +
    2.11 +	check_x2apic_preenabled();
    2.12 +	cmdline_apic = changed = (genapic != NULL);
    2.13  
    2.14  	for (i = 0; !changed && apic_probe[i]; i++) { 
    2.15  		if (apic_probe[i]->probe()) {
     3.1 --- a/xen/arch/x86/genapic/x2apic.c	Tue Jan 11 11:27:37 2011 +0000
     3.2 +++ b/xen/arch/x86/genapic/x2apic.c	Tue Jan 11 11:40:50 2011 +0000
     3.3 @@ -24,6 +24,8 @@
     3.4  #include <asm/genapic.h>
     3.5  #include <asm/apic.h>
     3.6  #include <asm/io_apic.h>
     3.7 +#include <asm/msr.h>
     3.8 +#include <asm/processor.h>
     3.9  #include <xen/smp.h>
    3.10  #include <asm/mach-default/mach_mpparse.h>
    3.11  
    3.12 @@ -123,3 +125,20 @@ const struct genapic *__init apic_x2apic
    3.13  {
    3.14      return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
    3.15  }
    3.16 +
    3.17 +void __init check_x2apic_preenabled(void)
    3.18 +{
    3.19 +    u32 lo, hi;
    3.20 +
    3.21 +    if ( !cpu_has_x2apic )
    3.22 +        return;
    3.23 +
    3.24 +    /* Check whether x2apic mode was already enabled by the BIOS. */
    3.25 +    rdmsr(MSR_IA32_APICBASE, lo, hi);
    3.26 +    if ( lo & MSR_IA32_APICBASE_EXTD )
    3.27 +    {
    3.28 +        printk("x2APIC mode is already enabled by BIOS.\n");
    3.29 +        x2apic_enabled = 1;
    3.30 +        genapic = apic_x2apic_probe();
    3.31 +    }
    3.32 +}
     4.1 --- a/xen/include/asm-x86/apic.h	Tue Jan 11 11:27:37 2011 +0000
     4.2 +++ b/xen/include/asm-x86/apic.h	Tue Jan 11 11:40:50 2011 +0000
     4.3 @@ -25,6 +25,7 @@ extern int apic_verbosity;
     4.4  extern bool_t x2apic_enabled;
     4.5  extern bool_t directed_eoi_enabled;
     4.6  
     4.7 +void check_x2apic_preenabled(void);
     4.8  void x2apic_bsp_setup(void);
     4.9  void x2apic_ap_setup(void);
    4.10  const struct genapic *apic_x2apic_probe(void);