Commit 19f29aeb authored by Keith Packard's avatar Keith Packard Committed by Ard Biesheuvel

ARM: smp: Pass task to secondary_start_kernel

This avoids needing to compute the task pointer in this function, which
will no longer be possible once we move thread_info off the stack.
Signed-off-by: default avatarKeith Packard <keithpac@amazon.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Tested-by: default avatarAmit Daniel Kachhap <amit.kachhap@arm.com>
parent dfbdcda2
...@@ -48,7 +48,7 @@ extern void set_smp_ipi_range(int ipi_base, int nr_ipi); ...@@ -48,7 +48,7 @@ extern void set_smp_ipi_range(int ipi_base, int nr_ipi);
* Called from platform specific assembly code, this is the * Called from platform specific assembly code, this is the
* secondary CPU entry point. * secondary CPU entry point.
*/ */
asmlinkage void secondary_start_kernel(void); asmlinkage void secondary_start_kernel(struct task_struct *task);
/* /*
...@@ -61,6 +61,7 @@ struct secondary_data { ...@@ -61,6 +61,7 @@ struct secondary_data {
}; };
unsigned long swapper_pg_dir; unsigned long swapper_pg_dir;
void *stack; void *stack;
struct task_struct *task;
}; };
extern struct secondary_data secondary_data; extern struct secondary_data secondary_data;
extern void secondary_startup(void); extern void secondary_startup(void);
......
...@@ -115,6 +115,7 @@ ENTRY(secondary_startup) ...@@ -115,6 +115,7 @@ ENTRY(secondary_startup)
ret r12 ret r12
1: bl __after_proc_init 1: bl __after_proc_init
ldr sp, [r7, #12] @ set up the stack pointer ldr sp, [r7, #12] @ set up the stack pointer
ldr r0, [r7, #16] @ set up task pointer
mov fp, #0 mov fp, #0
b secondary_start_kernel b secondary_start_kernel
ENDPROC(secondary_startup) ENDPROC(secondary_startup)
......
...@@ -424,8 +424,9 @@ ENDPROC(secondary_startup) ...@@ -424,8 +424,9 @@ ENDPROC(secondary_startup)
ENDPROC(secondary_startup_arm) ENDPROC(secondary_startup_arm)
ENTRY(__secondary_switched) ENTRY(__secondary_switched)
ldr_l r7, secondary_data + 12 @ get secondary_data.stack adr_l r7, secondary_data + 12 @ get secondary_data.stack
mov sp, r7 ldr sp, [r7]
ldr r0, [r7, #4] @ get secondary_data.task
mov fp, #0 mov fp, #0
b secondary_start_kernel b secondary_start_kernel
ENDPROC(__secondary_switched) ENDPROC(__secondary_switched)
......
...@@ -153,6 +153,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) ...@@ -153,6 +153,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
secondary_data.pgdir = virt_to_phys(idmap_pgd); secondary_data.pgdir = virt_to_phys(idmap_pgd);
secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir); secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir);
#endif #endif
secondary_data.task = idle;
sync_cache_w(&secondary_data); sync_cache_w(&secondary_data);
/* /*
...@@ -375,9 +376,12 @@ void arch_cpu_idle_dead(void) ...@@ -375,9 +376,12 @@ void arch_cpu_idle_dead(void)
*/ */
__asm__("mov sp, %0\n" __asm__("mov sp, %0\n"
" mov fp, #0\n" " mov fp, #0\n"
" mov r0, %1\n"
" b secondary_start_kernel" " b secondary_start_kernel"
: :
: "r" (task_stack_page(current) + THREAD_SIZE - 8)); : "r" (task_stack_page(current) + THREAD_SIZE - 8),
"r" (current)
: "r0");
} }
#endif /* CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU */
...@@ -400,7 +404,7 @@ static void smp_store_cpu_info(unsigned int cpuid) ...@@ -400,7 +404,7 @@ static void smp_store_cpu_info(unsigned int cpuid)
* This is the secondary CPU boot entry. We're using this CPUs * This is the secondary CPU boot entry. We're using this CPUs
* idle thread stack, but a set of temporary page tables. * idle thread stack, but a set of temporary page tables.
*/ */
asmlinkage void secondary_start_kernel(void) asmlinkage void secondary_start_kernel(struct task_struct *task)
{ {
struct mm_struct *mm = &init_mm; struct mm_struct *mm = &init_mm;
unsigned int cpu; unsigned int cpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment