ia64/xen-unstable

changeset 7992:be41d7631c2f

Intel systems with more than 8 CPUs require that the APIC is configured
in clustered mode with the apic=bigsmp kernel parameter. This patch does
the APIC mode selection automatically without needing to manually specify
the kernel paremeter.

(KAF note: I see the patch is also present in Linux 2.6.14.2)

Signed-off-by: Nitin Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 23 12:11:05 2005 +0100 (2005-11-23)
parents b6ebabe4658a
children 6c252ba7a639 f61b8d362fc4
files xen/arch/x86/acpi/boot.c xen/arch/x86/genapic/bigsmp.c xen/arch/x86/genapic/probe.c xen/arch/x86/mpparse.c xen/include/asm-x86/apicdef.h xen/include/asm-x86/mach-generic/mach_apic.h xen/include/asm-x86/mpspec.h
line diff
     1.1 --- a/xen/arch/x86/acpi/boot.c	Wed Nov 23 11:15:18 2005 +0100
     1.2 +++ b/xen/arch/x86/acpi/boot.c	Wed Nov 23 12:11:05 2005 +0100
     1.3 @@ -602,7 +602,8 @@ acpi_process_madt(void)
     1.4  		error = acpi_parse_madt_lapic_entries();
     1.5  		if (!error) {
     1.6  			acpi_lapic = 1;
     1.7 -
     1.8 +			generic_bigsmp_probe();
     1.9 + 
    1.10  			/*
    1.11  			 * Parse MADT IO-APIC entries
    1.12  			 */
     2.1 --- a/xen/arch/x86/genapic/bigsmp.c	Wed Nov 23 11:15:18 2005 +0100
     2.2 +++ b/xen/arch/x86/genapic/bigsmp.c	Wed Nov 23 12:11:05 2005 +0100
     2.3 @@ -45,7 +45,10 @@ static struct dmi_system_id __initdata b
     2.4  
     2.5  static __init int probe_bigsmp(void)
     2.6  { 
     2.7 -	dmi_check_system(bigsmp_dmi_table);
     2.8 +	if (def_to_bigsmp)
     2.9 +		dmi_bigsmp = 1;
    2.10 +	else
    2.11 +		dmi_check_system(bigsmp_dmi_table);
    2.12  	return dmi_bigsmp; 
    2.13  } 
    2.14  
     3.1 --- a/xen/arch/x86/genapic/probe.c	Wed Nov 23 11:15:18 2005 +0100
     3.2 +++ b/xen/arch/x86/genapic/probe.c	Wed Nov 23 12:11:05 2005 +0100
     3.3 @@ -29,6 +29,25 @@ struct genapic *apic_probe[] __initdata 
     3.4  	NULL,
     3.5  };
     3.6  
     3.7 +static int cmdline_apic;
     3.8 +
     3.9 +void __init generic_bigsmp_probe(void)
    3.10 +{
    3.11 +	/*
    3.12 +	 * This routine is used to switch to bigsmp mode when
    3.13 +	 * - There is no apic= option specified by the user
    3.14 +	 * - generic_apic_probe() has choosen apic_default as the sub_arch
    3.15 +	 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
    3.16 +	 */
    3.17 +
    3.18 +	if (!cmdline_apic && genapic == &apic_default)
    3.19 +		if (apic_bigsmp.probe()) {
    3.20 +			genapic = &apic_bigsmp;
    3.21 +			printk(KERN_INFO "Overriding APIC driver with %s\n",
    3.22 +			       genapic->name);
    3.23 +		}
    3.24 +}
    3.25 +
    3.26  static void __init genapic_apic_force(char *str)
    3.27  {
    3.28  	int i;
    3.29 @@ -41,7 +60,7 @@ custom_param("apic", genapic_apic_force)
    3.30  void __init generic_apic_probe(void) 
    3.31  { 
    3.32  	int i;
    3.33 -	int changed = (genapic != NULL);
    3.34 +	int changed = cmdline_apic = (genapic != NULL);
    3.35  
    3.36  	for (i = 0; !changed && apic_probe[i]; i++) { 
    3.37  		if (apic_probe[i]->probe()) {
     4.1 --- a/xen/arch/x86/mpparse.c	Wed Nov 23 11:15:18 2005 +0100
     4.2 +++ b/xen/arch/x86/mpparse.c	Wed Nov 23 12:11:05 2005 +0100
     4.3 @@ -63,6 +63,8 @@ int nr_ioapics;
     4.4  int pic_mode;
     4.5  unsigned long mp_lapic_addr;
     4.6  
     4.7 +unsigned int def_to_bigsmp;
     4.8 +
     4.9  /* Processor that is doing the boot up */
    4.10  unsigned int boot_cpu_physical_apicid = -1U;
    4.11  unsigned int boot_cpu_logical_apicid = -1U;
    4.12 @@ -213,6 +215,13 @@ void __init MP_processor_info (struct mp
    4.13  		ver = 0x10;
    4.14  	}
    4.15  	apic_version[m->mpc_apicid] = ver;
    4.16 +	if ((num_processors > 8) &&
    4.17 +	    APIC_XAPIC(ver) &&
    4.18 +	    (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
    4.19 +		def_to_bigsmp = 1;
    4.20 +	else
    4.21 +		def_to_bigsmp = 0;
    4.22 +
    4.23  	bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
    4.24  }
    4.25  
     5.1 --- a/xen/include/asm-x86/apicdef.h	Wed Nov 23 11:15:18 2005 +0100
     5.2 +++ b/xen/include/asm-x86/apicdef.h	Wed Nov 23 12:11:05 2005 +0100
     5.3 @@ -16,6 +16,7 @@
     5.4  #define			GET_APIC_VERSION(x)	((x)&0xFF)
     5.5  #define			GET_APIC_MAXLVT(x)	(((x)>>16)&0xFF)
     5.6  #define			APIC_INTEGRATED(x)	((x)&0xF0)
     5.7 +#define			APIC_XAPIC(x)		((x) >= 0x14)
     5.8  #define		APIC_TASKPRI	0x80
     5.9  #define			APIC_TPRI_MASK		0xFF
    5.10  #define		APIC_ARBPRI	0x90
     6.1 --- a/xen/include/asm-x86/mach-generic/mach_apic.h	Wed Nov 23 11:15:18 2005 +0100
     6.2 +++ b/xen/include/asm-x86/mach-generic/mach_apic.h	Wed Nov 23 12:11:05 2005 +0100
     6.3 @@ -28,4 +28,6 @@
     6.4  #define enable_apic_mode (genapic->enable_apic_mode)
     6.5  #define phys_pkg_id (genapic->phys_pkg_id)
     6.6  
     6.7 +extern void generic_bigsmp_probe(void);
     6.8 +
     6.9  #endif /* __ASM_MACH_APIC_H */
     7.1 --- a/xen/include/asm-x86/mpspec.h	Wed Nov 23 11:15:18 2005 +0100
     7.2 +++ b/xen/include/asm-x86/mpspec.h	Wed Nov 23 12:11:05 2005 +0100
     7.3 @@ -11,6 +11,7 @@ extern int mp_bus_id_to_local [MAX_MP_BU
     7.4  extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
     7.5  extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
     7.6  
     7.7 +extern unsigned int def_to_bigsmp;
     7.8  extern unsigned int boot_cpu_physical_apicid;
     7.9  extern int smp_found_config;
    7.10  extern void find_smp_config (void);