xen/arm: Initialize PERCPU variables at the beginning of start_xen
authorJulien Grall <julien.grall@linaro.org>
Wed, 24 Jul 2013 17:01:36 +0000 (18:01 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 29 Jul 2013 15:54:39 +0000 (16:54 +0100)
PERCPU variables rely on HTPIDR (TPIDR_EL2) which is in an unknown state when
a processor boot.

For the boot CPU, the first use of PERCPU is in setup_pagetables. So
initialize PERCPU and set the processor ID before.

Bamvor Jian Zhang observed this failure on the sun6i processor which does not
initialise HTPIDR and contributed a very similar patch.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
[ ijc -- added last para of commit message ]

xen/arch/arm/setup.c

index 2f9fdc805e700e7c3eb472fb24ffdcbb0333d3be..1ec5e389a19bcba6455e88e4c430ca96dd40a45b 100644 (file)
@@ -428,6 +428,9 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     setup_cache();
 
+    percpu_init_areas();
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
     smp_clear_cpu_maps();
 
     device_tree_flattened = (void *)BOOT_MISC_VIRT_START
@@ -458,8 +461,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
-    percpu_init_areas();
-    set_processor_id(0); /* needed early, for smp_processor_id() */
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;