aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/thread_info.h
diff options
context:
space:
mode:
authorJungseok Lee <jungseoklee85@gmail.com>2015-12-04 11:02:25 +0000
committerWill Deacon <will.deacon@arm.com>2015-12-08 11:40:48 +0000
commit6cdf9c7ca687e01840d0215437620a20263012fc (patch)
tree096f89d35adbe535b681e885c0214ea9eee7b463 /arch/arm64/include/asm/thread_info.h
parentarm64: Clear out any singlestep state on a ptrace detach operation (diff)
downloadlinux-dev-6cdf9c7ca687e01840d0215437620a20263012fc.tar.xz
linux-dev-6cdf9c7ca687e01840d0215437620a20263012fc.zip
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/include/asm/thread_info.h')
-rw-r--r--arch/arm64/include/asm/thread_info.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 90c7ff233735..abd64bd1f6d9 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -73,10 +73,16 @@ register unsigned long current_stack_pointer asm ("sp");
*/
static inline struct thread_info *current_thread_info(void) __attribute_const__;
+/*
+ * struct thread_info can be accessed directly via sp_el0.
+ */
static inline struct thread_info *current_thread_info(void)
{
- return (struct thread_info *)
- (current_stack_pointer & ~(THREAD_SIZE - 1));
+ unsigned long sp_el0;
+
+ asm ("mrs %0, sp_el0" : "=r" (sp_el0));
+
+ return (struct thread_info *)sp_el0;
}
#define thread_saved_pc(tsk) \