diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-11-01 06:16:40 +0100 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-11-06 06:11:46 +0100 |
commit | 57e26e57454fae4f1d15c2e9fa965b7a8046ab34 (patch) | |
tree | 8100ec071f56fbd4cd3a01747ce971235118f6f3 /arch/arc/kernel/ctx_sw_asm.S | |
parent | ARC: [SMP] enlarge possible NR_CPUS (diff) | |
download | linux-57e26e57454fae4f1d15c2e9fa965b7a8046ab34.tar.xz linux-57e26e57454fae4f1d15c2e9fa965b7a8046ab34.zip |
ARC: [SMP] Fix build failures for large NR_CPUS
ST.as only takes S9 (255) for offset. This was going out of range when
accessing a task_struct field with 4k NR_CPUS (due to 128b of coumaks
itself in there).
Workaround by using an intermediate register to do the address scaling.
There is some duplication of fix for ctx_sw.c and ctx_sw_asm.S however
given that C version will go away soon I'm not bothering to factor out
the common code.
Reported-by: Noam Camus <noamc@ezchip.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel/ctx_sw_asm.S')
-rw-r--r-- | arch/arc/kernel/ctx_sw_asm.S | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S index d8972345e4c2..65690e7fcc8c 100644 --- a/arch/arc/kernel/ctx_sw_asm.S +++ b/arch/arc/kernel/ctx_sw_asm.S @@ -14,6 +14,8 @@ #include <asm/asm-offsets.h> #include <asm/linkage.h> +#define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) + ;################### Low Level Context Switch ########################## .section .sched.text,"ax",@progbits @@ -28,8 +30,13 @@ __switch_to: SAVE_CALLEE_SAVED_KERNEL /* Save the now KSP in task->thread.ksp */ - st.as sp, [r0, (TASK_THREAD + THREAD_KSP)/4] - +#if KSP_WORD_OFF <= 255 + st.as sp, [r0, KSP_WORD_OFF] +#else + /* Workaround for NR_CPUS=4k as ST.as can only take s9 offset */ + add2 r24, r0, KSP_WORD_OFF + st sp, [r24] +#endif /* * Return last task in r0 (return reg) * On ARC, Return reg = First Arg reg = r0. |