blob: ce4e17c9aad6fa266d306676df4e7cdc69eb7df0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * S390 version
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02004 * Copyright IBM Corp. 2002, 2006
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
Heiko Carstens92778b92015-10-06 16:23:39 +020011#include <linux/const.h>
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013/*
Vasily Gorbik32ce55a2018-09-18 18:23:40 +020014 * General size of kernel stacks
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 */
Vasily Gorbik7fef92c2017-11-17 16:52:22 +010016#ifdef CONFIG_KASAN
Vasily Gorbik9fed9202018-10-26 15:29:59 +020017#define THREAD_SIZE_ORDER 4
Vasily Gorbik7fef92c2017-11-17 16:52:22 +010018#else
Heiko Carstens3a890382016-11-14 14:39:16 +010019#define THREAD_SIZE_ORDER 2
Vasily Gorbik7fef92c2017-11-17 16:52:22 +010020#endif
Vasily Gorbik19733fe2018-01-12 12:46:00 +010021#define BOOT_STACK_ORDER 2
Heiko Carstens3a890382016-11-14 14:39:16 +010022#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/lowcore.h>
Christian Ehrhardt25097bf2009-04-14 15:36:16 +020026#include <asm/page.h>
27#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Vasily Gorbik32ce55a2018-09-18 18:23:40 +020029#define STACK_INIT_OFFSET \
30 (THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs))
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032/*
33 * low level task data that entry.S needs immediate access to
34 * - this struct should fit entirely inside of one cache line
35 * - this struct shares the supervisor stack pages
36 * - if the contents of this structure are changed, the assembly constants must also be changed
37 */
38struct thread_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 unsigned long flags; /* low level flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040};
41
42/*
43 * macros/functions for gaining access to the thread information structure
44 */
45#define INIT_THREAD_INFO(tsk) \
46{ \
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 .flags = 0, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
49
Heiko Carstens2a5e91c2015-03-16 12:46:38 +010050void arch_release_task_struct(struct task_struct *tsk);
Heiko Carstens521b00c2016-05-07 12:15:21 +020051int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
Heiko Carstens2a5e91c2015-03-16 12:46:38 +010052
Martin Schwidefsky2317b072018-04-20 10:21:21 +020053void arch_setup_new_exec(void);
54#define arch_setup_new_exec arch_setup_new_exec
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#endif
57
58/*
59 * thread information flags bit numbers
60 */
Jiri Slaby30d64f12017-02-13 19:42:33 -060061/* _TIF_WORK bits */
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +020062#define TIF_NOTIFY_RESUME 0 /* callback before returning to user */
63#define TIF_SIGPENDING 1 /* signal pending */
64#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
Martin Schwidefsky916cda12016-01-26 14:10:34 +010065#define TIF_UPROBE 3 /* breakpointed or single-stepping */
66#define TIF_GUARDED_STORAGE 4 /* load guarded storage control block */
Linus Torvalds76f19482017-05-02 18:24:16 -070067#define TIF_PATCH_PENDING 5 /* pending live patching update */
Martin Schwidefsky23fefe12017-06-07 14:10:24 +020068#define TIF_PGSTE 6 /* New mm's will use 4K page tables */
Martin Schwidefsky6b730442018-01-16 07:36:46 +010069#define TIF_ISOLATE_BP 8 /* Run process with isolated BP */
70#define TIF_ISOLATE_BP_GUEST 9 /* Run KVM guests with isolated BP */
Jiri Slaby30d64f12017-02-13 19:42:33 -060071
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +020072#define TIF_31BIT 16 /* 32bit process */
73#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
74#define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal() */
75#define TIF_SINGLE_STEP 19 /* This task is single stepped */
76#define TIF_BLOCK_STEP 20 /* This task is block stepped */
Jan Willeke2a0a5b22014-09-22 16:39:06 +020077#define TIF_UPROBE_SINGLESTEP 21 /* This task is uprobe single stepped */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Jiri Slaby30d64f12017-02-13 19:42:33 -060079/* _TIF_TRACE bits */
80#define TIF_SYSCALL_TRACE 24 /* syscall trace active */
81#define TIF_SYSCALL_AUDIT 25 /* syscall auditing active */
82#define TIF_SECCOMP 26 /* secure computing */
83#define TIF_SYSCALL_TRACEPOINT 27 /* syscall tracepoint instrumentation */
84
Heiko Carstens92778b92015-10-06 16:23:39 +020085#define _TIF_NOTIFY_RESUME _BITUL(TIF_NOTIFY_RESUME)
86#define _TIF_SIGPENDING _BITUL(TIF_SIGPENDING)
87#define _TIF_NEED_RESCHED _BITUL(TIF_NEED_RESCHED)
Jiri Slaby30d64f12017-02-13 19:42:33 -060088#define _TIF_UPROBE _BITUL(TIF_UPROBE)
Linus Torvalds76f19482017-05-02 18:24:16 -070089#define _TIF_GUARDED_STORAGE _BITUL(TIF_GUARDED_STORAGE)
Miroslav Benes2f09ca62017-02-13 19:42:34 -060090#define _TIF_PATCH_PENDING _BITUL(TIF_PATCH_PENDING)
Martin Schwidefsky6b730442018-01-16 07:36:46 +010091#define _TIF_ISOLATE_BP _BITUL(TIF_ISOLATE_BP)
92#define _TIF_ISOLATE_BP_GUEST _BITUL(TIF_ISOLATE_BP_GUEST)
Jiri Slaby30d64f12017-02-13 19:42:33 -060093
94#define _TIF_31BIT _BITUL(TIF_31BIT)
95#define _TIF_SINGLE_STEP _BITUL(TIF_SINGLE_STEP)
96
Heiko Carstens92778b92015-10-06 16:23:39 +020097#define _TIF_SYSCALL_TRACE _BITUL(TIF_SYSCALL_TRACE)
98#define _TIF_SYSCALL_AUDIT _BITUL(TIF_SYSCALL_AUDIT)
99#define _TIF_SECCOMP _BITUL(TIF_SECCOMP)
100#define _TIF_SYSCALL_TRACEPOINT _BITUL(TIF_SYSCALL_TRACEPOINT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#endif /* _ASM_THREAD_INFO_H */