18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  S390 version
48c2ecf20Sopenharmony_ci *    Copyright IBM Corp. 2002, 2006
58c2ecf20Sopenharmony_ci *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _ASM_THREAD_INFO_H
98c2ecf20Sopenharmony_ci#define _ASM_THREAD_INFO_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/bits.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * General size of kernel stacks
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci#ifdef CONFIG_KASAN
178c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER 4
188c2ecf20Sopenharmony_ci#else
198c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER 2
208c2ecf20Sopenharmony_ci#endif
218c2ecf20Sopenharmony_ci#define BOOT_STACK_ORDER  2
228c2ecf20Sopenharmony_ci#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
258c2ecf20Sopenharmony_ci#include <asm/lowcore.h>
268c2ecf20Sopenharmony_ci#include <asm/page.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define STACK_INIT_OFFSET \
298c2ecf20Sopenharmony_ci	(THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs))
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * low level task data that entry.S needs immediate access to
338c2ecf20Sopenharmony_ci * - this struct should fit entirely inside of one cache line
348c2ecf20Sopenharmony_ci * - this struct shares the supervisor stack pages
358c2ecf20Sopenharmony_ci * - if the contents of this structure are changed, the assembly constants must also be changed
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cistruct thread_info {
388c2ecf20Sopenharmony_ci	unsigned long		flags;		/* low level flags */
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * macros/functions for gaining access to the thread information structure
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci#define INIT_THREAD_INFO(tsk)			\
458c2ecf20Sopenharmony_ci{						\
468c2ecf20Sopenharmony_ci	.flags		= 0,			\
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_civoid arch_release_task_struct(struct task_struct *tsk);
508c2ecf20Sopenharmony_ciint arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_civoid arch_setup_new_exec(void);
538c2ecf20Sopenharmony_ci#define arch_setup_new_exec arch_setup_new_exec
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/*
588c2ecf20Sopenharmony_ci * thread information flags bit numbers
598c2ecf20Sopenharmony_ci */
608c2ecf20Sopenharmony_ci/* _TIF_WORK bits */
618c2ecf20Sopenharmony_ci#define TIF_NOTIFY_RESUME	0	/* callback before returning to user */
628c2ecf20Sopenharmony_ci#define TIF_SIGPENDING		1	/* signal pending */
638c2ecf20Sopenharmony_ci#define TIF_NEED_RESCHED	2	/* rescheduling necessary */
648c2ecf20Sopenharmony_ci#define TIF_UPROBE		3	/* breakpointed or single-stepping */
658c2ecf20Sopenharmony_ci#define TIF_GUARDED_STORAGE	4	/* load guarded storage control block */
668c2ecf20Sopenharmony_ci#define TIF_PATCH_PENDING	5	/* pending live patching update */
678c2ecf20Sopenharmony_ci#define TIF_PGSTE		6	/* New mm's will use 4K page tables */
688c2ecf20Sopenharmony_ci#define TIF_NOTIFY_SIGNAL	7	/* signal notifications exist */
698c2ecf20Sopenharmony_ci#define TIF_ISOLATE_BP		8	/* Run process with isolated BP */
708c2ecf20Sopenharmony_ci#define TIF_ISOLATE_BP_GUEST	9	/* Run KVM guests with isolated BP */
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define TIF_31BIT		16	/* 32bit process */
738c2ecf20Sopenharmony_ci#define TIF_MEMDIE		17	/* is terminating due to OOM killer */
748c2ecf20Sopenharmony_ci#define TIF_RESTORE_SIGMASK	18	/* restore signal mask in do_signal() */
758c2ecf20Sopenharmony_ci#define TIF_SINGLE_STEP		19	/* This task is single stepped */
768c2ecf20Sopenharmony_ci#define TIF_BLOCK_STEP		20	/* This task is block stepped */
778c2ecf20Sopenharmony_ci#define TIF_UPROBE_SINGLESTEP	21	/* This task is uprobe single stepped */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* _TIF_TRACE bits */
808c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACE	24	/* syscall trace active */
818c2ecf20Sopenharmony_ci#define TIF_SYSCALL_AUDIT	25	/* syscall auditing active */
828c2ecf20Sopenharmony_ci#define TIF_SECCOMP		26	/* secure computing */
838c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACEPOINT	27	/* syscall tracepoint instrumentation */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_RESUME	BIT(TIF_NOTIFY_RESUME)
868c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL	BIT(TIF_NOTIFY_SIGNAL)
878c2ecf20Sopenharmony_ci#define _TIF_SIGPENDING		BIT(TIF_SIGPENDING)
888c2ecf20Sopenharmony_ci#define _TIF_NEED_RESCHED	BIT(TIF_NEED_RESCHED)
898c2ecf20Sopenharmony_ci#define _TIF_UPROBE		BIT(TIF_UPROBE)
908c2ecf20Sopenharmony_ci#define _TIF_GUARDED_STORAGE	BIT(TIF_GUARDED_STORAGE)
918c2ecf20Sopenharmony_ci#define _TIF_PATCH_PENDING	BIT(TIF_PATCH_PENDING)
928c2ecf20Sopenharmony_ci#define _TIF_ISOLATE_BP		BIT(TIF_ISOLATE_BP)
938c2ecf20Sopenharmony_ci#define _TIF_ISOLATE_BP_GUEST	BIT(TIF_ISOLATE_BP_GUEST)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#define _TIF_31BIT		BIT(TIF_31BIT)
968c2ecf20Sopenharmony_ci#define _TIF_SINGLE_STEP	BIT(TIF_SINGLE_STEP)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE	BIT(TIF_SYSCALL_TRACE)
998c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_AUDIT	BIT(TIF_SYSCALL_AUDIT)
1008c2ecf20Sopenharmony_ci#define _TIF_SECCOMP		BIT(TIF_SECCOMP)
1018c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACEPOINT	BIT(TIF_SYSCALL_TRACEPOINT)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#endif /* _ASM_THREAD_INFO_H */
104