]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT
authorSimon Gaiser <simon@invisiblethingslab.com>
Mon, 7 Aug 2023 09:38:25 +0000 (11:38 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Aug 2023 14:54:45 +0000 (15:54 +0100)
It seems some firmwares put dummy entries in the ACPI MADT table for non
existing processors. On my NUC11TNHi5 those have the invalid APIC ID
0xff. Linux already has code to handle those cases both in
acpi_parse_lapic [1] as well as in acpi_parse_x2apic [2]. So add the
same check to Xen.

Link: https://git.kernel.org/torvalds/c/f3bf1dbe64b62a2058dd1944c00990df203e8e7a
Link: https://git.kernel.org/torvalds/c/10daf10ab154e31237a8c07242be3063fb6a9bf4
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/acpi/boot.c

index 54b72d716beda91bfee09b62e6e7e8ba12ece5c8..ead41bd535b5da414daf289c78740ebd72d7dc70 100644 (file)
@@ -87,14 +87,17 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
        if (BAD_MADT_ENTRY(processor, end))
                return -EINVAL;
 
+       /* Ignore entries with invalid x2APIC ID */
+       if (processor->local_apic_id == 0xffffffff)
+               return 0;
+
        /* Don't register processors that cannot be onlined. */
        if (madt_revision >= 5 &&
            !(processor->lapic_flags & ACPI_MADT_ENABLED) &&
            !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
                return 0;
 
-       if ((processor->lapic_flags & ACPI_MADT_ENABLED) ||
-           processor->local_apic_id != 0xffffffff || opt_cpu_info) {
+       if ((processor->lapic_flags & ACPI_MADT_ENABLED) || opt_cpu_info) {
                acpi_table_print_madt_entry(header);
                log = true;
        }
@@ -143,14 +146,17 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
        if (BAD_MADT_ENTRY(processor, end))
                return -EINVAL;
 
+       /* Ignore entries with invalid APIC ID */
+       if (processor->id == 0xff)
+               return 0;
+
        /* Don't register processors that cannot be onlined. */
        if (madt_revision >= 5 &&
            !(processor->lapic_flags & ACPI_MADT_ENABLED) &&
            !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
                return 0;
 
-       if ((processor->lapic_flags & ACPI_MADT_ENABLED) ||
-           processor->id != 0xff || opt_cpu_info)
+       if ((processor->lapic_flags & ACPI_MADT_ENABLED) || opt_cpu_info)
                acpi_table_print_madt_entry(header);
 
        /* Record local apic id only when enabled */