Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: consolidate kernel stack size related definitions

Define kernel stack size in kmem_layout and use it in
current_thread_info, GET_THREAD_INFO, THREAD_SIZE and THERAD_SIZE_ORDER
definitions.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+13 -10
+2 -2
arch/xtensa/include/asm/current.h
··· 11 11 #ifndef _XTENSA_CURRENT_H 12 12 #define _XTENSA_CURRENT_H 13 13 14 + #include <asm/thread_info.h> 15 + 14 16 #ifndef __ASSEMBLY__ 15 17 16 18 #include <linux/thread_info.h> ··· 27 25 #define current get_current() 28 26 29 27 #else 30 - 31 - #define CURRENT_SHIFT 13 32 28 33 29 #define GET_CURRENT(reg,sp) \ 34 30 GET_THREAD_INFO(reg,sp); \
+3
arch/xtensa/include/asm/kmem_layout.h
··· 71 71 72 72 #endif 73 73 74 + #define KERNEL_STACK_SHIFT 13 75 + #define KERNEL_STACK_SIZE (1 << KERNEL_STACK_SHIFT) 76 + 74 77 #endif
+1 -2
arch/xtensa/include/asm/ptrace.h
··· 10 10 #ifndef _XTENSA_PTRACE_H 11 11 #define _XTENSA_PTRACE_H 12 12 13 + #include <asm/kmem_layout.h> 13 14 #include <uapi/asm/ptrace.h> 14 15 15 16 /* ··· 38 37 * | struct thread_info | | | | 39 38 * +-----------------------+ -------- 40 39 */ 41 - 42 - #define KERNEL_STACK_SIZE (2 * PAGE_SIZE) 43 40 44 41 /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */ 45 42
+7 -6
arch/xtensa/include/asm/thread_info.h
··· 11 11 #ifndef _XTENSA_THREAD_INFO_H 12 12 #define _XTENSA_THREAD_INFO_H 13 13 14 - #ifdef __KERNEL__ 14 + #include <asm/kmem_layout.h> 15 + 16 + #define CURRENT_SHIFT KERNEL_STACK_SHIFT 15 17 16 18 #ifndef __ASSEMBLY__ 17 19 # include <asm/processor.h> ··· 86 84 static inline struct thread_info *current_thread_info(void) 87 85 { 88 86 struct thread_info *ti; 89 - __asm__("extui %0,a1,0,13\n\t" 87 + __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t" 90 88 "xor %0, a1, %0" : "=&r" (ti) : ); 91 89 return ti; 92 90 } ··· 95 93 96 94 /* how to get the thread information struct from ASM */ 97 95 #define GET_THREAD_INFO(reg,sp) \ 98 - extui reg, sp, 0, 13; \ 96 + extui reg, sp, 0, CURRENT_SHIFT; \ 99 97 xor reg, sp, reg 100 98 #endif 101 99 ··· 132 130 */ 133 131 #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ 134 132 135 - #define THREAD_SIZE 8192 //(2*PAGE_SIZE) 136 - #define THREAD_SIZE_ORDER 1 133 + #define THREAD_SIZE KERNEL_STACK_SIZE 134 + #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT) 137 135 138 - #endif /* __KERNEL__ */ 139 136 #endif /* _XTENSA_THREAD_INFO */