aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/entry.S
diff options
context:
space:
mode:
authorJungseok Lee <jungseoklee85@gmail.com>2015-12-04 06:02:25 -0500
committerWill Deacon <will.deacon@arm.com>2015-12-08 06:40:48 -0500
commit6cdf9c7ca687e01840d0215437620a20263012fc (patch)
tree096f89d35adbe535b681e885c0214ea9eee7b463 /arch/arm64/kernel/entry.S
parent5db4fd8c52810bd9740c1240ebf89223b171aa70 (diff)
arm64: Store struct thread_info in sp_el0
There is need for figuring out how to manage struct thread_info data when IRQ stack is introduced. struct thread_info information should be copied to IRQ stack under the current thread_info calculation logic whenever context switching is invoked. This is too expensive to keep supporting the approach. Instead, this patch pays attention to sp_el0 which is an unused scratch register in EL1 context. sp_el0 utilization not only simplifies the management, but also prevents text section size from being increased largely due to static allocated IRQ stack as removing masking operation using THREAD_SIZE in many places. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Jungseok Lee <jungseoklee85@gmail.com> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/entry.S')
-rw-r--r--arch/arm64/kernel/entry.S15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index e5b25389c48f..245fa6837880 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -88,7 +88,8 @@
88 88
89 .if \el == 0 89 .if \el == 0
90 mrs x21, sp_el0 90 mrs x21, sp_el0
91 get_thread_info tsk // Ensure MDSCR_EL1.SS is clear, 91 mov tsk, sp
92 and tsk, tsk, #~(THREAD_SIZE - 1) // Ensure MDSCR_EL1.SS is clear,
92 ldr x19, [tsk, #TI_FLAGS] // since we can unmask debug 93 ldr x19, [tsk, #TI_FLAGS] // since we can unmask debug
93 disable_step_tsk x19, x20 // exceptions when scheduling. 94 disable_step_tsk x19, x20 // exceptions when scheduling.
94 .else 95 .else
@@ -108,6 +109,13 @@
108 .endif 109 .endif
109 110
110 /* 111 /*
112 * Set sp_el0 to current thread_info.
113 */
114 .if \el == 0
115 msr sp_el0, tsk
116 .endif
117
118 /*
111 * Registers that may be useful after this macro is invoked: 119 * Registers that may be useful after this macro is invoked:
112 * 120 *
113 * x21 - aborted SP 121 * x21 - aborted SP
@@ -164,8 +172,7 @@ alternative_endif
164 .endm 172 .endm
165 173
166 .macro get_thread_info, rd 174 .macro get_thread_info, rd
167 mov \rd, sp 175 mrs \rd, sp_el0
168 and \rd, \rd, #~(THREAD_SIZE - 1) // top of stack
169 .endm 176 .endm
170 177
171/* 178/*
@@ -599,6 +606,8 @@ ENTRY(cpu_switch_to)
599 ldp x29, x9, [x8], #16 606 ldp x29, x9, [x8], #16
600 ldr lr, [x8] 607 ldr lr, [x8]
601 mov sp, x9 608 mov sp, x9
609 and x9, x9, #~(THREAD_SIZE - 1)
610 msr sp_el0, x9
602 ret 611 ret
603ENDPROC(cpu_switch_to) 612ENDPROC(cpu_switch_to)
604 613