]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/powerpc/include/asm/thread_info.h
powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU
[mirror_ubuntu-jammy-kernel.git] / arch / powerpc / include / asm / thread_info.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
6cb7bfeb 2/* thread_info.h: PowerPC low-level thread information
1da177e4
LT
3 * adapted from the i386 version by Paul Mackerras
4 *
5 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
6 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
7 */
8
6cb7bfeb
DG
9#ifndef _ASM_POWERPC_THREAD_INFO_H
10#define _ASM_POWERPC_THREAD_INFO_H
1da177e4 11
ec0c464c
CL
12#include <asm/asm-const.h>
13
1da177e4
LT
14#ifdef __KERNEL__
15
47613407 16#define THREAD_SHIFT CONFIG_THREAD_SHIFT
6cb7bfeb
DG
17
18#define THREAD_SIZE (1 << THREAD_SHIFT)
19
9778b696 20#ifdef CONFIG_PPC64
ed1cd6de 21#define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(ld dest, PACACURRENT(r13))
9778b696
SY
22#endif
23
1da177e4 24#ifndef __ASSEMBLY__
1da177e4
LT
25#include <linux/cache.h>
26#include <asm/processor.h>
27#include <asm/page.h>
c223c903 28#include <asm/accounting.h>
1da177e4 29
5434ae74 30#define SLB_PRELOAD_NR 16U
1da177e4
LT
31/*
32 * low level task data.
33 */
34struct thread_info {
6cb7bfeb
DG
35 int preempt_count; /* 0 => preemptable,
36 <0 => BUG */
f39224a8 37 unsigned long local_flags; /* private flags for thread */
5d31a96e
ME
38#ifdef CONFIG_LIVEPATCH
39 unsigned long *livepatch_sp;
c223c903
CL
40#endif
41#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(CONFIG_PPC32)
42 struct cpu_accounting_data accounting;
5d31a96e 43#endif
5434ae74
NP
44 unsigned char slb_preload_nr;
45 unsigned char slb_preload_tail;
46 u32 slb_preload_esid[SLB_PRELOAD_NR];
47
1da177e4
LT
48 /* low level flags - has atomic operations done on it */
49 unsigned long flags ____cacheline_aligned_in_smp;
50};
51
52/*
53 * macros/functions for gaining access to the thread information structure
1da177e4
LT
54 */
55#define INIT_THREAD_INFO(tsk) \
56{ \
c99e6efe 57 .preempt_count = INIT_PREEMPT_COUNT, \
1da177e4
LT
58 .flags = 0, \
59}
60
b69c49b7 61#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
328985b2 62
1da177e4 63/* how to get the thread information struct from C */
fd70d9f9 64extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
425d3314
NP
65
66#ifdef CONFIG_PPC_BOOK3S_64
67void arch_setup_new_exec(void);
68#define arch_setup_new_exec arch_setup_new_exec
69#endif
70
1da177e4
LT
71#endif /* __ASSEMBLY__ */
72
1da177e4
LT
73/*
74 * thread information flag bit numbers
75 */
76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
a583f1b5
SE
77#define TIF_SIGPENDING 1 /* signal pending */
78#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
3e378680 79#define TIF_FSCHECK 3 /* Check FS is USER_DS on return */
5521eb4b 80#define TIF_SYSCALL_EMU 4 /* syscall emulation active */
d31626f7 81#define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */
a768f784 82#define TIF_PATCH_PENDING 6 /* pending live patching update */
a583f1b5
SE
83#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
84#define TIF_SINGLESTEP 8 /* singlestepping active */
22ecbe8d 85#define TIF_NOHZ 9 /* in adaptive nohz mode */
a583f1b5
SE
86#define TIF_SECCOMP 10 /* secure computing */
87#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
88#define TIF_NOERROR 12 /* Force successful syscall return */
7d6d637d 89#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
8b7b80b9 90#define TIF_UPROBE 14 /* breakpointed or single-stepping */
02424d89 91#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
f0d1128f
TC
92#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
93 for stack store? */
22ecbe8d 94#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
373c76d6
RR
95#if defined(CONFIG_PPC64)
96#define TIF_ELF2ABI 18 /* function descriptors must die! */
97#endif
3e378680 98#define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */
16d7c69c 99#define TIF_32BIT 20 /* 32 bit binary */
1da177e4
LT
100
101/* as above, but as bit values */
102#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
1da177e4
LT
103#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
104#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
105#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
106#define _TIF_32BIT (1<<TIF_32BIT)
d31626f7 107#define _TIF_RESTORE_TM (1<<TIF_RESTORE_TM)
a768f784 108#define _TIF_PATCH_PENDING (1<<TIF_PATCH_PENDING)
1da177e4
LT
109#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
110#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
111#define _TIF_SECCOMP (1<<TIF_SECCOMP)
401d1f02 112#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
401d1f02 113#define _TIF_NOERROR (1<<TIF_NOERROR)
7d6d637d 114#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
8b7b80b9 115#define _TIF_UPROBE (1<<TIF_UPROBE)
02424d89 116#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
f0d1128f 117#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
22ecbe8d 118#define _TIF_NOHZ (1<<TIF_NOHZ)
3e378680 119#define _TIF_FSCHECK (1<<TIF_FSCHECK)
5521eb4b 120#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
10ea8343 121#define _TIF_SYSCALL_DOTRACE (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
22ecbe8d 122 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
5521eb4b 123 _TIF_NOHZ | _TIF_SYSCALL_EMU)
1da177e4 124
7d6d637d 125#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
d31626f7 126 _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
3e378680
ME
127 _TIF_RESTORE_TM | _TIF_PATCH_PENDING | \
128 _TIF_FSCHECK)
1bd79336 129#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
1da177e4 130
f39224a8
PM
131/* Bits in local_flags */
132/* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
133#define TLF_NAPPING 0 /* idle thread enabled NAP mode */
a560643e 134#define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */
d6bf29b4 135#define TLF_LAZY_MMU 3 /* tlb_batch is active */
fe1952fc 136#define TLF_RUNLATCH 4 /* Is the runlatch enabled? */
f39224a8
PM
137
138#define _TLF_NAPPING (1 << TLF_NAPPING)
a560643e 139#define _TLF_SLEEPING (1 << TLF_SLEEPING)
d6bf29b4 140#define _TLF_LAZY_MMU (1 << TLF_LAZY_MMU)
fe1952fc 141#define _TLF_RUNLATCH (1 << TLF_RUNLATCH)
7a10174e
RM
142
143#ifndef __ASSEMBLY__
a465f9b6 144
fe1952fc
BH
145static inline bool test_thread_local_flags(unsigned int flags)
146{
147 struct thread_info *ti = current_thread_info();
148 return (ti->local_flags & flags) != 0;
149}
150
a465f9b6
AB
151#ifdef CONFIG_PPC64
152#define is_32bit_task() (test_thread_flag(TIF_32BIT))
153#else
154#define is_32bit_task() (1)
155#endif
156
373c76d6
RR
157#if defined(CONFIG_PPC64)
158#define is_elf2_task() (test_thread_flag(TIF_ELF2ABI))
159#else
160#define is_elf2_task() (0)
161#endif
162
7a10174e 163#endif /* !__ASSEMBLY__ */
f39224a8 164
1da177e4
LT
165#endif /* __KERNEL__ */
166
6cb7bfeb 167#endif /* _ASM_POWERPC_THREAD_INFO_H */