Module Name:    src
Committed By:   bouyer
Date:           Fri Mar 24 12:25:28 UTC 2023

Modified Files:
        src/sys/arch/x86/x86: mpacpi.c

Log Message:
mpacpi_config_cpu(): Xen with a PVH dom0 reports x2apic->LocalApicId
below 0xff, which causes a panic later because no CPUs are attached.
Accept the bogus LocalApicId value for VM_GUEST_XENPVH.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/x86/x86/mpacpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/mpacpi.c
diff -u src/sys/arch/x86/x86/mpacpi.c:1.109 src/sys/arch/x86/x86/mpacpi.c:1.110
--- src/sys/arch/x86/x86/mpacpi.c:1.109	Sat Jan 22 11:49:17 2022
+++ src/sys/arch/x86/x86/mpacpi.c	Fri Mar 24 12:25:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpacpi.c,v 1.109 2022/01/22 11:49:17 thorpej Exp $	*/
+/*	$NetBSD: mpacpi.c,v 1.110 2023/03/24 12:25:28 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.109 2022/01/22 11:49:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.110 2023/03/24 12:25:28 bouyer Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -396,8 +396,9 @@ mpacpi_config_cpu(ACPI_SUBTABLE_HEADER *
 		/* ACPI spec: "Logical processors with APIC ID values
 		 * less than 255 must use the Processor Local APIC
 		 * structure to convey their APIC information to OSPM."
+		 * But Xen with PVH dom0 breaks this ACPI spec.
 		 */
-		if (x2apic->LocalApicId <= 0xff) {
+		if (x2apic->LocalApicId <= 0xff && vm_guest != VM_GUEST_XENPVH) {
 			printf("bogus MADT X2APIC entry (id = 0x%"PRIx32")\n",
 			    x2apic->LocalApicId);
 			break;

Reply via email to