diff mbox

[Xen-devel,for-4.7,v2,2/5] xen/arm: acpi: The boot CPU does not always match the first entry in the MADT

Message ID 1460381617-5786-3-git-send-email-julien.grall@arm.com
State New
Headers show

Commit Message

Julien Grall April 11, 2016, 1:33 p.m. UTC
Since the ACPI 6.0 errata document [1], the first entry in the MADT
does not have to correspond to the boot CPU.

Introduce a new variable to know if a MADT entry matching the boot CPU
is found. Furthermore, it's not necessary to check if the MPIDR is
duplicated for the boot CPU. So the rest of the function can be skipped.

[1] 1380 Unnecessary restrictions to FW vendors in ordering of GIC structures
in MADT

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
    Changes in v2:
        - Modify the loop to start to 1 and not 0
---
 xen/arch/arm/acpi/boot.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 859aa86..1bba1cf 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -37,7 +37,8 @@ 
 #include <asm/setup.h>
 
 /* Processors with enabled flag and sane MPIDR */
-static unsigned int enabled_cpus;
+static unsigned int enabled_cpus = 1;
+static bool __initdata bootcpu_valid;
 
 /* total number of cpus in this system */
 static unsigned int __initdata total_cpus;
@@ -71,10 +72,15 @@  acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
     }
 
     /* Check if GICC structure of boot CPU is available in the MADT */
-    if ( (enabled_cpus == 0) && (cpu_logical_map(0) != mpidr) )
+    if ( cpu_logical_map(0) == mpidr )
     {
-        printk("Firmware bug, invalid CPU MPIDR for cpu0: 0x%"PRIx64" in MADT\n",
-               mpidr);
+        if ( bootcpu_valid )
+        {
+            printk("Firmware bug, duplicate boot CPU MPIDR: 0x%"PRIx64" in MADT\n",
+                   mpidr);
+            return;
+        }
+        bootcpu_valid = true;
         return;
     }
 
@@ -83,7 +89,7 @@  acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
      * all initialized entries and check for
      * duplicates. If any is found just ignore the CPU.
      */
-    for ( i = 0; i < enabled_cpus; i++ )
+    for ( i = 1; i < enabled_cpus; i++ )
     {
         if ( cpu_logical_map(i) == mpidr )
         {