| .. | .. |
|---|
| 12 | 12 | #ifndef __ASM_S390_PROCESSOR_H |
|---|
| 13 | 13 | #define __ASM_S390_PROCESSOR_H |
|---|
| 14 | 14 | |
|---|
| 15 | | -#include <linux/const.h> |
|---|
| 15 | +#include <linux/bits.h> |
|---|
| 16 | 16 | |
|---|
| 17 | | -#define CIF_MCCK_PENDING 0 /* machine check handling is pending */ |
|---|
| 18 | | -#define CIF_ASCE_PRIMARY 1 /* primary asce needs fixup / uaccess */ |
|---|
| 19 | | -#define CIF_ASCE_SECONDARY 2 /* secondary asce needs fixup / uaccess */ |
|---|
| 20 | | -#define CIF_NOHZ_DELAY 3 /* delay HZ disable for a tick */ |
|---|
| 21 | | -#define CIF_FPU 4 /* restore FPU registers */ |
|---|
| 22 | | -#define CIF_IGNORE_IRQ 5 /* ignore interrupt (for udelay) */ |
|---|
| 23 | | -#define CIF_ENABLED_WAIT 6 /* in enabled wait state */ |
|---|
| 24 | | -#define CIF_MCCK_GUEST 7 /* machine check happening in guest */ |
|---|
| 25 | | -#define CIF_DEDICATED_CPU 8 /* this CPU is dedicated */ |
|---|
| 17 | +#define CIF_ASCE_PRIMARY 0 /* primary asce needs fixup / uaccess */ |
|---|
| 18 | +#define CIF_ASCE_SECONDARY 1 /* secondary asce needs fixup / uaccess */ |
|---|
| 19 | +#define CIF_NOHZ_DELAY 2 /* delay HZ disable for a tick */ |
|---|
| 20 | +#define CIF_FPU 3 /* restore FPU registers */ |
|---|
| 21 | +#define CIF_IGNORE_IRQ 4 /* ignore interrupt (for udelay) */ |
|---|
| 22 | +#define CIF_ENABLED_WAIT 5 /* in enabled wait state */ |
|---|
| 23 | +#define CIF_MCCK_GUEST 6 /* machine check happening in guest */ |
|---|
| 24 | +#define CIF_DEDICATED_CPU 7 /* this CPU is dedicated */ |
|---|
| 26 | 25 | |
|---|
| 27 | | -#define _CIF_MCCK_PENDING _BITUL(CIF_MCCK_PENDING) |
|---|
| 28 | | -#define _CIF_ASCE_PRIMARY _BITUL(CIF_ASCE_PRIMARY) |
|---|
| 29 | | -#define _CIF_ASCE_SECONDARY _BITUL(CIF_ASCE_SECONDARY) |
|---|
| 30 | | -#define _CIF_NOHZ_DELAY _BITUL(CIF_NOHZ_DELAY) |
|---|
| 31 | | -#define _CIF_FPU _BITUL(CIF_FPU) |
|---|
| 32 | | -#define _CIF_IGNORE_IRQ _BITUL(CIF_IGNORE_IRQ) |
|---|
| 33 | | -#define _CIF_ENABLED_WAIT _BITUL(CIF_ENABLED_WAIT) |
|---|
| 34 | | -#define _CIF_MCCK_GUEST _BITUL(CIF_MCCK_GUEST) |
|---|
| 35 | | -#define _CIF_DEDICATED_CPU _BITUL(CIF_DEDICATED_CPU) |
|---|
| 26 | +#define _CIF_ASCE_PRIMARY BIT(CIF_ASCE_PRIMARY) |
|---|
| 27 | +#define _CIF_ASCE_SECONDARY BIT(CIF_ASCE_SECONDARY) |
|---|
| 28 | +#define _CIF_NOHZ_DELAY BIT(CIF_NOHZ_DELAY) |
|---|
| 29 | +#define _CIF_FPU BIT(CIF_FPU) |
|---|
| 30 | +#define _CIF_IGNORE_IRQ BIT(CIF_IGNORE_IRQ) |
|---|
| 31 | +#define _CIF_ENABLED_WAIT BIT(CIF_ENABLED_WAIT) |
|---|
| 32 | +#define _CIF_MCCK_GUEST BIT(CIF_MCCK_GUEST) |
|---|
| 33 | +#define _CIF_DEDICATED_CPU BIT(CIF_DEDICATED_CPU) |
|---|
| 36 | 34 | |
|---|
| 37 | 35 | #ifndef __ASSEMBLY__ |
|---|
| 38 | 36 | |
|---|
| 37 | +#include <linux/cpumask.h> |
|---|
| 39 | 38 | #include <linux/linkage.h> |
|---|
| 40 | 39 | #include <linux/irqflags.h> |
|---|
| 41 | 40 | #include <asm/cpu.h> |
|---|
| .. | .. |
|---|
| 73 | 72 | |
|---|
| 74 | 73 | #define arch_needs_cpu() test_cpu_flag(CIF_NOHZ_DELAY) |
|---|
| 75 | 74 | |
|---|
| 76 | | -/* |
|---|
| 77 | | - * Default implementation of macro that returns current |
|---|
| 78 | | - * instruction pointer ("program counter"). |
|---|
| 79 | | - */ |
|---|
| 80 | | -#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) |
|---|
| 81 | | - |
|---|
| 82 | 75 | static inline void get_cpu_id(struct cpuid *ptr) |
|---|
| 83 | 76 | { |
|---|
| 84 | 77 | asm volatile("stidp %0" : "=Q" (*ptr)); |
|---|
| .. | .. |
|---|
| 89 | 82 | void cpu_detect_mhz_feature(void); |
|---|
| 90 | 83 | |
|---|
| 91 | 84 | extern const struct seq_operations cpuinfo_op; |
|---|
| 92 | | -extern int sysctl_ieee_emulation_warnings; |
|---|
| 93 | 85 | extern void execve_tail(void); |
|---|
| 94 | 86 | extern void __bpon(void); |
|---|
| 95 | 87 | |
|---|
| .. | .. |
|---|
| 98 | 90 | */ |
|---|
| 99 | 91 | |
|---|
| 100 | 92 | #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? \ |
|---|
| 101 | | - (1UL << 31) : -PAGE_SIZE) |
|---|
| 93 | + _REGION3_SIZE : TASK_SIZE_MAX) |
|---|
| 102 | 94 | #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \ |
|---|
| 103 | | - (1UL << 30) : (1UL << 41)) |
|---|
| 95 | + (_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1)) |
|---|
| 104 | 96 | #define TASK_SIZE TASK_SIZE_OF(current) |
|---|
| 105 | 97 | #define TASK_SIZE_MAX (-PAGE_SIZE) |
|---|
| 106 | 98 | |
|---|
| 107 | 99 | #define STACK_TOP (test_thread_flag(TIF_31BIT) ? \ |
|---|
| 108 | | - (1UL << 31) : (1UL << 42)) |
|---|
| 109 | | -#define STACK_TOP_MAX (1UL << 42) |
|---|
| 100 | + _REGION3_SIZE : _REGION2_SIZE) |
|---|
| 101 | +#define STACK_TOP_MAX _REGION2_SIZE |
|---|
| 110 | 102 | |
|---|
| 111 | 103 | #define HAVE_ARCH_PICK_MMAP_LAYOUT |
|---|
| 112 | 104 | |
|---|
| .. | .. |
|---|
| 162 | 154 | |
|---|
| 163 | 155 | typedef struct thread_struct thread_struct; |
|---|
| 164 | 156 | |
|---|
| 165 | | -/* |
|---|
| 166 | | - * Stack layout of a C stack frame. |
|---|
| 167 | | - */ |
|---|
| 168 | | -#ifndef __PACK_STACK |
|---|
| 169 | | -struct stack_frame { |
|---|
| 170 | | - unsigned long back_chain; |
|---|
| 171 | | - unsigned long empty1[5]; |
|---|
| 172 | | - unsigned long gprs[10]; |
|---|
| 173 | | - unsigned int empty2[8]; |
|---|
| 174 | | -}; |
|---|
| 175 | | -#else |
|---|
| 176 | | -struct stack_frame { |
|---|
| 177 | | - unsigned long empty1[5]; |
|---|
| 178 | | - unsigned int empty2[8]; |
|---|
| 179 | | - unsigned long gprs[10]; |
|---|
| 180 | | - unsigned long back_chain; |
|---|
| 181 | | -}; |
|---|
| 182 | | -#endif |
|---|
| 183 | | - |
|---|
| 184 | 157 | #define ARCH_MIN_TASKALIGN 8 |
|---|
| 185 | 158 | |
|---|
| 186 | 159 | #define INIT_THREAD { \ |
|---|
| 187 | 160 | .ksp = sizeof(init_stack) + (unsigned long) &init_stack, \ |
|---|
| 188 | 161 | .fpu.regs = (void *) init_task.thread.fpu.fprs, \ |
|---|
| 162 | + .last_break = 1, \ |
|---|
| 189 | 163 | } |
|---|
| 190 | 164 | |
|---|
| 191 | 165 | /* |
|---|
| .. | .. |
|---|
| 202 | 176 | regs->psw.mask = PSW_USER_BITS | PSW_MASK_BA; \ |
|---|
| 203 | 177 | regs->psw.addr = new_psw; \ |
|---|
| 204 | 178 | regs->gprs[15] = new_stackp; \ |
|---|
| 205 | | - crst_table_downgrade(current->mm); \ |
|---|
| 206 | 179 | execve_tail(); \ |
|---|
| 207 | 180 | } while (0) |
|---|
| 208 | 181 | |
|---|
| .. | .. |
|---|
| 212 | 185 | struct seq_file; |
|---|
| 213 | 186 | struct pt_regs; |
|---|
| 214 | 187 | |
|---|
| 215 | | -typedef int (*dump_trace_func_t)(void *data, unsigned long address, int reliable); |
|---|
| 216 | | -void dump_trace(dump_trace_func_t func, void *data, |
|---|
| 217 | | - struct task_struct *task, unsigned long sp); |
|---|
| 218 | 188 | void show_registers(struct pt_regs *regs); |
|---|
| 219 | | - |
|---|
| 220 | 189 | void show_cacheinfo(struct seq_file *m); |
|---|
| 221 | 190 | |
|---|
| 222 | 191 | /* Free all resources held by a thread. */ |
|---|
| .. | .. |
|---|
| 234 | 203 | /* Has task runtime instrumentation enabled ? */ |
|---|
| 235 | 204 | #define is_ri_task(tsk) (!!(tsk)->thread.ri_cb) |
|---|
| 236 | 205 | |
|---|
| 237 | | -static inline unsigned long current_stack_pointer(void) |
|---|
| 206 | +static __always_inline unsigned long current_stack_pointer(void) |
|---|
| 238 | 207 | { |
|---|
| 239 | 208 | unsigned long sp; |
|---|
| 240 | 209 | |
|---|
| .. | .. |
|---|
| 242 | 211 | return sp; |
|---|
| 243 | 212 | } |
|---|
| 244 | 213 | |
|---|
| 245 | | -static inline unsigned short stap(void) |
|---|
| 214 | +static __always_inline unsigned short stap(void) |
|---|
| 246 | 215 | { |
|---|
| 247 | 216 | unsigned short cpu_address; |
|---|
| 248 | 217 | |
|---|
| 249 | 218 | asm volatile("stap %0" : "=Q" (cpu_address)); |
|---|
| 250 | 219 | return cpu_address; |
|---|
| 251 | 220 | } |
|---|
| 252 | | - |
|---|
| 253 | | -/* |
|---|
| 254 | | - * Give up the time slice of the virtual PU. |
|---|
| 255 | | - */ |
|---|
| 256 | | -#define cpu_relax_yield cpu_relax_yield |
|---|
| 257 | | -void cpu_relax_yield(void); |
|---|
| 258 | 221 | |
|---|
| 259 | 222 | #define cpu_relax() barrier() |
|---|
| 260 | 223 | |
|---|
| .. | .. |
|---|
| 287 | 250 | * Set PSW mask to specified value, while leaving the |
|---|
| 288 | 251 | * PSW addr pointing to the next instruction. |
|---|
| 289 | 252 | */ |
|---|
| 290 | | -static inline void __load_psw_mask(unsigned long mask) |
|---|
| 253 | +static __always_inline void __load_psw_mask(unsigned long mask) |
|---|
| 291 | 254 | { |
|---|
| 292 | 255 | unsigned long addr; |
|---|
| 293 | 256 | psw_t psw; |
|---|
| .. | .. |
|---|
| 296 | 259 | |
|---|
| 297 | 260 | asm volatile( |
|---|
| 298 | 261 | " larl %0,1f\n" |
|---|
| 299 | | - " stg %0,%O1+8(%R1)\n" |
|---|
| 300 | | - " lpswe %1\n" |
|---|
| 262 | + " stg %0,%1\n" |
|---|
| 263 | + " lpswe %2\n" |
|---|
| 301 | 264 | "1:" |
|---|
| 302 | | - : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc"); |
|---|
| 265 | + : "=&d" (addr), "=Q" (psw.addr) : "Q" (psw) : "memory", "cc"); |
|---|
| 303 | 266 | } |
|---|
| 304 | 267 | |
|---|
| 305 | 268 | /* |
|---|
| .. | .. |
|---|
| 344 | 307 | /* |
|---|
| 345 | 308 | * Function to drop a processor into disabled wait state |
|---|
| 346 | 309 | */ |
|---|
| 347 | | -static inline void __noreturn disabled_wait(unsigned long code) |
|---|
| 310 | +static __always_inline void __noreturn disabled_wait(void) |
|---|
| 348 | 311 | { |
|---|
| 349 | 312 | psw_t psw; |
|---|
| 350 | 313 | |
|---|
| 351 | 314 | psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA; |
|---|
| 352 | | - psw.addr = code; |
|---|
| 315 | + psw.addr = _THIS_IP_; |
|---|
| 353 | 316 | __load_psw(psw); |
|---|
| 354 | 317 | while (1); |
|---|
| 355 | 318 | } |
|---|
| .. | .. |
|---|
| 358 | 321 | * Basic Machine Check/Program Check Handler. |
|---|
| 359 | 322 | */ |
|---|
| 360 | 323 | |
|---|
| 361 | | -extern void s390_base_mcck_handler(void); |
|---|
| 362 | 324 | extern void s390_base_pgm_handler(void); |
|---|
| 363 | 325 | extern void s390_base_ext_handler(void); |
|---|
| 364 | 326 | |
|---|
| 365 | | -extern void (*s390_base_mcck_handler_fn)(void); |
|---|
| 366 | 327 | extern void (*s390_base_pgm_handler_fn)(void); |
|---|
| 367 | 328 | extern void (*s390_base_ext_handler_fn)(void); |
|---|
| 368 | 329 | |
|---|