Skip to content

Commit d5a10b9

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
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. Fixes: ec9aedb ("x86/acpi: Ignore invalid x2APIC entries") Reported-by: John Sperbeck <jsperbeck@google.com> Reported-by: Andres Freund <andres@anarazel.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/169953729188.3135.6804572126118798018.tip-bot2@tip-bot2
1 parent 2dc4196 commit d5a10b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/acpi/boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
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)
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
}

0 commit comments

Comments
 (0)