]> xenbits.xensource.com Git - xen.git/commitdiff
xen/dts: Check the CPU ID is not greater than NR_CPUS
authorJulien Grall <julien.grall@linaro.org>
Fri, 13 Sep 2013 12:49:15 +0000 (13:49 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 17 Sep 2013 14:28:08 +0000 (15:28 +0100)
On some board CPU IDs are not contiguous (for instance the Versatile Express
with big.LITTLE supports). If the CPU ID is greater than NR_CPUS Xen will hang
without any message. This is because console driver is not yet initialized and
hypervisor data abort uses printk.

For the moment check the CPU ID and print an warning if an error occured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/common/device_tree.c

index 9d300ecb8fd7709725e08d4ecacd92ef5ced2087..d2262ce31f6fcd7f89d98d021674982a664bde74 100644 (file)
@@ -445,6 +445,13 @@ static void __init process_cpu_node(const void *fdt, int node,
 
     cpuid = dt_read_number((const __be32 *)prop->data, 1);
 
+    /* TODO: handle non-contiguous CPU ID */
+    if ( cpuid >= NR_CPUS )
+    {
+        dt_printk("fdt: node `%s': reg(0x%x) >= NR_CPUS(%d)\n",
+                  name, cpuid, NR_CPUS);
+        return;
+    }
     cpumask_set_cpu(cpuid, &cpu_possible_map);
 }