diff mbox

[v5,1/7] xen/arm: Introduce init_info structure

Message ID 1380193781-17474-2-git-send-email-julien.grall@linaro.org
State Accepted, archived
Headers show

Commit Message

Julien Grall Sept. 26, 2013, 11:09 a.m. UTC
This structure will gather all information to boot a secondary cpus.
For now it just contains the initial stack.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/arm32/asm-offsets.c |    4 ++++
 xen/arch/arm/arm32/head.S        |    3 ++-
 xen/arch/arm/arm64/asm-offsets.c |    3 +++
 xen/arch/arm/arm64/head.S        |    3 ++-
 xen/arch/arm/smpboot.c           |    9 ++++++---
 xen/include/asm-arm/init.h       |    6 ++++++
 6 files changed, 23 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/arm/arm32/asm-offsets.c b/xen/arch/arm/arm32/asm-offsets.c
index 263fff3..ac628c0 100644
--- a/xen/arch/arm/arm32/asm-offsets.c
+++ b/xen/arch/arm/arm32/asm-offsets.c
@@ -69,6 +69,10 @@  void __dummy__(void)
    OFFSET(PROCINFO_cpu_val, struct proc_info_list, cpu_val);
    OFFSET(PROCINFO_cpu_mask, struct proc_info_list, cpu_mask);
    OFFSET(PROCINFO_cpu_init, struct proc_info_list, cpu_init);
+
+   BLANK();
+   OFFSET(INITINFO_stack, struct init_info, stack);
+
 }
 
 /*
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 79e95b6..fce18a2 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -366,7 +366,8 @@  paging:
         bne   1b
 
 launch:
-        ldr   r0, =init_stack        /* Find the boot-time stack */
+        ldr   r0, =init_data
+        add   r0, #INITINFO_stack    /* Find the boot-time stack */
         ldr   sp, [r0]
         add   sp, #STACK_SIZE        /* (which grows down from the top). */
         sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
diff --git a/xen/arch/arm/arm64/asm-offsets.c b/xen/arch/arm/arm64/asm-offsets.c
index 2a225b6..d7572fa 100644
--- a/xen/arch/arm/arm64/asm-offsets.c
+++ b/xen/arch/arm/arm64/asm-offsets.c
@@ -46,6 +46,9 @@  void __dummy__(void)
    DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
 
    OFFSET(VCPU_arch_saved_context, struct vcpu, arch.saved_context);
+
+   BLANK();
+   OFFSET(INITINFO_stack, struct init_info, stack);
 }
 
 /*
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 21b7e4d..e0831b6 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -313,7 +313,8 @@  paging:
         b.ne  1b
 
 launch:
-        ldr   x0, =init_stack        /* Find the boot-time stack */
+        ldr   x0, =init_data
+        add   x0, x0, #INITINFO_stack /* Find the boot-time stack */
         ldr   x0, [x0]
         add   x0, x0, #STACK_SIZE    /* (which grows down from the top). */
         sub   x0, x0, #CPUINFO_sizeof /* Make room for CPU save record */
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index b6aea63..945f473 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -46,8 +46,11 @@  nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 static unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
        __attribute__((__aligned__(STACK_SIZE)));
 
-/* Pointer to the stack, used by head.S when entering C */
-unsigned char *init_stack = cpu0_boot_stack;
+/* Initial boot cpu data */
+struct init_info __initdata init_data =
+{
+    .stack = cpu0_boot_stack,
+};
 
 /* Shared state for coordinating CPU bringup */
 unsigned long smp_up_cpu = 0;
@@ -224,7 +227,7 @@  int __cpu_up(unsigned int cpu)
         return rc;
 
     /* Tell the remote CPU which stack to boot on. */
-    init_stack = idle_vcpu[cpu]->arch.stack;
+    init_data.stack = idle_vcpu[cpu]->arch.stack;
 
     /* Unblock the CPU.  It should be waiting in the loop in head.S
      * for an event to arrive when smp_up_cpu matches its cpuid. */
diff --git a/xen/include/asm-arm/init.h b/xen/include/asm-arm/init.h
index 237ec25..7a07136 100644
--- a/xen/include/asm-arm/init.h
+++ b/xen/include/asm-arm/init.h
@@ -1,6 +1,12 @@ 
 #ifndef _XEN_ASM_INIT_H
 #define _XEN_ASM_INIT_H
 
+struct init_info
+{
+    /* Pointer to the stack, used by head.S when entering in C */
+    unsigned char *stack;
+};
+
 #endif /* _XEN_ASM_INIT_H */
 /*
  * Local variables: