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.
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)
{
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)
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)
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)