History

x86/acpi: Handle bogus MADT APIC tables gracefully

The recent fix to ignore invalid x2APIC entries inadvertently broke systems with creative MADT APIC tables. The affected systems have APIC MADT tables where all entries have invalid APIC IDs (0xFF), which means they register exactly zero CPUs. But the condition to ignore the entries of APIC IDs < 255 in the X2APIC MADT table is solely based on the count of MADT APIC table entries. As a consequence, the affected machines enumerate no secondary CPUs at all because the APIC table has entries and therefore the X2APIC table entries with APIC IDs < 255 are ignored. Change the condition so that the APIC table preference for APIC IDs < 255 only becomes effective when the APIC table has valid APIC ID entries. IOW, an APIC table full of invalid APIC IDs is considered to be empty which in consequence enables the X2APIC table entries with a APIC ID < 255 and restores the expected behaviour.

Thomas Gleixner committed 2 years ago

Commit d5a10b91 parent 2dc41961 file · +1 −1Browse files

Unified · Split

arch/x86/kernel/acpi/boot.c+1−1
@@ -293,6 +293,7 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end) · 292 unmodified lines
293293 processor->processor_id, /* ACPI ID */
294294 processor->lapic_flags & ACPI_MADT_ENABLED);
295295
296+ has_lapic_cpus = true;
296297 return 0;
297298 }
298299
@@ -1134,7 +1135,6 @@ static int __init acpi_parse_madt_lapic_entries(void) · 835 unmodified lines
11341135 if (!count) {
11351136 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
11361137 acpi_parse_lapic, MAX_LOCAL_APIC);
1137− has_lapic_cpus = count > 0;
11381138 x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
11391139 acpi_parse_x2apic, MAX_LOCAL_APIC);
11401140 }