All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH] x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT
@ 2023-08-07  9:38 Simon Gaiser
  2023-08-07 10:01 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 37+ messages in thread
From: Simon Gaiser @ 2023-08-07  9:38 UTC (permalink / raw)
  To: xen-devel
  Cc: Simon Gaiser, Jan Beulich, Andrew Cooper, Roger Pau Monné,
	Wei Liu, Marek Marczykowski-Górecki

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.

Note that on some older (2nd gen Core i) laptop of mine I also saw dummy
entries with a valid APIC ID. Linux would still ignore those because
they have !ACPI_MADT_ENABLED && !ACPI_MADT_ONLINE_CAPABLE. But in Xen
this check is only active for madt_revision >= 5. But since this version
check seems to be intentionally I leave that alone.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f3bf1dbe64b62a2058dd1944c00990df203e8e7a # [1]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=10daf10ab154e31237a8c07242be3063fb6a9bf4 # [2]
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
---
 xen/arch/x86/acpi/boot.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 54b72d716b..4a62822fa9 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -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 apicid */
+	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 apicid */
+	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 */
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-09-15 10:42 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-07  9:38 [XEN PATCH] x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT Simon Gaiser
2023-08-07 10:01 ` Andrew Cooper
2023-08-07 10:06   ` Andrew Cooper
2023-08-07 10:17     ` Simon Gaiser
2023-08-07 14:45   ` Simon Gaiser
2023-08-23  9:32     ` Andrew Cooper
2023-09-11 10:17       ` Simon Gaiser
2023-08-07 10:13 ` Jan Beulich
2023-08-07 12:55   ` Simon Gaiser
2023-08-07 13:17     ` Jan Beulich
2023-08-07 14:04       ` Andrew Cooper
2023-08-07 14:18         ` Jan Beulich
2023-08-23  9:21           ` Andrew Cooper
2023-08-23 12:56             ` Jan Beulich
2023-08-27 15:44               ` Thomas Gleixner
2023-08-29 14:25                 ` Roger Pau Monné
2023-08-29 22:54                   ` Thomas Gleixner
2023-08-30  7:20                     ` Jan Beulich
2023-08-30 15:44                       ` Thomas Gleixner
2023-08-07 15:05       ` Simon Gaiser
2023-08-23  9:13       ` Roger Pau Monné
2023-09-01  7:44 ` Jan Beulich
2023-09-06 20:49   ` Stefano Stabellini
2023-09-07  6:50     ` Jan Beulich
2023-09-07 21:30       ` Stefano Stabellini
2023-09-11 18:24     ` Andrew Cooper
2023-09-11 22:38       ` Stefano Stabellini
2023-09-12  9:38         ` Roger Pau Monné
2023-09-12  7:56       ` Thomas Gleixner
2023-09-13 10:02         ` George Dunlap
2023-09-13 23:18           ` Stefano Stabellini
2023-09-15 10:41             ` George Dunlap
2023-09-12  8:33       ` Jan Beulich
2023-09-12  8:36         ` Jan Beulich
2023-09-11 18:05   ` Simon Gaiser
2023-09-12  8:41     ` Jan Beulich
2023-09-12  8:45       ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.