0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _ASM_POWERPC_PACA_H
0010 #define _ASM_POWERPC_PACA_H
0011 #ifdef __KERNEL__
0012
0013 #ifdef CONFIG_PPC64
0014
0015 #include <linux/cache.h>
0016 #include <linux/string.h>
0017 #include <asm/types.h>
0018 #include <asm/lppaca.h>
0019 #include <asm/mmu.h>
0020 #include <asm/page.h>
0021 #ifdef CONFIG_PPC_BOOK3E
0022 #include <asm/exception-64e.h>
0023 #else
0024 #include <asm/exception-64s.h>
0025 #endif
0026 #ifdef CONFIG_KVM_BOOK3S_64_HANDLER
0027 #include <asm/kvm_book3s_asm.h>
0028 #endif
0029 #include <asm/accounting.h>
0030 #include <asm/hmi.h>
0031 #include <asm/cpuidle.h>
0032 #include <asm/atomic.h>
0033 #include <asm/mce.h>
0034
0035 #include <asm-generic/mmiowb_types.h>
0036
0037 register struct paca_struct *local_paca asm("r13");
0038
0039 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
0040 extern unsigned int debug_smp_processor_id(void);
0041
0042
0043
0044
0045 #define get_paca() ((void) debug_smp_processor_id(), local_paca)
0046 #else
0047 #define get_paca() local_paca
0048 #endif
0049
0050 #ifdef CONFIG_PPC_PSERIES
0051 #define get_lppaca() (get_paca()->lppaca_ptr)
0052 #endif
0053
0054 #define get_slb_shadow() (get_paca()->slb_shadow_ptr)
0055
0056 struct task_struct;
0057 struct rtas_args;
0058
0059
0060
0061
0062
0063
0064
0065 struct paca_struct {
0066 #ifdef CONFIG_PPC_PSERIES
0067
0068
0069
0070
0071
0072
0073
0074 struct lppaca *lppaca_ptr;
0075 #endif
0076
0077
0078
0079
0080
0081
0082
0083 #ifdef __BIG_ENDIAN__
0084 u16 lock_token;
0085 u16 paca_index;
0086 #else
0087 u16 paca_index;
0088 u16 lock_token;
0089 #endif
0090
0091 u64 kernel_toc;
0092 u64 kernelbase;
0093 u64 kernel_msr;
0094 void *emergency_sp;
0095 u64 data_offset;
0096 s16 hw_cpu_id;
0097 u8 cpu_start;
0098
0099 u8 kexec_state;
0100 #ifdef CONFIG_PPC_BOOK3S_64
0101 #ifdef CONFIG_PPC_64S_HASH_MMU
0102 struct slb_shadow *slb_shadow_ptr;
0103 #endif
0104 struct dtl_entry *dispatch_log;
0105 struct dtl_entry *dispatch_log_end;
0106 #endif
0107 u64 dscr_default;
0108
0109 #ifdef CONFIG_PPC_BOOK3S_64
0110
0111
0112
0113
0114 u64 exgen[EX_SIZE] __attribute__((aligned(0x80)));
0115
0116 #ifdef CONFIG_PPC_64S_HASH_MMU
0117
0118 u16 vmalloc_sllp;
0119 u8 slb_cache_ptr;
0120 u8 stab_rr;
0121 #ifdef CONFIG_DEBUG_VM
0122 u8 in_kernel_slb_handler;
0123 #endif
0124 u32 slb_used_bitmap;
0125 u32 slb_kern_bitmap;
0126 u32 slb_cache[SLB_CACHE_ENTRIES];
0127 #endif
0128 #endif
0129
0130 #ifdef CONFIG_PPC_BOOK3E
0131 u64 exgen[8] __aligned(0x40);
0132
0133 pgd_t *pgd __aligned(0x40);
0134 pgd_t *kernel_pgd;
0135
0136
0137 struct tlb_core_data *tcd_ptr;
0138
0139
0140
0141
0142
0143 u64 extlb[12][EX_TLB_SIZE / sizeof(u64)];
0144 u64 exmc[8];
0145 u64 excrit[8];
0146 u64 exdbg[8];
0147
0148
0149 void *mc_kstack;
0150 void *crit_kstack;
0151 void *dbg_kstack;
0152
0153 struct tlb_core_data tcd;
0154 #endif
0155
0156 #ifdef CONFIG_PPC_64S_HASH_MMU
0157 unsigned char mm_ctx_low_slices_psize[BITS_PER_LONG / BITS_PER_BYTE];
0158 unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE];
0159 #endif
0160
0161
0162
0163
0164 struct task_struct *__current;
0165 u64 kstack;
0166 u64 saved_r1;
0167 u64 saved_msr;
0168 #ifdef CONFIG_PPC64
0169 u64 exit_save_r1;
0170 #endif
0171 #ifdef CONFIG_PPC_BOOK3E
0172 u16 trap_save;
0173 #endif
0174 #ifdef CONFIG_PPC_BOOK3S_64
0175 u8 hsrr_valid;
0176 u8 srr_valid;
0177 #endif
0178 u8 irq_soft_mask;
0179 u8 irq_happened;
0180 u8 irq_work_pending;
0181 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
0182 u8 pmcregs_in_use;
0183 #endif
0184 u64 sprg_vdso;
0185 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
0186 u64 tm_scratch;
0187 #endif
0188
0189 #ifdef CONFIG_PPC_POWERNV
0190
0191
0192 unsigned long idle_state;
0193 union {
0194
0195 struct {
0196
0197 u8 thread_idle_state;
0198
0199 u8 subcore_sibling_mask;
0200 };
0201
0202
0203 struct {
0204 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
0205
0206 u64 requested_psscr;
0207
0208 atomic_t dont_stop;
0209 #endif
0210 };
0211 };
0212 #endif
0213
0214 #ifdef CONFIG_PPC_BOOK3S_64
0215
0216 u64 exnmi[EX_SIZE];
0217 u64 exmc[EX_SIZE];
0218 #endif
0219 #ifdef CONFIG_PPC_BOOK3S_64
0220
0221 void *nmi_emergency_sp;
0222 void *mc_emergency_sp;
0223
0224 u16 in_nmi;
0225
0226
0227
0228
0229
0230 u16 in_mce;
0231 u8 hmi_event_available;
0232 u8 hmi_p9_special_emu;
0233 u32 hmi_irqs;
0234 #endif
0235 u8 ftrace_enabled;
0236
0237
0238 struct cpu_accounting_data accounting;
0239 u64 dtl_ridx;
0240 struct dtl_entry *dtl_curr;
0241
0242 #ifdef CONFIG_KVM_BOOK3S_HANDLER
0243 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
0244
0245 struct kvmppc_book3s_shadow_vcpu shadow_vcpu;
0246 #endif
0247 struct kvmppc_host_state kvm_hstate;
0248 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
0249
0250
0251
0252
0253 struct sibling_subcore_state *sibling_subcore_state;
0254 #endif
0255 #endif
0256 #ifdef CONFIG_PPC_BOOK3S_64
0257
0258
0259
0260
0261 u64 exrfi[EX_SIZE] __aligned(0x80);
0262 void *rfi_flush_fallback_area;
0263 u64 l1d_flush_size;
0264 #endif
0265 #ifdef CONFIG_PPC_PSERIES
0266 struct rtas_args *rtas_args_reentrant;
0267 u8 *mce_data_buf;
0268 #endif
0269
0270 #ifdef CONFIG_PPC_BOOK3S_64
0271 #ifdef CONFIG_PPC_64S_HASH_MMU
0272
0273 struct slb_entry *mce_faulty_slbs;
0274 u16 slb_save_cache_ptr;
0275 #endif
0276 #endif
0277 #ifdef CONFIG_STACKPROTECTOR
0278 unsigned long canary;
0279 #endif
0280 #ifdef CONFIG_MMIOWB
0281 struct mmiowb_state mmiowb_state;
0282 #endif
0283 #ifdef CONFIG_PPC_BOOK3S_64
0284 struct mce_info *mce_info;
0285 u8 mce_pending_irq_work;
0286 #endif
0287 } ____cacheline_aligned;
0288
0289 extern void copy_mm_to_paca(struct mm_struct *mm);
0290 extern struct paca_struct **paca_ptrs;
0291 extern void initialise_paca(struct paca_struct *new_paca, int cpu);
0292 extern void setup_paca(struct paca_struct *new_paca);
0293 extern void allocate_paca_ptrs(void);
0294 extern void allocate_paca(int cpu);
0295 extern void free_unused_pacas(void);
0296
0297 #else
0298
0299 static inline void allocate_paca_ptrs(void) { }
0300 static inline void allocate_paca(int cpu) { }
0301 static inline void free_unused_pacas(void) { }
0302
0303 #endif
0304
0305 #endif
0306 #endif