]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Fix APIC ID handling
authorWilliam Lee Irwin III <wli@holomorphy.com>
Thu, 21 Aug 2003 10:06:22 +0000 (03:06 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 21 Aug 2003 10:06:22 +0000 (03:06 -0700)
Fix APIC ID lookup.  In the bios_cpu_apicid[] case, it would walk off
the end of bios_cpu_apicid[] and attempt to send APIC INIT messages to
garbage without this patch, and in the NUMA-Q case, it would attempt to
send NMI wakeups to destinations in the broadcast cluster (which is
harmless, but very poor form) without this patch.

include/asm-i386/mach-bigsmp/mach_apic.h
include/asm-i386/mach-es7000/mach_apic.h
include/asm-i386/mach-numaq/mach_apic.h
include/asm-i386/mach-summit/mach_apic.h

index c21ed08175d5c13e6e4952615cde98bb09419683..dab6aa34c6fabda971b116f5c537a2f419432075 100644 (file)
@@ -86,7 +86,10 @@ extern u8 bios_cpu_apicid[];
 
 static inline int cpu_present_to_apicid(int mps_cpu)
 {
-       return (int) bios_cpu_apicid[mps_cpu];
+       if (mps_cpu < NR_CPUS)
+               return (int)bios_cpu_apicid[mps_cpu];
+       else
+               return BAD_APICID;
 }
 
 static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
index aa7fd107c1c94b7bed67c3aa0b501c75def45459..b744ac27f6fce1c1cf9cb469c41e3c2aec5ae158 100644 (file)
@@ -106,8 +106,10 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 {
        if (!mps_cpu)
                return boot_cpu_physical_apicid;
-       else
+       else if (mps_cpu < NR_CPUS)
                return (int) bios_cpu_apicid[mps_cpu];
+       else
+               return BAD_APICID;
 }
 
 static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
index 2f9f19237460c87078d8d1b135cfc0a225b205b4..98b4e5921aa8c9cb485664f2372eddcc56c47c9a 100644 (file)
@@ -65,9 +65,17 @@ static inline int cpu_to_logical_apicid(int cpu)
        return (int)cpu_2_logical_apicid[cpu];
 }
 
+/*
+ * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
+ * cpu to APIC ID relation to properly interact with the intelligent
+ * mode of the cluster controller.
+ */
 static inline int cpu_present_to_apicid(int mps_cpu)
 {
-       return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
+       if (mps_cpu < 60)
+               return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
+       else
+               return BAD_APICID;
 }
 
 static inline int generate_logical_apicid(int quad, int phys_apicid)
index f79d5df55e1aebc5022793d6e846964f53a96f4a..73a4a1077e8538692f5a4dd71ad640a0e3238893 100644 (file)
@@ -87,7 +87,10 @@ static inline int cpu_to_logical_apicid(int cpu)
 
 static inline int cpu_present_to_apicid(int mps_cpu)
 {
-       return (int) bios_cpu_apicid[mps_cpu];
+       if (mps_cpu < NR_CPUS)
+               return (int)bios_cpu_apicid[mps_cpu];
+       else
+               return BAD_APICID;
 }
 
 static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map)