diff options
author | Colin Cross <ccross@android.com> | 2010-10-05 22:08:01 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:37 -0700 |
commit | 3af0a0f4ec47978a6de112d6c6f1a0fe7d32e03a (patch) | |
tree | ca452fae85212b74364ef4babb9cad38a11a4b83 | |
parent | c0455a04b73d1de3d885956a182264af3992cdc7 (diff) | |
download | kernel_samsung_tuna-3af0a0f4ec47978a6de112d6c6f1a0fe7d32e03a.zip kernel_samsung_tuna-3af0a0f4ec47978a6de112d6c6f1a0fe7d32e03a.tar.gz kernel_samsung_tuna-3af0a0f4ec47978a6de112d6c6f1a0fe7d32e03a.tar.bz2 |
[ARM] fiq glue: Align fiq stacks
Change-Id: I956f05d0b0ce48572e611765e56a439dc036c052
Signed-off-by: Colin Cross <ccross@android.com>
-rw-r--r-- | arch/arm/common/fiq_glue_setup.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/arch/arm/common/fiq_glue_setup.c b/arch/arm/common/fiq_glue_setup.c index f878ea0..4044c7d 100644 --- a/arch/arm/common/fiq_glue_setup.c +++ b/arch/arm/common/fiq_glue_setup.c @@ -23,7 +23,7 @@ extern void fiq_glue_setup(void *func, void *data, void *sp); static struct fiq_handler fiq_debbuger_fiq_handler = { .name = "fiq_glue", }; -static __percpu void *fiq_stack; +DEFINE_PER_CPU(void *, fiq_stack); static struct fiq_glue_handler *current_handler; static DEFINE_MUTEX(fiq_glue_lock); @@ -31,12 +31,13 @@ static void fiq_glue_setup_helper(void *info) { struct fiq_glue_handler *handler = info; fiq_glue_setup(handler->fiq, handler, - __this_cpu_ptr(fiq_stack) + THREAD_START_SP); + __get_cpu_var(fiq_stack) + THREAD_START_SP); } int fiq_glue_register_handler(struct fiq_glue_handler *handler) { int ret; + int cpu; if (!handler || !handler->fiq) return -EINVAL; @@ -47,10 +48,14 @@ int fiq_glue_register_handler(struct fiq_glue_handler *handler) goto err_busy; } - fiq_stack = __alloc_percpu(THREAD_SIZE, L1_CACHE_BYTES); - if (WARN_ON(!fiq_stack)) { - ret = -ENOMEM; - goto err_alloc_fiq_stack; + for_each_possible_cpu(cpu) { + void *stack; + stack = (void *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); + if (WARN_ON(!stack)) { + ret = -ENOMEM; + goto err_alloc_fiq_stack; + } + per_cpu(fiq_stack, cpu) = stack; } ret = claim_fiq(&fiq_debbuger_fiq_handler); @@ -61,12 +66,15 @@ int fiq_glue_register_handler(struct fiq_glue_handler *handler) on_each_cpu(fiq_glue_setup_helper, handler, true); set_fiq_handler(&fiq_glue, &fiq_glue_end - &fiq_glue); + mutex_unlock(&fiq_glue_lock); + return 0; + err_claim_fiq: - if (ret) { - free_percpu(fiq_stack); - fiq_stack = NULL; - } err_alloc_fiq_stack: + for_each_possible_cpu(cpu) { + __free_pages(per_cpu(fiq_stack, cpu), THREAD_SIZE_ORDER); + per_cpu(fiq_stack, cpu) = NULL; + } err_busy: mutex_unlock(&fiq_glue_lock); return ret; @@ -85,7 +93,7 @@ void fiq_glue_resume(void) if (!current_handler) return; fiq_glue_setup(current_handler->fiq, current_handler, - __this_cpu_ptr(fiq_stack) + THREAD_START_SP); + __get_cpu_var(fiq_stack) + THREAD_START_SP); if (current_handler->resume) current_handler->resume(current_handler); } |