| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This control block defines the PACA which defines the processor |
|---|
| 3 | 4 | * specific data for each logical processor on the system. |
|---|
| 4 | 5 | * There are some pointers defined that are utilized by PLIC. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * C 2001 PPC 64 Team, IBM Corp |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License |
|---|
| 10 | | - * as published by the Free Software Foundation; either version |
|---|
| 11 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | #ifndef _ASM_POWERPC_PACA_H |
|---|
| 14 | 10 | #define _ASM_POWERPC_PACA_H |
|---|
| .. | .. |
|---|
| 16 | 12 | |
|---|
| 17 | 13 | #ifdef CONFIG_PPC64 |
|---|
| 18 | 14 | |
|---|
| 15 | +#include <linux/cache.h> |
|---|
| 19 | 16 | #include <linux/string.h> |
|---|
| 20 | 17 | #include <asm/types.h> |
|---|
| 21 | | -#include <asm/lppaca.h> |
|---|
| 22 | 18 | #include <asm/mmu.h> |
|---|
| 23 | 19 | #include <asm/page.h> |
|---|
| 24 | 20 | #ifdef CONFIG_PPC_BOOK3E |
|---|
| .. | .. |
|---|
| 34 | 30 | #include <asm/cpuidle.h> |
|---|
| 35 | 31 | #include <asm/atomic.h> |
|---|
| 36 | 32 | |
|---|
| 33 | +#include <asm-generic/mmiowb_types.h> |
|---|
| 34 | + |
|---|
| 37 | 35 | register struct paca_struct *local_paca asm("r13"); |
|---|
| 38 | 36 | |
|---|
| 39 | 37 | #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP) |
|---|
| .. | .. |
|---|
| 47 | 45 | #define get_paca() local_paca |
|---|
| 48 | 46 | #endif |
|---|
| 49 | 47 | |
|---|
| 50 | | -#ifdef CONFIG_PPC_PSERIES |
|---|
| 51 | | -#define get_lppaca() (get_paca()->lppaca_ptr) |
|---|
| 52 | | -#endif |
|---|
| 53 | | - |
|---|
| 54 | 48 | #define get_slb_shadow() (get_paca()->slb_shadow_ptr) |
|---|
| 55 | 49 | |
|---|
| 56 | 50 | struct task_struct; |
|---|
| 51 | +struct rtas_args; |
|---|
| 52 | +struct lppaca; |
|---|
| 57 | 53 | |
|---|
| 58 | 54 | /* |
|---|
| 59 | 55 | * Defines the layout of the paca. |
|---|
| .. | .. |
|---|
| 113 | 109 | * on the linear mapping */ |
|---|
| 114 | 110 | /* SLB related definitions */ |
|---|
| 115 | 111 | u16 vmalloc_sllp; |
|---|
| 116 | | - u16 slb_cache_ptr; |
|---|
| 112 | + u8 slb_cache_ptr; |
|---|
| 113 | + u8 stab_rr; /* stab/slb round-robin counter */ |
|---|
| 114 | +#ifdef CONFIG_DEBUG_VM |
|---|
| 115 | + u8 in_kernel_slb_handler; |
|---|
| 116 | +#endif |
|---|
| 117 | + u32 slb_used_bitmap; /* Bitmaps for first 32 SLB entries. */ |
|---|
| 118 | + u32 slb_kern_bitmap; |
|---|
| 117 | 119 | u32 slb_cache[SLB_CACHE_ENTRIES]; |
|---|
| 118 | 120 | #endif /* CONFIG_PPC_BOOK3S_64 */ |
|---|
| 119 | 121 | |
|---|
| .. | .. |
|---|
| 160 | 162 | */ |
|---|
| 161 | 163 | struct task_struct *__current; /* Pointer to current */ |
|---|
| 162 | 164 | u64 kstack; /* Saved Kernel stack addr */ |
|---|
| 163 | | - u64 stab_rr; /* stab/slb round-robin counter */ |
|---|
| 164 | 165 | u64 saved_r1; /* r1 save for RTAS calls or PM or EE=0 */ |
|---|
| 165 | 166 | u64 saved_msr; /* MSR saved here by enter_rtas */ |
|---|
| 167 | +#ifdef CONFIG_PPC_BOOK3E |
|---|
| 166 | 168 | u16 trap_save; /* Used when bad stack is encountered */ |
|---|
| 169 | +#endif |
|---|
| 167 | 170 | u8 irq_soft_mask; /* mask for irq soft masking */ |
|---|
| 168 | 171 | u8 irq_happened; /* irq happened while soft-disabled */ |
|---|
| 169 | | - u8 io_sync; /* writel() needs spin_unlock sync */ |
|---|
| 170 | 172 | u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ |
|---|
| 171 | | - u8 nap_state_lost; /* NV GPR values lost in power7_idle */ |
|---|
| 172 | 173 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
|---|
| 173 | 174 | u8 pmcregs_in_use; /* pseries puts this in lppaca */ |
|---|
| 174 | 175 | #endif |
|---|
| .. | .. |
|---|
| 178 | 179 | #endif |
|---|
| 179 | 180 | |
|---|
| 180 | 181 | #ifdef CONFIG_PPC_POWERNV |
|---|
| 181 | | - /* Per-core mask tracking idle threads and a lock bit-[L][TTTTTTTT] */ |
|---|
| 182 | | - u32 *core_idle_state_ptr; |
|---|
| 183 | | - u8 thread_idle_state; /* PNV_THREAD_RUNNING/NAP/SLEEP */ |
|---|
| 184 | | - /* Mask to indicate thread id in core */ |
|---|
| 185 | | - u8 thread_mask; |
|---|
| 186 | | - /* Mask to denote subcore sibling threads */ |
|---|
| 187 | | - u8 subcore_sibling_mask; |
|---|
| 188 | | - /* Flag to request this thread not to stop */ |
|---|
| 189 | | - atomic_t dont_stop; |
|---|
| 190 | | - /* The PSSCR value that the kernel requested before going to stop */ |
|---|
| 191 | | - u64 requested_psscr; |
|---|
| 182 | + /* PowerNV idle fields */ |
|---|
| 183 | + /* PNV_CORE_IDLE_* bits, all siblings work on thread 0 paca */ |
|---|
| 184 | + unsigned long idle_state; |
|---|
| 185 | + union { |
|---|
| 186 | + /* P7/P8 specific fields */ |
|---|
| 187 | + struct { |
|---|
| 188 | + /* PNV_THREAD_RUNNING/NAP/SLEEP */ |
|---|
| 189 | + u8 thread_idle_state; |
|---|
| 190 | + /* Mask to denote subcore sibling threads */ |
|---|
| 191 | + u8 subcore_sibling_mask; |
|---|
| 192 | + }; |
|---|
| 192 | 193 | |
|---|
| 193 | | - /* |
|---|
| 194 | | - * Save area for additional SPRs that need to be |
|---|
| 195 | | - * saved/restored during cpuidle stop. |
|---|
| 196 | | - */ |
|---|
| 197 | | - struct stop_sprs stop_sprs; |
|---|
| 194 | + /* P9 specific fields */ |
|---|
| 195 | + struct { |
|---|
| 196 | +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
|---|
| 197 | + /* The PSSCR value that the kernel requested before going to stop */ |
|---|
| 198 | + u64 requested_psscr; |
|---|
| 199 | + /* Flag to request this thread not to stop */ |
|---|
| 200 | + atomic_t dont_stop; |
|---|
| 201 | +#endif |
|---|
| 202 | + }; |
|---|
| 203 | + }; |
|---|
| 198 | 204 | #endif |
|---|
| 199 | 205 | |
|---|
| 200 | 206 | #ifdef CONFIG_PPC_BOOK3S_64 |
|---|
| .. | .. |
|---|
| 216 | 222 | u16 in_mce; |
|---|
| 217 | 223 | u8 hmi_event_available; /* HMI event is available */ |
|---|
| 218 | 224 | u8 hmi_p9_special_emu; /* HMI P9 special emulation */ |
|---|
| 225 | + u32 hmi_irqs; /* HMI irq stat */ |
|---|
| 219 | 226 | #endif |
|---|
| 220 | 227 | u8 ftrace_enabled; /* Hard disable ftrace */ |
|---|
| 221 | 228 | |
|---|
| .. | .. |
|---|
| 248 | 255 | u64 l1d_flush_size; |
|---|
| 249 | 256 | #endif |
|---|
| 250 | 257 | #ifdef CONFIG_PPC_PSERIES |
|---|
| 258 | + struct rtas_args *rtas_args_reentrant; |
|---|
| 251 | 259 | u8 *mce_data_buf; /* buffer to hold per cpu rtas errlog */ |
|---|
| 252 | 260 | #endif /* CONFIG_PPC_PSERIES */ |
|---|
| 261 | + |
|---|
| 262 | +#ifdef CONFIG_PPC_BOOK3S_64 |
|---|
| 263 | + /* Capture SLB related old contents in MCE handler. */ |
|---|
| 264 | + struct slb_entry *mce_faulty_slbs; |
|---|
| 265 | + u16 slb_save_cache_ptr; |
|---|
| 266 | +#endif /* CONFIG_PPC_BOOK3S_64 */ |
|---|
| 267 | +#ifdef CONFIG_STACKPROTECTOR |
|---|
| 268 | + unsigned long canary; |
|---|
| 269 | +#endif |
|---|
| 270 | +#ifdef CONFIG_MMIOWB |
|---|
| 271 | + struct mmiowb_state mmiowb_state; |
|---|
| 272 | +#endif |
|---|
| 253 | 273 | } ____cacheline_aligned; |
|---|
| 254 | 274 | |
|---|
| 255 | 275 | extern void copy_mm_to_paca(struct mm_struct *mm); |
|---|