Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> --- arm/selftest.c | 3 +-- lib/arm/asm/thread_info.h | 7 +++++++ lib/arm/smp.c | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arm/selftest.c b/arm/selftest.c index 3e13296410fc1..aad7eecd529ad 100644 --- a/arm/selftest.c +++ b/arm/selftest.c @@ -356,9 +356,8 @@ int main(int argc, char **argv) } else if (strcmp(argv[0], "vectors-user") == 0) { - void *sp = memalign(THREAD_SIZE, THREAD_SIZE); start_usr(check_vectors, NULL, - (unsigned long)sp + THREAD_START_SP); + (unsigned long)thread_stack_alloc()); } else if (strcmp(argv[0], "smp") == 0) { diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h index 95058bff9d857..7eaac7c32953b 100644 --- a/lib/arm/asm/thread_info.h +++ b/lib/arm/asm/thread_info.h @@ -22,6 +22,7 @@ #ifndef __ASSEMBLY__ #include <asm/processor.h> +#include <alloc.h> #ifdef __arm__ #include <asm/ptrace.h> @@ -35,6 +36,12 @@ #define THREAD_START_SP (THREAD_SIZE - 16) #endif +static inline void *thread_stack_alloc(void) +{ + void *sp = memalign(THREAD_SIZE, THREAD_SIZE); + return sp + THREAD_START_SP; +} + #define TIF_USER_MODE (1U << 0) struct thread_info { diff --git a/lib/arm/smp.c b/lib/arm/smp.c index 390c53b5d84c3..bbaf9e60e9506 100644 --- a/lib/arm/smp.c +++ b/lib/arm/smp.c @@ -6,7 +6,6 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ #include <libcflat.h> -#include <alloc.h> #include <asm/thread_info.h> #include <asm/cpumask.h> #include <asm/barrier.h> @@ -43,10 +42,9 @@ secondary_entry_fn secondary_cinit(void) void smp_boot_secondary(int cpu, secondary_entry_fn entry) { - void *stack_base = memalign(THREAD_SIZE, THREAD_SIZE); int ret; - secondary_data.stack = stack_base + THREAD_START_SP; + secondary_data.stack = thread_stack_alloc(); secondary_data.entry = entry; mmu_mark_disabled(cpu); ret = cpu_psci_cpu_boot(cpu); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html