Commit c2c3258f authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/stack: use STACK_INIT_OFFSET where possible

Make STACK_INIT_OFFSET also available for assembler code, and
use it everywhere instead of open-coding it at several places.
Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent e6badee9
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#define _ASM_THREAD_INFO_H #define _ASM_THREAD_INFO_H
#include <linux/bits.h> #include <linux/bits.h>
#ifndef ASM_OFFSETS_C
#include <asm/asm-offsets.h>
#endif
/* /*
* General size of kernel stacks * General size of kernel stacks
...@@ -21,13 +24,12 @@ ...@@ -21,13 +24,12 @@
#define BOOT_STACK_SIZE (PAGE_SIZE << 2) #define BOOT_STACK_SIZE (PAGE_SIZE << 2)
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
#define STACK_INIT_OFFSET (THREAD_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm/lowcore.h> #include <asm/lowcore.h>
#include <asm/page.h> #include <asm/page.h>
#define STACK_INIT_OFFSET \
(THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs))
/* /*
* low level task data that entry.S needs immediate access to * low level task data that entry.S needs immediate access to
* - this struct should fit entirely inside of one cache line * - this struct should fit entirely inside of one cache line
......
...@@ -29,10 +29,6 @@ ...@@ -29,10 +29,6 @@
#include <asm/export.h> #include <asm/export.h>
#include <asm/nospec-insn.h> #include <asm/nospec-insn.h>
STACK_SHIFT = PAGE_SHIFT + THREAD_SIZE_ORDER
STACK_SIZE = 1 << STACK_SHIFT
STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
_LPP_OFFSET = __LC_LPP _LPP_OFFSET = __LC_LPP
.macro STBEAR address .macro STBEAR address
...@@ -53,7 +49,7 @@ _LPP_OFFSET = __LC_LPP ...@@ -53,7 +49,7 @@ _LPP_OFFSET = __LC_LPP
.macro CHECK_STACK savearea .macro CHECK_STACK savearea
#ifdef CONFIG_CHECK_STACK #ifdef CONFIG_CHECK_STACK
tml %r15,STACK_SIZE - CONFIG_STACK_GUARD tml %r15,THREAD_SIZE - CONFIG_STACK_GUARD
lghi %r14,\savearea lghi %r14,\savearea
jz stack_overflow jz stack_overflow
#endif #endif
...@@ -62,8 +58,8 @@ _LPP_OFFSET = __LC_LPP ...@@ -62,8 +58,8 @@ _LPP_OFFSET = __LC_LPP
.macro CHECK_VMAP_STACK savearea,oklabel .macro CHECK_VMAP_STACK savearea,oklabel
#ifdef CONFIG_VMAP_STACK #ifdef CONFIG_VMAP_STACK
lgr %r14,%r15 lgr %r14,%r15
nill %r14,0x10000 - STACK_SIZE nill %r14,0x10000 - THREAD_SIZE
oill %r14,STACK_INIT oill %r14,STACK_INIT_OFFSET
clg %r14,__LC_KERNEL_STACK clg %r14,__LC_KERNEL_STACK
je \oklabel je \oklabel
clg %r14,__LC_ASYNC_STACK clg %r14,__LC_ASYNC_STACK
...@@ -179,7 +175,7 @@ ENTRY(__switch_to) ...@@ -179,7 +175,7 @@ ENTRY(__switch_to)
stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
lghi %r4,__TASK_stack lghi %r4,__TASK_stack
lghi %r1,__TASK_thread lghi %r1,__TASK_thread
llill %r5,STACK_INIT llill %r5,STACK_INIT_OFFSET
stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev
lg %r15,0(%r4,%r3) # start of kernel stack of next lg %r15,0(%r4,%r3) # start of kernel stack of next
agr %r15,%r5 # end of kernel stack of next agr %r15,%r5 # end of kernel stack of next
......
...@@ -24,7 +24,7 @@ ENTRY(startup_continue) ...@@ -24,7 +24,7 @@ ENTRY(startup_continue)
# #
larl %r14,init_task larl %r14,init_task
stg %r14,__LC_CURRENT stg %r14,__LC_CURRENT
larl %r15,init_thread_union+THREAD_SIZE-STACK_FRAME_OVERHEAD-__PT_SIZE larl %r15,init_thread_union+STACK_INIT_OFFSET
brasl %r14,sclp_early_adjust_va # allow sclp_early_printk brasl %r14,sclp_early_adjust_va # allow sclp_early_printk
brasl %r14,startup_init # s390 specific early init brasl %r14,startup_init # s390 specific early init
brasl %r14,start_kernel # common init code brasl %r14,start_kernel # common init code
......
...@@ -436,8 +436,7 @@ static void __init setup_lowcore(void) ...@@ -436,8 +436,7 @@ static void __init setup_lowcore(void)
lc->io_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK; lc->io_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK;
lc->io_new_psw.addr = (unsigned long) io_int_handler; lc->io_new_psw.addr = (unsigned long) io_int_handler;
lc->clock_comparator = clock_comparator_max; lc->clock_comparator = clock_comparator_max;
lc->nodat_stack = ((unsigned long) &init_thread_union) lc->nodat_stack = ((unsigned long)&init_thread_union) + STACK_INIT_OFFSET;
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
lc->current_task = (unsigned long)&init_task; lc->current_task = (unsigned long)&init_task;
lc->lpp = LPP_MAGIC; lc->lpp = LPP_MAGIC;
lc->machine_flags = S390_lowcore.machine_flags; lc->machine_flags = S390_lowcore.machine_flags;
......
...@@ -280,9 +280,8 @@ static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk) ...@@ -280,9 +280,8 @@ static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk)
cpu = pcpu - pcpu_devices; cpu = pcpu - pcpu_devices;
lc = lowcore_ptr[cpu]; lc = lowcore_ptr[cpu];
lc->kernel_stack = (unsigned long) task_stack_page(tsk) lc->kernel_stack = (unsigned long)task_stack_page(tsk) + STACK_INIT_OFFSET;
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); lc->current_task = (unsigned long)tsk;
lc->current_task = (unsigned long) tsk;
lc->lpp = LPP_MAGIC; lc->lpp = LPP_MAGIC;
lc->current_pid = tsk->pid; lc->current_pid = tsk->pid;
lc->user_timer = tsk->thread.user_timer; lc->user_timer = tsk->thread.user_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment