x86, apic: use logical flat for systems with <= 8 logical cpus

We can use logical flat mode if there are <= 8 logical cpu's
(irrespective of physical apic id values). This will enable simplified
and efficient IPI and device interrupt routing on such platforms.

This has been tested to work on both Intel and AMD platforms.
Exceptions like IBM summit platform which can't use logical flat mode
are addressed by using OEM platform checks.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Chris McDermott <lcm@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Suresh Siddha and committed by Linus Torvalds bb668da6 dfea91d5

+4 -19
+1 -14
arch/x86/kernel/apic/apic.c
··· 61 62 /* 63 * The highest APIC ID seen during enumeration. 64 - * 65 - * This determines the messaging protocol we can use: if all APIC IDs 66 - * are in the 0 ... 7 range, then we can use logical addressing which 67 - * has some performance advantages (better broadcasting). 68 - * 69 - * If there's an APIC ID above 8, we use physical addressing. 70 */ 71 unsigned int max_physical_apicid; 72 ··· 1892 max_physical_apicid = apicid; 1893 1894 #ifdef CONFIG_X86_32 1895 - /* 1896 - * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y 1897 - * but we need to work other dependencies like SMP_SUSPEND etc 1898 - * before this can be done without some confusion. 1899 - * if (CPU_HOTPLUG_ENABLED || num_processors > 8) 1900 - * - Ashok Raj <ashok.raj@intel.com> 1901 - */ 1902 - if (max_physical_apicid >= 8) { 1903 switch (boot_cpu_data.x86_vendor) { 1904 case X86_VENDOR_INTEL: 1905 if (!APIC_XAPIC(version)) {
··· 61 62 /* 63 * The highest APIC ID seen during enumeration. 64 */ 65 unsigned int max_physical_apicid; 66 ··· 1898 max_physical_apicid = apicid; 1899 1900 #ifdef CONFIG_X86_32 1901 + if (num_processors > 8) { 1902 switch (boot_cpu_data.x86_vendor) { 1903 case X86_VENDOR_INTEL: 1904 if (!APIC_XAPIC(version)) {
+3 -5
arch/x86/kernel/apic/probe_64.c
··· 64 apic = &apic_x2apic_phys; 65 else 66 apic = &apic_x2apic_cluster; 67 - printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); 68 } 69 #endif 70 71 - if (apic == &apic_flat) { 72 - if (max_physical_apicid >= 8) 73 apic = &apic_physflat; 74 - printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); 75 - } 76 77 if (is_vsmp_box()) { 78 /* need to update phys_pkg_id */
··· 64 apic = &apic_x2apic_phys; 65 else 66 apic = &apic_x2apic_cluster; 67 } 68 #endif 69 70 + if (apic == &apic_flat && num_processors > 8) 71 apic = &apic_physflat; 72 + 73 + printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); 74 75 if (is_vsmp_box()) { 76 /* need to update phys_pkg_id */