Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6

* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6: (54 commits)
[S390] Remove error checking from copy_oldmem_page()
[S390] qdio: prevent dsci access without adapter interrupts
[S390] irqstats: split IPI interrupt accounting
[S390] add missing __tlb_flush_global() for !CONFIG_SMP
[S390] sparse: fix sparse symbol shadow warning
[S390] sparse: fix sparse NULL pointer warnings
[S390] sparse: fix sparse warnings with __user pointers
[S390] sparse: fix sparse warnings in math-emu
[S390] sparse: fix sparse warnings about missing prototypes
[S390] sparse: fix sparse ANSI-C warnings
[S390] sparse: fix sparse static warnings
[S390] sparse: fix access past end of array warnings
[S390] dasd: prevent path verification before resume
[S390] qdio: remove multicast polling
[S390] qdio: reset outbound SBAL error states
[S390] qdio: EQBS retry after CCQ 96
[S390] qdio: add timestamp for last queue scan time
[S390] Introduce get_clock_fast()
[S390] kvm: Handle diagnose 0x10 (release pages)
[S390] take mmap_sem when walking guest page table
...

+2239 -799
+3 -3
Documentation/kernel-parameters.txt
··· 741 741 See Documentation/block/cfq-iosched.txt and 742 742 Documentation/block/deadline-iosched.txt for details. 743 743 744 - elfcorehdr= [IA-64,PPC,SH,X86] 744 + elfcorehdr=[size[KMG]@]offset[KMG] [IA64,PPC,SH,X86,S390] 745 745 Specifies physical address of start of kernel core 746 - image elf header. Generally kexec loader will 747 - pass this option to capture kernel. 746 + image elf header and optionally the size. Generally 747 + kexec loader will pass this option to capture kernel. 748 748 See Documentation/kdump/kdump.txt for details. 749 749 750 750 enable_mtrr_cleanup [X86]
+10
arch/s390/Kconfig
··· 569 569 current kernel, and to start another kernel. It is like a reboot 570 570 but is independent of hardware/microcode support. 571 571 572 + config CRASH_DUMP 573 + bool "kernel crash dumps" 574 + depends on 64BIT 575 + help 576 + Generate crash dump after being started by kexec. 577 + Crash dump kernels are loaded in the main kernel with kexec-tools 578 + into a specially reserved region and then later executed after 579 + a crash by kdump/kexec. 580 + For more details see Documentation/kdump/kdump.txt 581 + 572 582 config ZFCPDUMP 573 583 def_bool n 574 584 prompt "zfcpdump support"
+1 -1
arch/s390/boot/compressed/misc.c
··· 61 61 62 62 extern _sclp_print_early(const char *); 63 63 64 - int puts(const char *s) 64 + static int puts(const char *s) 65 65 { 66 66 _sclp_print_early(s); 67 67 return 0;
+1 -1
arch/s390/defconfig
··· 68 68 CONFIG_NET_CLS_ACT=y 69 69 CONFIG_NET_ACT_POLICE=y 70 70 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 71 - # CONFIG_FIRMWARE_IN_KERNEL is not set 71 + CONFIG_DEVTMPFS=y 72 72 CONFIG_BLK_DEV_LOOP=m 73 73 CONFIG_BLK_DEV_NBD=m 74 74 CONFIG_BLK_DEV_RAM=y
+3
arch/s390/include/asm/ccwdev.h
··· 11 11 #include <linux/device.h> 12 12 #include <linux/mod_devicetable.h> 13 13 #include <asm/fcx.h> 14 + #include <asm/irq.h> 14 15 15 16 /* structs from asm/cio.h */ 16 17 struct irb; ··· 128 127 * @restore: callback for restoring after hibernation 129 128 * @uc_handler: callback for unit check handler 130 129 * @driver: embedded device driver structure 130 + * @int_class: interruption class to use for accounting interrupts 131 131 */ 132 132 struct ccw_driver { 133 133 struct ccw_device_id *ids; ··· 146 144 int (*restore)(struct ccw_device *); 147 145 enum uc_todo (*uc_handler) (struct ccw_device *, struct irb *); 148 146 struct device_driver driver; 147 + enum interruption_class int_class; 149 148 }; 150 149 151 150 extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
+6 -7
arch/s390/include/asm/compat.h
··· 12 12 #define PSW32_MASK_IO 0x02000000UL 13 13 #define PSW32_MASK_EXT 0x01000000UL 14 14 #define PSW32_MASK_KEY 0x00F00000UL 15 + #define PSW32_MASK_BASE 0x00080000UL /* Always one */ 15 16 #define PSW32_MASK_MCHECK 0x00040000UL 16 17 #define PSW32_MASK_WAIT 0x00020000UL 17 18 #define PSW32_MASK_PSTATE 0x00010000UL ··· 20 19 #define PSW32_MASK_CC 0x00003000UL 21 20 #define PSW32_MASK_PM 0x00000f00UL 22 21 23 - #define PSW32_ADDR_AMODE31 0x80000000UL 22 + #define PSW32_MASK_USER 0x00003F00UL 23 + 24 + #define PSW32_ADDR_AMODE 0x80000000UL 24 25 #define PSW32_ADDR_INSN 0x7FFFFFFFUL 25 26 26 - #define PSW32_BASE_BITS 0x00080000UL 27 + #define PSW32_DEFAULT_KEY (((u32) PAGE_DEFAULT_ACC) << 20) 27 28 28 29 #define PSW32_ASC_PRIMARY 0x00000000UL 29 30 #define PSW32_ASC_ACCREG 0x00004000UL 30 31 #define PSW32_ASC_SECONDARY 0x00008000UL 31 32 #define PSW32_ASC_HOME 0x0000C000UL 32 33 33 - #define PSW32_MASK_MERGE(CURRENT,NEW) \ 34 - (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \ 35 - ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM))) 36 - 37 - extern long psw32_user_bits; 34 + extern u32 psw32_user_bits; 38 35 39 36 #define COMPAT_USER_HZ 100 40 37 #define COMPAT_UTS_MACHINE "s390\0\0\0\0"
+1
arch/s390/include/asm/ipl.h
··· 168 168 169 169 extern int diag308(unsigned long subcode, void *addr); 170 170 extern void diag308_reset(void); 171 + extern void store_status(void); 171 172 172 173 #endif /* _ASM_S390_IPL_H */
+4 -2
arch/s390/include/asm/irq.h
··· 8 8 EXTERNAL_INTERRUPT, 9 9 IO_INTERRUPT, 10 10 EXTINT_CLK, 11 - EXTINT_IPI, 11 + EXTINT_EXC, 12 + EXTINT_EMS, 12 13 EXTINT_TMR, 13 14 EXTINT_TLA, 14 15 EXTINT_PFL, ··· 18 17 EXTINT_SCP, 19 18 EXTINT_IUC, 20 19 EXTINT_CPM, 20 + IOINT_CIO, 21 21 IOINT_QAI, 22 - IOINT_QDI, 23 22 IOINT_DAS, 24 23 IOINT_C15, 25 24 IOINT_C70, ··· 29 28 IOINT_CLW, 30 29 IOINT_CTC, 31 30 IOINT_APB, 31 + IOINT_CSC, 32 32 NMI_NMI, 33 33 NR_IRQS, 34 34 };
+6
arch/s390/include/asm/kexec.h
··· 30 30 /* Not more than 2GB */ 31 31 #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31) 32 32 33 + /* Maximum address we can use for the crash control pages */ 34 + #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL) 35 + 33 36 /* Allocate one page for the pdp and the second for the code */ 34 37 #define KEXEC_CONTROL_PAGE_SIZE 4096 38 + 39 + /* Alignment of crashkernel memory */ 40 + #define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE 35 41 36 42 /* The native architecture */ 37 43 #define KEXEC_ARCH KEXEC_ARCH_S390
+1
arch/s390/include/asm/kvm_host.h
··· 145 145 u32 instruction_sigp_arch; 146 146 u32 instruction_sigp_prefix; 147 147 u32 instruction_sigp_restart; 148 + u32 diagnose_10; 148 149 u32 diagnose_44; 149 150 }; 150 151
+3 -7
arch/s390/include/asm/lowcore.h
··· 151 151 */ 152 152 __u32 ipib; /* 0x0e00 */ 153 153 __u32 ipib_checksum; /* 0x0e04 */ 154 - 155 - /* 64 bit save area */ 156 - __u64 save_area_64; /* 0x0e08 */ 157 - __u8 pad_0x0e10[0x0f00-0x0e10]; /* 0x0e10 */ 154 + __u32 vmcore_info; /* 0x0e08 */ 155 + __u8 pad_0x0e0c[0x0f00-0x0e0c]; /* 0x0e0c */ 158 156 159 157 /* Extended facility list */ 160 158 __u64 stfle_fac_list[32]; /* 0x0f00 */ ··· 288 290 */ 289 291 __u64 ipib; /* 0x0e00 */ 290 292 __u32 ipib_checksum; /* 0x0e08 */ 291 - 292 - /* 64 bit save area */ 293 - __u64 save_area_64; /* 0x0e0c */ 293 + __u64 vmcore_info; /* 0x0e0c */ 294 294 __u8 pad_0x0e14[0x0f00-0x0e14]; /* 0x0e14 */ 295 295 296 296 /* Extended facility list */
+1
arch/s390/include/asm/page.h
··· 177 177 struct page; 178 178 void arch_free_page(struct page *page, int order); 179 179 void arch_alloc_page(struct page *page, int order); 180 + void arch_set_page_states(int make_stable); 180 181 181 182 static inline int devmem_is_allowed(unsigned long pfn) 182 183 {
+2
arch/s390/include/asm/pgtable.h
··· 696 696 int gmap_map_segment(struct gmap *gmap, unsigned long from, 697 697 unsigned long to, unsigned long length); 698 698 int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len); 699 + unsigned long __gmap_fault(unsigned long address, struct gmap *); 699 700 unsigned long gmap_fault(unsigned long address, struct gmap *); 701 + void gmap_discard(unsigned long from, unsigned long to, struct gmap *); 700 702 701 703 /* 702 704 * Certain architectures need to do special things when PTEs
+33 -21
arch/s390/include/asm/processor.h
··· 33 33 34 34 extern void s390_adjust_jiffies(void); 35 35 extern int get_cpu_capability(unsigned int *); 36 + extern const struct seq_operations cpuinfo_op; 37 + extern int sysctl_ieee_emulation_warnings; 36 38 37 39 /* 38 40 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit. ··· 120 118 /* 121 119 * Do necessary setup to start up a new thread. 122 120 */ 123 - #define start_thread(regs, new_psw, new_stackp) do { \ 124 - regs->psw.mask = psw_user_bits; \ 125 - regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 126 - regs->gprs[15] = new_stackp; \ 121 + #define start_thread(regs, new_psw, new_stackp) do { \ 122 + regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \ 123 + regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 124 + regs->gprs[15] = new_stackp; \ 127 125 } while (0) 128 126 129 - #define start_thread31(regs, new_psw, new_stackp) do { \ 130 - regs->psw.mask = psw_user32_bits; \ 131 - regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 132 - regs->gprs[15] = new_stackp; \ 133 - crst_table_downgrade(current->mm, 1UL << 31); \ 127 + #define start_thread31(regs, new_psw, new_stackp) do { \ 128 + regs->psw.mask = psw_user_bits | PSW_MASK_BA; \ 129 + regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 130 + regs->gprs[15] = new_stackp; \ 131 + crst_table_downgrade(current->mm, 1UL << 31); \ 134 132 } while (0) 135 133 136 134 /* Forward declaration, a strange C thing */ ··· 189 187 * Set PSW mask to specified value, while leaving the 190 188 * PSW addr pointing to the next instruction. 191 189 */ 192 - 193 190 static inline void __load_psw_mask (unsigned long mask) 194 191 { 195 192 unsigned long addr; ··· 213 212 : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc"); 214 213 #endif /* __s390x__ */ 215 214 } 216 - 217 - /* 218 - * Function to stop a processor until an interruption occurred 219 - */ 220 - static inline void enabled_wait(void) 221 - { 222 - __load_psw_mask(PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | 223 - PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY); 224 - } 225 215 216 + /* 217 + * Rewind PSW instruction address by specified number of bytes. 218 + */ 219 + static inline unsigned long __rewind_psw(psw_t psw, unsigned long ilc) 220 + { 221 + #ifndef __s390x__ 222 + if (psw.addr & PSW_ADDR_AMODE) 223 + /* 31 bit mode */ 224 + return (psw.addr - ilc) | PSW_ADDR_AMODE; 225 + /* 24 bit mode */ 226 + return (psw.addr - ilc) & ((1UL << 24) - 1); 227 + #else 228 + unsigned long mask; 229 + 230 + mask = (psw.mask & PSW_MASK_EA) ? -1UL : 231 + (psw.mask & PSW_MASK_BA) ? (1UL << 31) - 1 : 232 + (1UL << 24) - 1; 233 + return (psw.addr - ilc) & mask; 234 + #endif 235 + } 236 + 226 237 /* 227 238 * Function to drop a processor into disabled wait state 228 239 */ 229 - 230 240 static inline void ATTRIB_NORET disabled_wait(unsigned long code) 231 241 { 232 242 unsigned long ctl_buf; 233 243 psw_t dw_psw; 234 244 235 - dw_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; 245 + dw_psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA; 236 246 dw_psw.addr = code; 237 247 /* 238 248 * Store status and then load disabled wait psw,
+13 -16
arch/s390/include/asm/ptrace.h
··· 230 230 #define PSW_MASK_IO 0x02000000UL 231 231 #define PSW_MASK_EXT 0x01000000UL 232 232 #define PSW_MASK_KEY 0x00F00000UL 233 + #define PSW_MASK_BASE 0x00080000UL /* always one */ 233 234 #define PSW_MASK_MCHECK 0x00040000UL 234 235 #define PSW_MASK_WAIT 0x00020000UL 235 236 #define PSW_MASK_PSTATE 0x00010000UL 236 237 #define PSW_MASK_ASC 0x0000C000UL 237 238 #define PSW_MASK_CC 0x00003000UL 238 239 #define PSW_MASK_PM 0x00000F00UL 240 + #define PSW_MASK_EA 0x00000000UL 241 + #define PSW_MASK_BA 0x00000000UL 242 + 243 + #define PSW_MASK_USER 0x00003F00UL 239 244 240 245 #define PSW_ADDR_AMODE 0x80000000UL 241 246 #define PSW_ADDR_INSN 0x7FFFFFFFUL 242 247 243 - #define PSW_BASE_BITS 0x00080000UL 244 248 #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20) 245 249 246 250 #define PSW_ASC_PRIMARY 0x00000000UL ··· 258 254 #define PSW_MASK_DAT 0x0400000000000000UL 259 255 #define PSW_MASK_IO 0x0200000000000000UL 260 256 #define PSW_MASK_EXT 0x0100000000000000UL 257 + #define PSW_MASK_BASE 0x0000000000000000UL 261 258 #define PSW_MASK_KEY 0x00F0000000000000UL 262 259 #define PSW_MASK_MCHECK 0x0004000000000000UL 263 260 #define PSW_MASK_WAIT 0x0002000000000000UL ··· 266 261 #define PSW_MASK_ASC 0x0000C00000000000UL 267 262 #define PSW_MASK_CC 0x0000300000000000UL 268 263 #define PSW_MASK_PM 0x00000F0000000000UL 264 + #define PSW_MASK_EA 0x0000000100000000UL 265 + #define PSW_MASK_BA 0x0000000080000000UL 266 + 267 + #define PSW_MASK_USER 0x00003F0180000000UL 269 268 270 269 #define PSW_ADDR_AMODE 0x0000000000000000UL 271 270 #define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL 272 271 273 - #define PSW_BASE_BITS 0x0000000180000000UL 274 - #define PSW_BASE32_BITS 0x0000000080000000UL 275 272 #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52) 276 273 277 274 #define PSW_ASC_PRIMARY 0x0000000000000000UL ··· 286 279 #ifdef __KERNEL__ 287 280 extern long psw_kernel_bits; 288 281 extern long psw_user_bits; 289 - #ifdef CONFIG_64BIT 290 - extern long psw_user32_bits; 291 282 #endif 292 - #endif 293 - 294 - /* This macro merges a NEW PSW mask specified by the user into 295 - the currently active PSW mask CURRENT, modifying only those 296 - bits in CURRENT that the user may be allowed to change: this 297 - is the condition code and the program mask bits. */ 298 - #define PSW_MASK_MERGE(CURRENT,NEW) \ 299 - (((CURRENT) & ~(PSW_MASK_CC|PSW_MASK_PM)) | \ 300 - ((NEW) & (PSW_MASK_CC|PSW_MASK_PM))) 301 283 302 284 /* 303 285 * The s390_regs structure is used to define the elf_gregset_t. ··· 324 328 psw_t psw; 325 329 unsigned long gprs[NUM_GPRS]; 326 330 unsigned long orig_gpr2; 327 - unsigned short ilc; 328 - unsigned short svcnr; 331 + unsigned int svc_code; 329 332 }; 330 333 331 334 /* ··· 482 487 #define PTRACE_POKETEXT_AREA 0x5004 483 488 #define PTRACE_POKEDATA_AREA 0x5005 484 489 #define PTRACE_GET_LAST_BREAK 0x5006 490 + #define PTRACE_PEEK_SYSTEM_CALL 0x5007 491 + #define PTRACE_POKE_SYSTEM_CALL 0x5008 485 492 486 493 /* 487 494 * PT_PROT definition is loosely based on hppa bsd definition in
+1 -1
arch/s390/include/asm/reset.h
··· 17 17 18 18 extern void register_reset_call(struct reset_call *reset); 19 19 extern void unregister_reset_call(struct reset_call *reset); 20 - extern void s390_reset_system(void); 20 + extern void s390_reset_system(void (*func)(void *), void *data); 21 21 #endif /* _ASM_S390_RESET_H */
+13
arch/s390/include/asm/setup.h
··· 26 26 #define IPL_DEVICE (*(unsigned long *) (0x10404)) 27 27 #define INITRD_START (*(unsigned long *) (0x1040C)) 28 28 #define INITRD_SIZE (*(unsigned long *) (0x10414)) 29 + #define OLDMEM_BASE (*(unsigned long *) (0x1041C)) 30 + #define OLDMEM_SIZE (*(unsigned long *) (0x10424)) 29 31 #else /* __s390x__ */ 30 32 #define IPL_DEVICE (*(unsigned long *) (0x10400)) 31 33 #define INITRD_START (*(unsigned long *) (0x10408)) 32 34 #define INITRD_SIZE (*(unsigned long *) (0x10410)) 35 + #define OLDMEM_BASE (*(unsigned long *) (0x10418)) 36 + #define OLDMEM_SIZE (*(unsigned long *) (0x10420)) 33 37 #endif /* __s390x__ */ 34 38 #define COMMAND_LINE ((char *) (0x10480)) 35 39 36 40 #define CHUNK_READ_WRITE 0 37 41 #define CHUNK_READ_ONLY 1 42 + #define CHUNK_OLDMEM 4 43 + #define CHUNK_CRASHK 5 38 44 39 45 struct mem_chunk { 40 46 unsigned long addr; ··· 54 48 extern unsigned long memory_end; 55 49 56 50 void detect_memory_layout(struct mem_chunk chunk[]); 51 + void create_mem_hole(struct mem_chunk memory_chunk[], unsigned long addr, 52 + unsigned long size, int type); 57 53 58 54 #define PRIMARY_SPACE_MODE 0 59 55 #define ACCESS_REGISTER_MODE 1 ··· 114 106 #endif /* __s390x__ */ 115 107 116 108 #define ZFCPDUMP_HSA_SIZE (32UL<<20) 109 + #define ZFCPDUMP_HSA_SIZE_MAX (64UL<<20) 117 110 118 111 /* 119 112 * Console mode. Override with conmode= ··· 143 134 #define IPL_DEVICE 0x10404 144 135 #define INITRD_START 0x1040C 145 136 #define INITRD_SIZE 0x10414 137 + #define OLDMEM_BASE 0x1041C 138 + #define OLDMEM_SIZE 0x10424 146 139 #else /* __s390x__ */ 147 140 #define IPL_DEVICE 0x10400 148 141 #define INITRD_START 0x10408 149 142 #define INITRD_SIZE 0x10410 143 + #define OLDMEM_BASE 0x10418 144 + #define OLDMEM_SIZE 0x10420 150 145 #endif /* __s390x__ */ 151 146 #define COMMAND_LINE 0x10480 152 147
+1 -1
arch/s390/include/asm/sfp-util.h
··· 72 72 73 73 #define UDIV_NEEDS_NORMALIZATION 0 74 74 75 - #define abort() return 0 75 + #define abort() BUG() 76 76 77 77 #define __BYTE_ORDER __BIG_ENDIAN
+5
arch/s390/include/asm/smp.h
··· 33 33 extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *); 34 34 extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp, 35 35 int from, int to); 36 + extern void smp_restart_with_online_cpu(void); 36 37 extern void smp_restart_cpu(void); 37 38 38 39 /* ··· 63 62 static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) 64 63 { 65 64 func(data); 65 + } 66 + 67 + static inline void smp_restart_with_online_cpu(void) 68 + { 66 69 } 67 70 68 71 #define smp_vcpu_scheduled (1)
+2
arch/s390/include/asm/spinlock.h
··· 13 13 14 14 #include <linux/smp.h> 15 15 16 + extern int spin_retry; 17 + 16 18 static inline int 17 19 _raw_compare_and_swap(volatile unsigned int *lock, 18 20 unsigned int old, unsigned int new)
+4 -2
arch/s390/include/asm/syscall.h
··· 13 13 #define _ASM_SYSCALL_H 1 14 14 15 15 #include <linux/sched.h> 16 + #include <linux/err.h> 16 17 #include <asm/ptrace.h> 17 18 18 19 /* ··· 26 25 static inline long syscall_get_nr(struct task_struct *task, 27 26 struct pt_regs *regs) 28 27 { 29 - return regs->svcnr ? regs->svcnr : -1; 28 + return test_tsk_thread_flag(task, TIF_SYSCALL) ? 29 + (regs->svc_code & 0xffff) : -1; 30 30 } 31 31 32 32 static inline void syscall_rollback(struct task_struct *task, ··· 39 37 static inline long syscall_get_error(struct task_struct *task, 40 38 struct pt_regs *regs) 41 39 { 42 - return (regs->gprs[2] >= -4096UL) ? -regs->gprs[2] : 0; 40 + return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0; 43 41 } 44 42 45 43 static inline long syscall_get_return_value(struct task_struct *task,
+8 -2
arch/s390/include/asm/system.h
··· 20 20 21 21 struct task_struct; 22 22 23 + extern int sysctl_userprocess_debug; 24 + 23 25 extern struct task_struct *__switch_to(void *, void *); 24 26 extern void update_per_regs(struct task_struct *task); 25 27 ··· 116 114 extern void cmma_init(void); 117 115 extern int memcpy_real(void *, void *, size_t); 118 116 extern void copy_to_absolute_zero(void *dest, void *src, size_t count); 117 + extern int copy_to_user_real(void __user *dest, void *src, size_t count); 118 + extern int copy_from_user_real(void *dest, void __user *src, size_t count); 119 119 120 120 #define finish_arch_switch(prev) do { \ 121 121 set_fs(current->thread.mm_segment); \ ··· 214 210 __load_psw_mask(mask | (arch_local_save_flags() & ~(-1UL >> 8))); 215 211 } 216 212 217 - #define local_mcck_enable() __set_psw_mask(psw_kernel_bits) 218 - #define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK) 213 + #define local_mcck_enable() \ 214 + __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK) 215 + #define local_mcck_disable() \ 216 + __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT) 219 217 220 218 #ifdef CONFIG_SMP 221 219
+4 -3
arch/s390/include/asm/thread_info.h
··· 48 48 unsigned int cpu; /* current CPU */ 49 49 int preempt_count; /* 0 => preemptable, <0 => BUG */ 50 50 struct restart_block restart_block; 51 + unsigned int system_call; 51 52 __u64 user_timer; 52 53 __u64 system_timer; 53 54 unsigned long last_break; /* last breaking-event-address. */ ··· 85 84 /* 86 85 * thread information flags bit numbers 87 86 */ 87 + #define TIF_SYSCALL 0 /* inside a system call */ 88 88 #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 89 89 #define TIF_SIGPENDING 2 /* signal pending */ 90 90 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 91 - #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ 92 91 #define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */ 93 92 #define TIF_MCCK_PENDING 7 /* machine check handling is pending */ 94 93 #define TIF_SYSCALL_TRACE 8 /* syscall trace active */ ··· 104 103 #define TIF_SINGLE_STEP 20 /* This task is single stepped */ 105 104 #define TIF_FREEZE 21 /* thread is freezing for suspend */ 106 105 106 + #define _TIF_SYSCALL (1<<TIF_SYSCALL) 107 107 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 108 108 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 109 109 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 110 110 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 111 - #define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC) 112 111 #define _TIF_PER_TRAP (1<<TIF_PER_TRAP) 113 112 #define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING) 114 113 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) ··· 118 117 #define _TIF_SIE (1<<TIF_SIE) 119 118 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 120 119 #define _TIF_31BIT (1<<TIF_31BIT) 121 - #define _TIF_SINGLE_STEP (1<<TIF_FREEZE) 120 + #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) 122 121 #define _TIF_FREEZE (1<<TIF_FREEZE) 123 122 124 123 #ifdef CONFIG_64BIT
+11
arch/s390/include/asm/timex.h
··· 86 86 asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); 87 87 } 88 88 89 + static inline unsigned long long get_clock_fast(void) 90 + { 91 + unsigned long long clk; 92 + 93 + if (test_facility(25)) 94 + asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc"); 95 + else 96 + clk = get_clock(); 97 + return clk; 98 + } 99 + 89 100 static inline unsigned long long get_clock_xt(void) 90 101 { 91 102 unsigned char clk[16];
+1
arch/s390/include/asm/tlbflush.h
··· 59 59 } 60 60 #else 61 61 #define __tlb_flush_full(mm) __tlb_flush_local() 62 + #define __tlb_flush_global() __tlb_flush_local() 62 63 #endif 63 64 64 65 /*
+1
arch/s390/kernel/Makefile
··· 48 48 obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 49 49 obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 50 50 obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 51 + obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 51 52 52 53 # Kexec part 53 54 S390_KEXEC_OBJS := machine_kexec.o crash.o
+1 -3
arch/s390/kernel/asm-offsets.c
··· 45 45 DEFINE(__PT_PSW, offsetof(struct pt_regs, psw)); 46 46 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs)); 47 47 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2)); 48 - DEFINE(__PT_ILC, offsetof(struct pt_regs, ilc)); 49 - DEFINE(__PT_SVCNR, offsetof(struct pt_regs, svcnr)); 48 + DEFINE(__PT_SVC_CODE, offsetof(struct pt_regs, svc_code)); 50 49 DEFINE(__PT_SIZE, sizeof(struct pt_regs)); 51 50 BLANK(); 52 51 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain)); ··· 140 141 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); 141 142 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); 142 143 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); 143 - DEFINE(__LC_SAVE_AREA_64, offsetof(struct _lowcore, save_area_64)); 144 144 #ifdef CONFIG_32BIT 145 145 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); 146 146 #else /* CONFIG_32BIT */
+6
arch/s390/kernel/base.S
··· 86 86 ENTRY(diag308_reset) 87 87 larl %r4,.Lctlregs # Save control registers 88 88 stctg %c0,%c15,0(%r4) 89 + larl %r4,.Lfpctl # Floating point control register 90 + stfpc 0(%r4) 89 91 larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0 90 92 lghi %r3,0 91 93 lg %r4,0(%r4) # Save PSW ··· 101 99 sam64 # Switch to 64 bit addressing mode 102 100 larl %r4,.Lctlregs # Restore control registers 103 101 lctlg %c0,%c15,0(%r4) 102 + larl %r4,.Lfpctl # Restore floating point ctl register 103 + lfpc 0(%r4) 104 104 br %r14 105 105 .align 16 106 106 .Lrestart_psw: ··· 114 110 .rept 16 115 111 .quad 0 116 112 .endr 113 + .Lfpctl: 114 + .long 0 117 115 .previous 118 116 119 117 #else /* CONFIG_64BIT */
+8 -24
arch/s390/kernel/compat_linux.c
··· 60 60 61 61 #include "compat_linux.h" 62 62 63 - long psw_user32_bits = (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | 64 - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 65 - PSW_MASK_PSTATE | PSW_DEFAULT_KEY); 66 - long psw32_user_bits = (PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | 67 - PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | 68 - PSW32_MASK_PSTATE); 63 + u32 psw32_user_bits = PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | 64 + PSW32_DEFAULT_KEY | PSW32_MASK_BASE | PSW32_MASK_MCHECK | 65 + PSW32_MASK_PSTATE | PSW32_ASC_HOME; 69 66 70 67 /* For this source file, we want overflow handling. */ 71 68 ··· 362 365 if (set) { 363 366 if (copy_from_user (&s32, set, sizeof(compat_sigset_t))) 364 367 return -EFAULT; 365 - switch (_NSIG_WORDS) { 366 - case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32); 367 - case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32); 368 - case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32); 369 - case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); 370 - } 368 + s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); 371 369 } 372 370 set_fs (KERNEL_DS); 373 371 ret = sys_rt_sigprocmask(how, ··· 372 380 set_fs (old_fs); 373 381 if (ret) return ret; 374 382 if (oset) { 375 - switch (_NSIG_WORDS) { 376 - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; 377 - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; 378 - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; 379 - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; 380 - } 383 + s32.sig[1] = (s.sig[0] >> 32); 384 + s32.sig[0] = s.sig[0]; 381 385 if (copy_to_user (oset, &s32, sizeof(compat_sigset_t))) 382 386 return -EFAULT; 383 387 } ··· 392 404 ret = sys_rt_sigpending((sigset_t __force __user *) &s, sigsetsize); 393 405 set_fs (old_fs); 394 406 if (!ret) { 395 - switch (_NSIG_WORDS) { 396 - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; 397 - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; 398 - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; 399 - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; 400 - } 407 + s32.sig[1] = (s.sig[0] >> 32); 408 + s32.sig[0] = s.sig[0]; 401 409 if (copy_to_user (set, &s32, sizeof(compat_sigset_t))) 402 410 return -EFAULT; 403 411 }
+28 -43
arch/s390/kernel/compat_signal.c
··· 141 141 break; 142 142 case __SI_FAULT >> 16: 143 143 err |= __get_user(tmp, &from->si_addr); 144 - to->si_addr = (void __user *)(u64) (tmp & PSW32_ADDR_INSN); 144 + to->si_addr = (void __force __user *) 145 + (u64) (tmp & PSW32_ADDR_INSN); 145 146 break; 146 147 case __SI_POLL >> 16: 147 148 err |= __get_user(to->si_band, &from->si_band); ··· 214 213 ret = get_user(sa_handler, &act->sa_handler); 215 214 ret |= __copy_from_user(&set32, &act->sa_mask, 216 215 sizeof(compat_sigset_t)); 217 - switch (_NSIG_WORDS) { 218 - case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] 219 - | (((long)set32.sig[7]) << 32); 220 - case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] 221 - | (((long)set32.sig[5]) << 32); 222 - case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2] 223 - | (((long)set32.sig[3]) << 32); 224 - case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0] 225 - | (((long)set32.sig[1]) << 32); 226 - } 216 + new_ka.sa.sa_mask.sig[0] = 217 + set32.sig[0] | (((long)set32.sig[1]) << 32); 227 218 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); 228 219 229 220 if (ret) ··· 226 233 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 227 234 228 235 if (!ret && oact) { 229 - switch (_NSIG_WORDS) { 230 - case 4: 231 - set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32); 232 - set32.sig[6] = old_ka.sa.sa_mask.sig[3]; 233 - case 3: 234 - set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32); 235 - set32.sig[4] = old_ka.sa.sa_mask.sig[2]; 236 - case 2: 237 - set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32); 238 - set32.sig[2] = old_ka.sa.sa_mask.sig[1]; 239 - case 1: 240 - set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); 241 - set32.sig[0] = old_ka.sa.sa_mask.sig[0]; 242 - } 236 + set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); 237 + set32.sig[0] = old_ka.sa.sa_mask.sig[0]; 243 238 ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler); 244 239 ret |= __copy_to_user(&oact->sa_mask, &set32, 245 240 sizeof(compat_sigset_t)); ··· 281 300 _s390_regs_common32 regs32; 282 301 int err, i; 283 302 284 - regs32.psw.mask = PSW32_MASK_MERGE(psw32_user_bits, 285 - (__u32)(regs->psw.mask >> 32)); 286 - regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr; 303 + regs32.psw.mask = psw32_user_bits | 304 + ((__u32)(regs->psw.mask >> 32) & PSW32_MASK_USER); 305 + regs32.psw.addr = (__u32) regs->psw.addr | 306 + (__u32)(regs->psw.mask & PSW_MASK_BA); 287 307 for (i = 0; i < NUM_GPRS; i++) 288 308 regs32.gprs[i] = (__u32) regs->gprs[i]; 289 309 save_access_regs(current->thread.acrs); ··· 309 327 err = __copy_from_user(&regs32, &sregs->regs, sizeof(regs32)); 310 328 if (err) 311 329 return err; 312 - regs->psw.mask = PSW_MASK_MERGE(regs->psw.mask, 313 - (__u64)regs32.psw.mask << 32); 330 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 331 + (__u64)(regs32.psw.mask & PSW32_MASK_USER) << 32 | 332 + (__u64)(regs32.psw.addr & PSW32_ADDR_AMODE); 314 333 regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN); 315 334 for (i = 0; i < NUM_GPRS; i++) 316 335 regs->gprs[i] = (__u64) regs32.gprs[i]; ··· 325 342 return err; 326 343 327 344 restore_fp_regs(&current->thread.fp_regs); 328 - regs->svcnr = 0; /* disable syscall checks */ 345 + clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 329 346 return 0; 330 347 } 331 348 ··· 479 496 /* Set up to return from userspace. If provided, use a stub 480 497 already in userspace. */ 481 498 if (ka->sa.sa_flags & SA_RESTORER) { 482 - regs->gprs[14] = (__u64) ka->sa.sa_restorer; 499 + regs->gprs[14] = (__u64) ka->sa.sa_restorer | PSW32_ADDR_AMODE; 483 500 } else { 484 - regs->gprs[14] = (__u64) frame->retcode; 501 + regs->gprs[14] = (__u64) frame->retcode | PSW32_ADDR_AMODE; 485 502 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 486 - (u16 __user *)(frame->retcode))) 503 + (u16 __force __user *)(frame->retcode))) 487 504 goto give_sigsegv; 488 505 } 489 506 ··· 492 509 goto give_sigsegv; 493 510 494 511 /* Set up registers for signal handler */ 495 - regs->gprs[15] = (__u64) frame; 496 - regs->psw.addr = (__u64) ka->sa.sa_handler; 512 + regs->gprs[15] = (__force __u64) frame; 513 + regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ 514 + regs->psw.addr = (__force __u64) ka->sa.sa_handler; 497 515 498 516 regs->gprs[2] = map_signal(sig); 499 - regs->gprs[3] = (__u64) &frame->sc; 517 + regs->gprs[3] = (__force __u64) &frame->sc; 500 518 501 519 /* We forgot to include these in the sigcontext. 502 520 To avoid breaking binary compatibility, they are passed as args. */ ··· 505 521 regs->gprs[5] = current->thread.prot_addr; 506 522 507 523 /* Place signal number on stack to allow backtrace from handler. */ 508 - if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) 524 + if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) 509 525 goto give_sigsegv; 510 526 return 0; 511 527 ··· 548 564 } else { 549 565 regs->gprs[14] = (__u64) frame->retcode; 550 566 err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 551 - (u16 __user *)(frame->retcode)); 567 + (u16 __force __user *)(frame->retcode)); 552 568 } 553 569 554 570 /* Set up backchain. */ 555 - if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) 571 + if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame)) 556 572 goto give_sigsegv; 557 573 558 574 /* Set up registers for signal handler */ 559 - regs->gprs[15] = (__u64) frame; 575 + regs->gprs[15] = (__force __u64) frame; 576 + regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ 560 577 regs->psw.addr = (__u64) ka->sa.sa_handler; 561 578 562 579 regs->gprs[2] = map_signal(sig); 563 - regs->gprs[3] = (__u64) &frame->info; 564 - regs->gprs[4] = (__u64) &frame->uc; 580 + regs->gprs[3] = (__force __u64) &frame->info; 581 + regs->gprs[4] = (__force __u64) &frame->uc; 565 582 return 0; 566 583 567 584 give_sigsegv:
+1 -2
arch/s390/kernel/compat_wrapper.S
··· 1623 1623 lgfr %r2,%r2 # int 1624 1624 jg sys_syncfs 1625 1625 1626 - .globl sys_setns_wrapper 1627 - sys_setns_wrapper: 1626 + ENTRY(sys_setns_wrapper) 1628 1627 lgfr %r2,%r2 # int 1629 1628 lgfr %r3,%r3 # int 1630 1629 jg sys_setns
+426
arch/s390/kernel/crash_dump.c
··· 1 + /* 2 + * S390 kdump implementation 3 + * 4 + * Copyright IBM Corp. 2011 5 + * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com> 6 + */ 7 + 8 + #include <linux/crash_dump.h> 9 + #include <asm/lowcore.h> 10 + #include <linux/kernel.h> 11 + #include <linux/module.h> 12 + #include <linux/gfp.h> 13 + #include <linux/slab.h> 14 + #include <linux/crash_dump.h> 15 + #include <linux/bootmem.h> 16 + #include <linux/elf.h> 17 + #include <asm/ipl.h> 18 + 19 + #define PTR_ADD(x, y) (((char *) (x)) + ((unsigned long) (y))) 20 + #define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) 21 + #define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) 22 + 23 + /* 24 + * Copy one page from "oldmem" 25 + * 26 + * For the kdump reserved memory this functions performs a swap operation: 27 + * - [OLDMEM_BASE - OLDMEM_BASE + OLDMEM_SIZE] is mapped to [0 - OLDMEM_SIZE]. 28 + * - [0 - OLDMEM_SIZE] is mapped to [OLDMEM_BASE - OLDMEM_BASE + OLDMEM_SIZE] 29 + */ 30 + ssize_t copy_oldmem_page(unsigned long pfn, char *buf, 31 + size_t csize, unsigned long offset, int userbuf) 32 + { 33 + unsigned long src; 34 + 35 + if (!csize) 36 + return 0; 37 + 38 + src = (pfn << PAGE_SHIFT) + offset; 39 + if (src < OLDMEM_SIZE) 40 + src += OLDMEM_BASE; 41 + else if (src > OLDMEM_BASE && 42 + src < OLDMEM_BASE + OLDMEM_SIZE) 43 + src -= OLDMEM_BASE; 44 + if (userbuf) 45 + copy_to_user_real((void __force __user *) buf, (void *) src, 46 + csize); 47 + else 48 + memcpy_real(buf, (void *) src, csize); 49 + return csize; 50 + } 51 + 52 + /* 53 + * Copy memory from old kernel 54 + */ 55 + static int copy_from_oldmem(void *dest, void *src, size_t count) 56 + { 57 + unsigned long copied = 0; 58 + int rc; 59 + 60 + if ((unsigned long) src < OLDMEM_SIZE) { 61 + copied = min(count, OLDMEM_SIZE - (unsigned long) src); 62 + rc = memcpy_real(dest, src + OLDMEM_BASE, copied); 63 + if (rc) 64 + return rc; 65 + } 66 + return memcpy_real(dest + copied, src + copied, count - copied); 67 + } 68 + 69 + /* 70 + * Alloc memory and panic in case of ENOMEM 71 + */ 72 + static void *kzalloc_panic(int len) 73 + { 74 + void *rc; 75 + 76 + rc = kzalloc(len, GFP_KERNEL); 77 + if (!rc) 78 + panic("s390 kdump kzalloc (%d) failed", len); 79 + return rc; 80 + } 81 + 82 + /* 83 + * Get memory layout and create hole for oldmem 84 + */ 85 + static struct mem_chunk *get_memory_layout(void) 86 + { 87 + struct mem_chunk *chunk_array; 88 + 89 + chunk_array = kzalloc_panic(MEMORY_CHUNKS * sizeof(struct mem_chunk)); 90 + detect_memory_layout(chunk_array); 91 + create_mem_hole(chunk_array, OLDMEM_BASE, OLDMEM_SIZE, CHUNK_CRASHK); 92 + return chunk_array; 93 + } 94 + 95 + /* 96 + * Initialize ELF note 97 + */ 98 + static void *nt_init(void *buf, Elf64_Word type, void *desc, int d_len, 99 + const char *name) 100 + { 101 + Elf64_Nhdr *note; 102 + u64 len; 103 + 104 + note = (Elf64_Nhdr *)buf; 105 + note->n_namesz = strlen(name) + 1; 106 + note->n_descsz = d_len; 107 + note->n_type = type; 108 + len = sizeof(Elf64_Nhdr); 109 + 110 + memcpy(buf + len, name, note->n_namesz); 111 + len = roundup(len + note->n_namesz, 4); 112 + 113 + memcpy(buf + len, desc, note->n_descsz); 114 + len = roundup(len + note->n_descsz, 4); 115 + 116 + return PTR_ADD(buf, len); 117 + } 118 + 119 + /* 120 + * Initialize prstatus note 121 + */ 122 + static void *nt_prstatus(void *ptr, struct save_area *sa) 123 + { 124 + struct elf_prstatus nt_prstatus; 125 + static int cpu_nr = 1; 126 + 127 + memset(&nt_prstatus, 0, sizeof(nt_prstatus)); 128 + memcpy(&nt_prstatus.pr_reg.gprs, sa->gp_regs, sizeof(sa->gp_regs)); 129 + memcpy(&nt_prstatus.pr_reg.psw, sa->psw, sizeof(sa->psw)); 130 + memcpy(&nt_prstatus.pr_reg.acrs, sa->acc_regs, sizeof(sa->acc_regs)); 131 + nt_prstatus.pr_pid = cpu_nr; 132 + cpu_nr++; 133 + 134 + return nt_init(ptr, NT_PRSTATUS, &nt_prstatus, sizeof(nt_prstatus), 135 + "CORE"); 136 + } 137 + 138 + /* 139 + * Initialize fpregset (floating point) note 140 + */ 141 + static void *nt_fpregset(void *ptr, struct save_area *sa) 142 + { 143 + elf_fpregset_t nt_fpregset; 144 + 145 + memset(&nt_fpregset, 0, sizeof(nt_fpregset)); 146 + memcpy(&nt_fpregset.fpc, &sa->fp_ctrl_reg, sizeof(sa->fp_ctrl_reg)); 147 + memcpy(&nt_fpregset.fprs, &sa->fp_regs, sizeof(sa->fp_regs)); 148 + 149 + return nt_init(ptr, NT_PRFPREG, &nt_fpregset, sizeof(nt_fpregset), 150 + "CORE"); 151 + } 152 + 153 + /* 154 + * Initialize timer note 155 + */ 156 + static void *nt_s390_timer(void *ptr, struct save_area *sa) 157 + { 158 + return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer), 159 + KEXEC_CORE_NOTE_NAME); 160 + } 161 + 162 + /* 163 + * Initialize TOD clock comparator note 164 + */ 165 + static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa) 166 + { 167 + return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp, 168 + sizeof(sa->clk_cmp), KEXEC_CORE_NOTE_NAME); 169 + } 170 + 171 + /* 172 + * Initialize TOD programmable register note 173 + */ 174 + static void *nt_s390_tod_preg(void *ptr, struct save_area *sa) 175 + { 176 + return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg, 177 + sizeof(sa->tod_reg), KEXEC_CORE_NOTE_NAME); 178 + } 179 + 180 + /* 181 + * Initialize control register note 182 + */ 183 + static void *nt_s390_ctrs(void *ptr, struct save_area *sa) 184 + { 185 + return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs, 186 + sizeof(sa->ctrl_regs), KEXEC_CORE_NOTE_NAME); 187 + } 188 + 189 + /* 190 + * Initialize prefix register note 191 + */ 192 + static void *nt_s390_prefix(void *ptr, struct save_area *sa) 193 + { 194 + return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg, 195 + sizeof(sa->pref_reg), KEXEC_CORE_NOTE_NAME); 196 + } 197 + 198 + /* 199 + * Fill ELF notes for one CPU with save area registers 200 + */ 201 + void *fill_cpu_elf_notes(void *ptr, struct save_area *sa) 202 + { 203 + ptr = nt_prstatus(ptr, sa); 204 + ptr = nt_fpregset(ptr, sa); 205 + ptr = nt_s390_timer(ptr, sa); 206 + ptr = nt_s390_tod_cmp(ptr, sa); 207 + ptr = nt_s390_tod_preg(ptr, sa); 208 + ptr = nt_s390_ctrs(ptr, sa); 209 + ptr = nt_s390_prefix(ptr, sa); 210 + return ptr; 211 + } 212 + 213 + /* 214 + * Initialize prpsinfo note (new kernel) 215 + */ 216 + static void *nt_prpsinfo(void *ptr) 217 + { 218 + struct elf_prpsinfo prpsinfo; 219 + 220 + memset(&prpsinfo, 0, sizeof(prpsinfo)); 221 + prpsinfo.pr_sname = 'R'; 222 + strcpy(prpsinfo.pr_fname, "vmlinux"); 223 + return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo), 224 + KEXEC_CORE_NOTE_NAME); 225 + } 226 + 227 + /* 228 + * Initialize vmcoreinfo note (new kernel) 229 + */ 230 + static void *nt_vmcoreinfo(void *ptr) 231 + { 232 + char nt_name[11], *vmcoreinfo; 233 + Elf64_Nhdr note; 234 + void *addr; 235 + 236 + if (copy_from_oldmem(&addr, &S390_lowcore.vmcore_info, sizeof(addr))) 237 + return ptr; 238 + memset(nt_name, 0, sizeof(nt_name)); 239 + if (copy_from_oldmem(&note, addr, sizeof(note))) 240 + return ptr; 241 + if (copy_from_oldmem(nt_name, addr + sizeof(note), sizeof(nt_name) - 1)) 242 + return ptr; 243 + if (strcmp(nt_name, "VMCOREINFO") != 0) 244 + return ptr; 245 + vmcoreinfo = kzalloc_panic(note.n_descsz + 1); 246 + if (copy_from_oldmem(vmcoreinfo, addr + 24, note.n_descsz)) 247 + return ptr; 248 + vmcoreinfo[note.n_descsz + 1] = 0; 249 + return nt_init(ptr, 0, vmcoreinfo, note.n_descsz, "VMCOREINFO"); 250 + } 251 + 252 + /* 253 + * Initialize ELF header (new kernel) 254 + */ 255 + static void *ehdr_init(Elf64_Ehdr *ehdr, int mem_chunk_cnt) 256 + { 257 + memset(ehdr, 0, sizeof(*ehdr)); 258 + memcpy(ehdr->e_ident, ELFMAG, SELFMAG); 259 + ehdr->e_ident[EI_CLASS] = ELFCLASS64; 260 + ehdr->e_ident[EI_DATA] = ELFDATA2MSB; 261 + ehdr->e_ident[EI_VERSION] = EV_CURRENT; 262 + memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); 263 + ehdr->e_type = ET_CORE; 264 + ehdr->e_machine = EM_S390; 265 + ehdr->e_version = EV_CURRENT; 266 + ehdr->e_phoff = sizeof(Elf64_Ehdr); 267 + ehdr->e_ehsize = sizeof(Elf64_Ehdr); 268 + ehdr->e_phentsize = sizeof(Elf64_Phdr); 269 + ehdr->e_phnum = mem_chunk_cnt + 1; 270 + return ehdr + 1; 271 + } 272 + 273 + /* 274 + * Return CPU count for ELF header (new kernel) 275 + */ 276 + static int get_cpu_cnt(void) 277 + { 278 + int i, cpus = 0; 279 + 280 + for (i = 0; zfcpdump_save_areas[i]; i++) { 281 + if (zfcpdump_save_areas[i]->pref_reg == 0) 282 + continue; 283 + cpus++; 284 + } 285 + return cpus; 286 + } 287 + 288 + /* 289 + * Return memory chunk count for ELF header (new kernel) 290 + */ 291 + static int get_mem_chunk_cnt(void) 292 + { 293 + struct mem_chunk *chunk_array, *mem_chunk; 294 + int i, cnt = 0; 295 + 296 + chunk_array = get_memory_layout(); 297 + for (i = 0; i < MEMORY_CHUNKS; i++) { 298 + mem_chunk = &chunk_array[i]; 299 + if (chunk_array[i].type != CHUNK_READ_WRITE && 300 + chunk_array[i].type != CHUNK_READ_ONLY) 301 + continue; 302 + if (mem_chunk->size == 0) 303 + continue; 304 + cnt++; 305 + } 306 + kfree(chunk_array); 307 + return cnt; 308 + } 309 + 310 + /* 311 + * Relocate pointer in order to allow vmcore code access the data 312 + */ 313 + static inline unsigned long relocate(unsigned long addr) 314 + { 315 + return OLDMEM_BASE + addr; 316 + } 317 + 318 + /* 319 + * Initialize ELF loads (new kernel) 320 + */ 321 + static int loads_init(Elf64_Phdr *phdr, u64 loads_offset) 322 + { 323 + struct mem_chunk *chunk_array, *mem_chunk; 324 + int i; 325 + 326 + chunk_array = get_memory_layout(); 327 + for (i = 0; i < MEMORY_CHUNKS; i++) { 328 + mem_chunk = &chunk_array[i]; 329 + if (mem_chunk->size == 0) 330 + break; 331 + if (chunk_array[i].type != CHUNK_READ_WRITE && 332 + chunk_array[i].type != CHUNK_READ_ONLY) 333 + continue; 334 + else 335 + phdr->p_filesz = mem_chunk->size; 336 + phdr->p_type = PT_LOAD; 337 + phdr->p_offset = mem_chunk->addr; 338 + phdr->p_vaddr = mem_chunk->addr; 339 + phdr->p_paddr = mem_chunk->addr; 340 + phdr->p_memsz = mem_chunk->size; 341 + phdr->p_flags = PF_R | PF_W | PF_X; 342 + phdr->p_align = PAGE_SIZE; 343 + phdr++; 344 + } 345 + kfree(chunk_array); 346 + return i; 347 + } 348 + 349 + /* 350 + * Initialize notes (new kernel) 351 + */ 352 + static void *notes_init(Elf64_Phdr *phdr, void *ptr, u64 notes_offset) 353 + { 354 + struct save_area *sa; 355 + void *ptr_start = ptr; 356 + int i; 357 + 358 + ptr = nt_prpsinfo(ptr); 359 + 360 + for (i = 0; zfcpdump_save_areas[i]; i++) { 361 + sa = zfcpdump_save_areas[i]; 362 + if (sa->pref_reg == 0) 363 + continue; 364 + ptr = fill_cpu_elf_notes(ptr, sa); 365 + } 366 + ptr = nt_vmcoreinfo(ptr); 367 + memset(phdr, 0, sizeof(*phdr)); 368 + phdr->p_type = PT_NOTE; 369 + phdr->p_offset = relocate(notes_offset); 370 + phdr->p_filesz = (unsigned long) PTR_SUB(ptr, ptr_start); 371 + phdr->p_memsz = phdr->p_filesz; 372 + return ptr; 373 + } 374 + 375 + /* 376 + * Create ELF core header (new kernel) 377 + */ 378 + static void s390_elf_corehdr_create(char **elfcorebuf, size_t *elfcorebuf_sz) 379 + { 380 + Elf64_Phdr *phdr_notes, *phdr_loads; 381 + int mem_chunk_cnt; 382 + void *ptr, *hdr; 383 + u32 alloc_size; 384 + u64 hdr_off; 385 + 386 + mem_chunk_cnt = get_mem_chunk_cnt(); 387 + 388 + alloc_size = 0x1000 + get_cpu_cnt() * 0x300 + 389 + mem_chunk_cnt * sizeof(Elf64_Phdr); 390 + hdr = kzalloc_panic(alloc_size); 391 + /* Init elf header */ 392 + ptr = ehdr_init(hdr, mem_chunk_cnt); 393 + /* Init program headers */ 394 + phdr_notes = ptr; 395 + ptr = PTR_ADD(ptr, sizeof(Elf64_Phdr)); 396 + phdr_loads = ptr; 397 + ptr = PTR_ADD(ptr, sizeof(Elf64_Phdr) * mem_chunk_cnt); 398 + /* Init notes */ 399 + hdr_off = PTR_DIFF(ptr, hdr); 400 + ptr = notes_init(phdr_notes, ptr, ((unsigned long) hdr) + hdr_off); 401 + /* Init loads */ 402 + hdr_off = PTR_DIFF(ptr, hdr); 403 + loads_init(phdr_loads, ((unsigned long) hdr) + hdr_off); 404 + *elfcorebuf_sz = hdr_off; 405 + *elfcorebuf = (void *) relocate((unsigned long) hdr); 406 + BUG_ON(*elfcorebuf_sz > alloc_size); 407 + } 408 + 409 + /* 410 + * Create kdump ELF core header in new kernel, if it has not been passed via 411 + * the "elfcorehdr" kernel parameter 412 + */ 413 + static int setup_kdump_elfcorehdr(void) 414 + { 415 + size_t elfcorebuf_sz; 416 + char *elfcorebuf; 417 + 418 + if (!OLDMEM_BASE || is_kdump_kernel()) 419 + return -EINVAL; 420 + s390_elf_corehdr_create(&elfcorebuf, &elfcorebuf_sz); 421 + elfcorehdr_addr = (unsigned long long) elfcorebuf; 422 + elfcorehdr_size = elfcorebuf_sz; 423 + return 0; 424 + } 425 + 426 + subsys_initcall(setup_kdump_elfcorehdr);
+1 -1
arch/s390/kernel/early.c
··· 252 252 { 253 253 psw_t psw; 254 254 255 - psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 255 + psw.mask = PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA; 256 256 psw.addr = PSW_ADDR_AMODE | (unsigned long) s390_base_ext_handler; 257 257 S390_lowcore.external_new_psw = psw; 258 258 psw.addr = PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler;
+34 -50
arch/s390/kernel/entry.S
··· 43 43 SP_R14 = STACK_FRAME_OVERHEAD + __PT_GPRS + 56 44 44 SP_R15 = STACK_FRAME_OVERHEAD + __PT_GPRS + 60 45 45 SP_ORIG_R2 = STACK_FRAME_OVERHEAD + __PT_ORIG_GPR2 46 - SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC 47 - SP_SVCNR = STACK_FRAME_OVERHEAD + __PT_SVCNR 46 + SP_SVC_CODE = STACK_FRAME_OVERHEAD + __PT_SVC_CODE 48 47 SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE 49 48 50 49 _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 51 - _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_PER_TRAP ) 50 + _TIF_MCCK_PENDING | _TIF_PER_TRAP ) 52 51 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 53 52 _TIF_MCCK_PENDING) 54 - _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ 55 - _TIF_SECCOMP>>8 | _TIF_SYSCALL_TRACEPOINT>>8) 53 + _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 54 + _TIF_SYSCALL_TRACEPOINT) 56 55 57 56 STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 58 57 STACK_SIZE = 1 << STACK_SHIFT ··· 227 228 sysc_saveall: 228 229 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 229 230 CREATE_STACK_FRAME __LC_SAVE_AREA 230 - mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 231 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 232 231 l %r12,__LC_THREAD_INFO # load pointer to thread_info struct 232 + mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 233 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 234 + oi __TI_flags+3(%r12),_TIF_SYSCALL 233 235 sysc_vtime: 234 236 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 235 237 sysc_stime: ··· 239 239 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 240 240 sysc_do_svc: 241 241 xr %r7,%r7 242 - icm %r7,3,SP_SVCNR(%r15) # load svc number and test for svc 0 242 + icm %r7,3,SP_SVC_CODE+2(%r15)# load svc number and test for svc 0 243 243 bnz BASED(sysc_nr_ok) # svc number > 0 244 244 # svc 0: system call number in %r1 245 245 cl %r1,BASED(.Lnr_syscalls) 246 246 bnl BASED(sysc_nr_ok) 247 - sth %r1,SP_SVCNR(%r15) 247 + sth %r1,SP_SVC_CODE+2(%r15) 248 248 lr %r7,%r1 # copy svc number to %r7 249 249 sysc_nr_ok: 250 250 sll %r7,2 # svc number *4 251 251 l %r10,BASED(.Lsysc_table) 252 - tm __TI_flags+2(%r12),_TIF_SYSCALL 252 + tm __TI_flags+2(%r12),_TIF_TRACE >> 8 253 253 mvc SP_ARGS(4,%r15),SP_R7(%r15) 254 254 l %r8,0(%r7,%r10) # get system call addr. 255 255 bnz BASED(sysc_tracesys) ··· 259 259 sysc_return: 260 260 LOCKDEP_SYS_EXIT 261 261 sysc_tif: 262 + tm SP_PSW+1(%r15),0x01 # returning to user ? 263 + bno BASED(sysc_restore) 262 264 tm __TI_flags+3(%r12),_TIF_WORK_SVC 263 265 bnz BASED(sysc_work) # there is work to do (signals etc.) 266 + ni __TI_flags+3(%r12),255-_TIF_SYSCALL 264 267 sysc_restore: 265 268 RESTORE_ALL __LC_RETURN_PSW,1 266 269 sysc_done: 267 270 268 271 # 269 - # There is work to do, but first we need to check if we return to userspace. 270 - # 271 - sysc_work: 272 - tm SP_PSW+1(%r15),0x01 # returning to user ? 273 - bno BASED(sysc_restore) 274 - 275 - # 276 272 # One of the work bits is on. Find out which one. 277 273 # 278 - sysc_work_tif: 274 + sysc_work: 279 275 tm __TI_flags+3(%r12),_TIF_MCCK_PENDING 280 276 bo BASED(sysc_mcck_pending) 281 277 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED ··· 280 284 bo BASED(sysc_sigpending) 281 285 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME 282 286 bo BASED(sysc_notify_resume) 283 - tm __TI_flags+3(%r12),_TIF_RESTART_SVC 284 - bo BASED(sysc_restart) 285 287 tm __TI_flags+3(%r12),_TIF_PER_TRAP 286 288 bo BASED(sysc_singlestep) 287 289 b BASED(sysc_return) # beware of critical section cleanup ··· 308 314 la %r2,SP_PTREGS(%r15) # load pt_regs 309 315 l %r1,BASED(.Ldo_signal) 310 316 basr %r14,%r1 # call do_signal 311 - tm __TI_flags+3(%r12),_TIF_RESTART_SVC 312 - bo BASED(sysc_restart) 313 - tm __TI_flags+3(%r12),_TIF_PER_TRAP 314 - bo BASED(sysc_singlestep) 315 - b BASED(sysc_return) 317 + tm __TI_flags+3(%r12),_TIF_SYSCALL 318 + bno BASED(sysc_return) 319 + lm %r2,%r6,SP_R2(%r15) # load svc arguments 320 + xr %r7,%r7 # svc 0 returns -ENOSYS 321 + clc SP_SVC_CODE+2(2,%r15),BASED(.Lnr_syscalls+2) 322 + bnl BASED(sysc_nr_ok) # invalid svc number -> do svc 0 323 + icm %r7,3,SP_SVC_CODE+2(%r15)# load new svc number 324 + b BASED(sysc_nr_ok) # restart svc 316 325 317 326 # 318 327 # _TIF_NOTIFY_RESUME is set, call do_notify_resume ··· 326 329 la %r14,BASED(sysc_return) 327 330 br %r1 # call do_notify_resume 328 331 329 - 330 - # 331 - # _TIF_RESTART_SVC is set, set up registers and restart svc 332 - # 333 - sysc_restart: 334 - ni __TI_flags+3(%r12),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC 335 - l %r7,SP_R2(%r15) # load new svc number 336 - mvc SP_R2(4,%r15),SP_ORIG_R2(%r15) # restore first argument 337 - lm %r2,%r6,SP_R2(%r15) # load svc arguments 338 - sth %r7,SP_SVCNR(%r15) 339 - b BASED(sysc_nr_ok) # restart svc 340 - 341 332 # 342 333 # _TIF_PER_TRAP is set, call do_per_trap 343 334 # 344 335 sysc_singlestep: 345 - ni __TI_flags+3(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP 346 - xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number 336 + ni __TI_flags+3(%r12),255-(_TIF_SYSCALL | _TIF_PER_TRAP) 347 337 la %r2,SP_PTREGS(%r15) # address of register-save area 348 338 l %r1,BASED(.Lhandle_per) # load adr. of per handler 349 339 la %r14,BASED(sysc_return) # load adr. of system return ··· 345 361 la %r2,SP_PTREGS(%r15) # load pt_regs 346 362 la %r3,0 347 363 xr %r0,%r0 348 - icm %r0,3,SP_SVCNR(%r15) 364 + icm %r0,3,SP_SVC_CODE(%r15) 349 365 st %r0,SP_R2(%r15) 350 366 basr %r14,%r1 351 367 cl %r2,BASED(.Lnr_syscalls) ··· 360 376 basr %r14,%r8 # call sys_xxx 361 377 st %r2,SP_R2(%r15) # store return value 362 378 sysc_tracenogo: 363 - tm __TI_flags+2(%r12),_TIF_SYSCALL 379 + tm __TI_flags+2(%r12),_TIF_TRACE >> 8 364 380 bz BASED(sysc_return) 365 381 l %r1,BASED(.Ltrace_exit) 366 382 la %r2,SP_PTREGS(%r15) # load pt_regs ··· 438 454 bnz BASED(pgm_per) # got per exception -> special case 439 455 SAVE_ALL_PGM __LC_PGM_OLD_PSW,__LC_SAVE_AREA 440 456 CREATE_STACK_FRAME __LC_SAVE_AREA 441 - xc SP_ILC(4,%r15),SP_ILC(%r15) 442 457 mvc SP_PSW(8,%r15),__LC_PGM_OLD_PSW 443 458 l %r12,__LC_THREAD_INFO # load pointer to thread_info struct 444 459 tm SP_PSW+1(%r15),0x01 # interrupting from user ? ··· 513 530 pgm_svcper: 514 531 SAVE_ALL_PGM __LC_SVC_OLD_PSW,__LC_SAVE_AREA 515 532 CREATE_STACK_FRAME __LC_SAVE_AREA 516 - mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 517 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 518 533 l %r12,__LC_THREAD_INFO # load pointer to thread_info struct 534 + mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 535 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 536 + oi __TI_flags+3(%r12),(_TIF_SYSCALL | _TIF_PER_TRAP) 519 537 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 520 538 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 521 539 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER ··· 524 540 mvc __THREAD_per_cause(2,%r8),__LC_PER_CAUSE 525 541 mvc __THREAD_per_address(4,%r8),__LC_PER_ADDRESS 526 542 mvc __THREAD_per_paid(1,%r8),__LC_PER_PAID 527 - oi __TI_flags+3(%r12),_TIF_PER_TRAP # set TIF_PER_TRAP 528 543 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 529 544 lm %r2,%r6,SP_R2(%r15) # load svc arguments 530 545 b BASED(sysc_do_svc) ··· 533 550 # 534 551 kernel_per: 535 552 REENABLE_IRQS 536 - xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) 537 553 la %r2,SP_PTREGS(%r15) # address of register-save area 538 554 l %r1,BASED(.Lhandle_per) # load adr. of per handler 539 555 basr %r14,%r1 # branch to do_single_step ··· 835 853 # PSW restart interrupt handler 836 854 # 837 855 ENTRY(psw_restart_int_handler) 838 - st %r15,__LC_SAVE_AREA_64(%r0) # save r15 856 + st %r15,__LC_SAVE_AREA+48(%r0) # save r15 839 857 basr %r15,0 840 858 0: l %r15,.Lrestart_stack-0b(%r15) # load restart stack 841 859 l %r15,0(%r15) 842 860 ahi %r15,-SP_SIZE # make room for pt_regs 843 861 stm %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack 844 - mvc SP_R15(4,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack 862 + mvc SP_R15(4,%r15),__LC_SAVE_AREA+48(%r0)# store saved %r15 to stack 845 863 mvc SP_PSW(8,%r15),__LC_RST_OLD_PSW(%r0) # store restart old psw 846 864 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 847 865 basr %r14,0 ··· 947 965 s %r15,BASED(.Lc_spsize) # make room for registers & psw 948 966 st %r15,12(%r12) 949 967 CREATE_STACK_FRAME __LC_SAVE_AREA 950 - mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 951 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 952 968 mvc 0(4,%r12),__LC_THREAD_INFO 969 + l %r12,__LC_THREAD_INFO 970 + mvc SP_PSW(8,%r15),__LC_SVC_OLD_PSW 971 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 972 + oi __TI_flags+3(%r12),_TIF_SYSCALL 953 973 cleanup_vtime: 954 974 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12) 955 975 bhe BASED(cleanup_stime)
+11 -2
arch/s390/kernel/entry.h
··· 5 5 #include <linux/signal.h> 6 6 #include <asm/ptrace.h> 7 7 8 + 9 + extern void (*pgm_check_table[128])(struct pt_regs *, long, unsigned long); 10 + extern void *restart_stack; 11 + 12 + asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 13 + asmlinkage void do_syscall_trace_exit(struct pt_regs *regs); 14 + 8 15 void do_protection_exception(struct pt_regs *, long, unsigned long); 9 16 void do_dat_exception(struct pt_regs *, long, unsigned long); 10 17 void do_asce_exception(struct pt_regs *, long, unsigned long); 11 - 12 - extern int sysctl_userprocess_debug; 13 18 14 19 void do_per_trap(struct pt_regs *regs); 15 20 void syscall_trace(struct pt_regs *regs, int entryexit); ··· 22 17 void do_signal(struct pt_regs *regs); 23 18 int handle_signal32(unsigned long sig, struct k_sigaction *ka, 24 19 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); 20 + void do_notify_resume(struct pt_regs *regs); 25 21 26 22 void do_extint(struct pt_regs *regs, unsigned int, unsigned int, unsigned long); 23 + void do_restart(void); 27 24 int __cpuinit start_secondary(void *cpuvoid); 28 25 void __init startup_init(void); 29 26 void die(const char * str, struct pt_regs * regs, long err); 27 + 28 + void __init time_init(void); 30 29 31 30 struct s390_mmap_arg_struct; 32 31 struct fadvise64_64_args;
+36 -50
arch/s390/kernel/entry64.S
··· 43 43 SP_R14 = STACK_FRAME_OVERHEAD + __PT_GPRS + 112 44 44 SP_R15 = STACK_FRAME_OVERHEAD + __PT_GPRS + 120 45 45 SP_ORIG_R2 = STACK_FRAME_OVERHEAD + __PT_ORIG_GPR2 46 - SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC 47 - SP_SVCNR = STACK_FRAME_OVERHEAD + __PT_SVCNR 46 + SP_SVC_CODE = STACK_FRAME_OVERHEAD + __PT_SVC_CODE 48 47 SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE 49 48 50 49 STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 51 50 STACK_SIZE = 1 << STACK_SHIFT 52 51 53 52 _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 54 - _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_PER_TRAP ) 53 + _TIF_MCCK_PENDING | _TIF_PER_TRAP ) 55 54 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 56 55 _TIF_MCCK_PENDING) 57 - _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ 58 - _TIF_SECCOMP>>8 | _TIF_SYSCALL_TRACEPOINT>>8) 56 + _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 57 + _TIF_SYSCALL_TRACEPOINT) 59 58 _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING) 60 59 61 60 #define BASED(name) name-system_call(%r13) ··· 248 249 sysc_saveall: 249 250 SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 250 251 CREATE_STACK_FRAME __LC_SAVE_AREA 251 - mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 252 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 253 252 lg %r12,__LC_THREAD_INFO # load pointer to thread_info struct 253 + mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 254 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 255 + oi __TI_flags+7(%r12),_TIF_SYSCALL 254 256 sysc_vtime: 255 257 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 256 258 sysc_stime: ··· 260 260 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 261 261 LAST_BREAK 262 262 sysc_do_svc: 263 - llgh %r7,SP_SVCNR(%r15) 263 + llgh %r7,SP_SVC_CODE+2(%r15) 264 264 slag %r7,%r7,2 # shift and test for svc 0 265 265 jnz sysc_nr_ok 266 266 # svc 0: system call number in %r1 267 267 llgfr %r1,%r1 # clear high word in r1 268 268 cghi %r1,NR_syscalls 269 269 jnl sysc_nr_ok 270 - sth %r1,SP_SVCNR(%r15) 270 + sth %r1,SP_SVC_CODE+2(%r15) 271 271 slag %r7,%r1,2 # shift and test for svc 0 272 272 sysc_nr_ok: 273 273 larl %r10,sys_call_table ··· 277 277 larl %r10,sys_call_table_emu # use 31 bit emulation system calls 278 278 sysc_noemu: 279 279 #endif 280 - tm __TI_flags+6(%r12),_TIF_SYSCALL 280 + tm __TI_flags+6(%r12),_TIF_TRACE >> 8 281 281 mvc SP_ARGS(8,%r15),SP_R7(%r15) 282 282 lgf %r8,0(%r7,%r10) # load address of system call routine 283 283 jnz sysc_tracesys ··· 287 287 sysc_return: 288 288 LOCKDEP_SYS_EXIT 289 289 sysc_tif: 290 + tm SP_PSW+1(%r15),0x01 # returning to user ? 291 + jno sysc_restore 290 292 tm __TI_flags+7(%r12),_TIF_WORK_SVC 291 293 jnz sysc_work # there is work to do (signals etc.) 294 + ni __TI_flags+7(%r12),255-_TIF_SYSCALL 292 295 sysc_restore: 293 296 RESTORE_ALL __LC_RETURN_PSW,1 294 297 sysc_done: 295 298 296 299 # 297 - # There is work to do, but first we need to check if we return to userspace. 298 - # 299 - sysc_work: 300 - tm SP_PSW+1(%r15),0x01 # returning to user ? 301 - jno sysc_restore 302 - 303 - # 304 300 # One of the work bits is on. Find out which one. 305 301 # 306 - sysc_work_tif: 302 + sysc_work: 307 303 tm __TI_flags+7(%r12),_TIF_MCCK_PENDING 308 304 jo sysc_mcck_pending 309 305 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED ··· 308 312 jo sysc_sigpending 309 313 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME 310 314 jo sysc_notify_resume 311 - tm __TI_flags+7(%r12),_TIF_RESTART_SVC 312 - jo sysc_restart 313 315 tm __TI_flags+7(%r12),_TIF_PER_TRAP 314 316 jo sysc_singlestep 315 317 j sysc_return # beware of critical section cleanup ··· 333 339 ni __TI_flags+7(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP 334 340 la %r2,SP_PTREGS(%r15) # load pt_regs 335 341 brasl %r14,do_signal # call do_signal 336 - tm __TI_flags+7(%r12),_TIF_RESTART_SVC 337 - jo sysc_restart 338 - tm __TI_flags+7(%r12),_TIF_PER_TRAP 339 - jo sysc_singlestep 340 - j sysc_return 342 + tm __TI_flags+7(%r12),_TIF_SYSCALL 343 + jno sysc_return 344 + lmg %r2,%r6,SP_R2(%r15) # load svc arguments 345 + lghi %r7,0 # svc 0 returns -ENOSYS 346 + lh %r1,SP_SVC_CODE+2(%r15) # load new svc number 347 + cghi %r1,NR_syscalls 348 + jnl sysc_nr_ok # invalid svc number -> do svc 0 349 + slag %r7,%r1,2 350 + j sysc_nr_ok # restart svc 341 351 342 352 # 343 353 # _TIF_NOTIFY_RESUME is set, call do_notify_resume ··· 352 354 jg do_notify_resume # call do_notify_resume 353 355 354 356 # 355 - # _TIF_RESTART_SVC is set, set up registers and restart svc 356 - # 357 - sysc_restart: 358 - ni __TI_flags+7(%r12),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC 359 - lg %r7,SP_R2(%r15) # load new svc number 360 - mvc SP_R2(8,%r15),SP_ORIG_R2(%r15) # restore first argument 361 - lmg %r2,%r6,SP_R2(%r15) # load svc arguments 362 - sth %r7,SP_SVCNR(%r15) 363 - slag %r7,%r7,2 364 - j sysc_nr_ok # restart svc 365 - 366 - # 367 357 # _TIF_PER_TRAP is set, call do_per_trap 368 358 # 369 359 sysc_singlestep: 370 - ni __TI_flags+7(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP 371 - xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number 360 + ni __TI_flags+7(%r12),255-(_TIF_SYSCALL | _TIF_PER_TRAP) 372 361 la %r2,SP_PTREGS(%r15) # address of register-save area 373 362 larl %r14,sysc_return # load adr. of system return 374 363 jg do_per_trap ··· 367 382 sysc_tracesys: 368 383 la %r2,SP_PTREGS(%r15) # load pt_regs 369 384 la %r3,0 370 - llgh %r0,SP_SVCNR(%r15) 385 + llgh %r0,SP_SVC_CODE+2(%r15) 371 386 stg %r0,SP_R2(%r15) 372 387 brasl %r14,do_syscall_trace_enter 373 388 lghi %r0,NR_syscalls ··· 382 397 basr %r14,%r8 # call sys_xxx 383 398 stg %r2,SP_R2(%r15) # store return value 384 399 sysc_tracenogo: 385 - tm __TI_flags+6(%r12),_TIF_SYSCALL 400 + tm __TI_flags+6(%r12),_TIF_TRACE >> 8 386 401 jz sysc_return 387 402 la %r2,SP_PTREGS(%r15) # load pt_regs 388 403 larl %r14,sysc_return # return point is sysc_return ··· 455 470 jnz pgm_per # got per exception -> special case 456 471 SAVE_ALL_PGM __LC_PGM_OLD_PSW,__LC_SAVE_AREA 457 472 CREATE_STACK_FRAME __LC_SAVE_AREA 458 - xc SP_ILC(4,%r15),SP_ILC(%r15) 459 473 mvc SP_PSW(16,%r15),__LC_PGM_OLD_PSW 460 474 lg %r12,__LC_THREAD_INFO # load pointer to thread_info struct 461 475 HANDLE_SIE_INTERCEPT ··· 534 550 pgm_svcper: 535 551 SAVE_ALL_PGM __LC_SVC_OLD_PSW,__LC_SAVE_AREA 536 552 CREATE_STACK_FRAME __LC_SAVE_AREA 537 - mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 538 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 539 553 lg %r12,__LC_THREAD_INFO # load pointer to thread_info struct 554 + mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 555 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 556 + oi __TI_flags+7(%r12),(_TIF_SYSCALL | _TIF_PER_TRAP) 540 557 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 541 558 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 542 559 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER ··· 546 561 mvc __THREAD_per_cause(2,%r8),__LC_PER_CAUSE 547 562 mvc __THREAD_per_address(8,%r8),__LC_PER_ADDRESS 548 563 mvc __THREAD_per_paid(1,%r8),__LC_PER_PAID 549 - oi __TI_flags+7(%r12),_TIF_PER_TRAP # set TIF_PER_TRAP 550 564 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 551 565 lmg %r2,%r6,SP_R2(%r15) # load svc arguments 552 566 j sysc_do_svc ··· 555 571 # 556 572 kernel_per: 557 573 REENABLE_IRQS 558 - xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number 559 574 la %r2,SP_PTREGS(%r15) # address of register-save area 560 575 brasl %r14,do_per_trap 561 576 j pgm_exit ··· 852 869 # PSW restart interrupt handler 853 870 # 854 871 ENTRY(psw_restart_int_handler) 855 - stg %r15,__LC_SAVE_AREA_64(%r0) # save r15 872 + stg %r15,__LC_SAVE_AREA+120(%r0) # save r15 856 873 larl %r15,restart_stack # load restart stack 857 874 lg %r15,0(%r15) 858 875 aghi %r15,-SP_SIZE # make room for pt_regs 859 876 stmg %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack 860 - mvc SP_R15(8,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack 877 + mvc SP_R15(8,%r15),__LC_SAVE_AREA+120(%r0)# store saved %r15 to stack 861 878 mvc SP_PSW(16,%r15),__LC_RST_OLD_PSW(%r0)# store restart old psw 862 879 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 863 880 brasl %r14,do_restart ··· 955 972 stg %r15,32(%r12) 956 973 stg %r11,0(%r12) 957 974 CREATE_STACK_FRAME __LC_SAVE_AREA 958 - mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 959 - mvc SP_ILC(4,%r15),__LC_SVC_ILC 960 975 mvc 8(8,%r12),__LC_THREAD_INFO 976 + lg %r12,__LC_THREAD_INFO 977 + mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 978 + mvc SP_SVC_CODE(4,%r15),__LC_SVC_ILC 979 + oi __TI_flags+7(%r12),_TIF_SYSCALL 961 980 cleanup_vtime: 962 981 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24) 963 982 jhe cleanup_stime ··· 1081 1096 lghi %r2,0 1082 1097 br %r14 1083 1098 sie_fault: 1099 + lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 1084 1100 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1085 1101 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8) 1086 1102 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
+22
arch/s390/kernel/head.S
··· 449 449 # 450 450 .org 0x10000 451 451 ENTRY(startup) 452 + j .Lep_startup_normal 453 + .org 0x10008 454 + # 455 + # This is a list of s390 kernel entry points. At address 0x1000f the number of 456 + # valid entry points is stored. 457 + # 458 + # IMPORTANT: Do not change this table, it is s390 kernel ABI! 459 + # 460 + .ascii "S390EP" 461 + .byte 0x00,0x01 462 + # 463 + # kdump startup-code at 0x10010, running in 64 bit absolute addressing mode 464 + # 465 + .org 0x10010 466 + ENTRY(startup_kdump) 467 + j .Lep_startup_kdump 468 + .Lep_startup_normal: 452 469 basr %r13,0 # get base 453 470 .LPG0: 454 471 xc 0x200(256),0x200 # partially clear lowcore 455 472 xc 0x300(256),0x300 473 + xc 0xe00(256),0xe00 456 474 stck __LC_LAST_UPDATE_CLOCK 457 475 spt 5f-.LPG0(%r13) 458 476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) ··· 552 534 .align 8 553 535 5: .long 0x7fffffff,0xffffffff 554 536 537 + #include "head_kdump.S" 538 + 555 539 # 556 540 # params at 10400 (setup.h) 557 541 # ··· 561 541 .long 0,0 # IPL_DEVICE 562 542 .long 0,0 # INITRD_START 563 543 .long 0,0 # INITRD_SIZE 544 + .long 0,0 # OLDMEM_BASE 545 + .long 0,0 # OLDMEM_SIZE 564 546 565 547 .org COMMAND_LINE 566 548 .byte "root=/dev/ram0 ro"
+1 -1
arch/s390/kernel/head31.S
··· 92 92 .LPG3: 93 93 # check control registers 94 94 stctl %c0,%c15,0(%r15) 95 - oi 2(%r15),0x40 # enable sigp emergency signal 95 + oi 2(%r15),0x60 # enable sigp emergency & external call 96 96 oi 0(%r15),0x10 # switch on low address protection 97 97 lctl %c0,%c15,0(%r15) 98 98
+1 -1
arch/s390/kernel/head64.S
··· 90 90 .LPG3: 91 91 # check control registers 92 92 stctg %c0,%c15,0(%r15) 93 - oi 6(%r15),0x40 # enable sigp emergency signal 93 + oi 6(%r15),0x60 # enable sigp emergency & external call 94 94 oi 4(%r15),0x10 # switch on low address proctection 95 95 lctlg %c0,%c15,0(%r15) 96 96
+119
arch/s390/kernel/head_kdump.S
··· 1 + /* 2 + * S390 kdump lowlevel functions (new kernel) 3 + * 4 + * Copyright IBM Corp. 2011 5 + * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com> 6 + */ 7 + 8 + #define DATAMOVER_ADDR 0x4000 9 + #define COPY_PAGE_ADDR 0x6000 10 + 11 + #ifdef CONFIG_CRASH_DUMP 12 + 13 + # 14 + # kdump entry (new kernel - not yet relocated) 15 + # 16 + # Note: This code has to be position independent 17 + # 18 + 19 + .align 2 20 + .Lep_startup_kdump: 21 + lhi %r1,2 # mode 2 = esame (dump) 22 + sigp %r1,%r0,0x12 # Switch to esame mode 23 + sam64 # Switch to 64 bit addressing 24 + basr %r13,0 25 + .Lbase: 26 + larl %r2,.Lbase_addr # Check, if we have been 27 + lg %r2,0(%r2) # already relocated: 28 + clgr %r2,%r13 # 29 + jne .Lrelocate # No : Start data mover 30 + lghi %r2,0 # Yes: Start kdump kernel 31 + brasl %r14,startup_kdump_relocated 32 + 33 + .Lrelocate: 34 + larl %r4,startup 35 + lg %r2,0x418(%r4) # Get kdump base 36 + lg %r3,0x420(%r4) # Get kdump size 37 + 38 + larl %r10,.Lcopy_start # Source of data mover 39 + lghi %r8,DATAMOVER_ADDR # Target of data mover 40 + mvc 0(256,%r8),0(%r10) # Copy data mover code 41 + 42 + agr %r8,%r2 # Copy data mover to 43 + mvc 0(256,%r8),0(%r10) # reserved mem 44 + 45 + lghi %r14,DATAMOVER_ADDR # Jump to copied data mover 46 + basr %r14,%r14 47 + .Lbase_addr: 48 + .quad .Lbase 49 + 50 + # 51 + # kdump data mover code (runs at address DATAMOVER_ADDR) 52 + # 53 + # r2: kdump base address 54 + # r3: kdump size 55 + # 56 + .Lcopy_start: 57 + basr %r13,0 # Base 58 + 0: 59 + lgr %r11,%r2 # Save kdump base address 60 + lgr %r12,%r2 61 + agr %r12,%r3 # Compute kdump end address 62 + 63 + lghi %r5,0 64 + lghi %r10,COPY_PAGE_ADDR # Load copy page address 65 + 1: 66 + mvc 0(256,%r10),0(%r5) # Copy old kernel to tmp 67 + mvc 0(256,%r5),0(%r11) # Copy new kernel to old 68 + mvc 0(256,%r11),0(%r10) # Copy tmp to new 69 + aghi %r11,256 70 + aghi %r5,256 71 + clgr %r11,%r12 72 + jl 1b 73 + 74 + lg %r14,.Lstartup_kdump-0b(%r13) 75 + basr %r14,%r14 # Start relocated kernel 76 + .Lstartup_kdump: 77 + .long 0x00000000,0x00000000 + startup_kdump_relocated 78 + .Lcopy_end: 79 + 80 + # 81 + # Startup of kdump (relocated new kernel) 82 + # 83 + .align 2 84 + startup_kdump_relocated: 85 + basr %r13,0 86 + 0: 87 + mvc 0(8,%r0),.Lrestart_psw-0b(%r13) # Setup restart PSW 88 + mvc 464(16,%r0),.Lpgm_psw-0b(%r13) # Setup pgm check PSW 89 + lhi %r1,1 # Start new kernel 90 + diag %r1,%r1,0x308 # with diag 308 91 + 92 + .Lno_diag308: # No diag 308 93 + sam31 # Switch to 31 bit addr mode 94 + sr %r1,%r1 # Erase register r1 95 + sr %r2,%r2 # Erase register r2 96 + sigp %r1,%r2,0x12 # Switch to 31 bit arch mode 97 + lpsw 0 # Start new kernel... 98 + .align 8 99 + .Lrestart_psw: 100 + .long 0x00080000,0x80000000 + startup 101 + .Lpgm_psw: 102 + .quad 0x0000000180000000,0x0000000000000000 + .Lno_diag308 103 + #else 104 + .align 2 105 + .Lep_startup_kdump: 106 + #ifdef CONFIG_64BIT 107 + larl %r13,startup_kdump_crash 108 + lpswe 0(%r13) 109 + .align 8 110 + startup_kdump_crash: 111 + .quad 0x0002000080000000,0x0000000000000000 + startup_kdump_crash 112 + #else 113 + basr %r13,0 114 + 0: lpsw startup_kdump_crash-0b(%r13) 115 + .align 8 116 + startup_kdump_crash: 117 + .long 0x000a0000,0x00000000 + startup_kdump_crash 118 + #endif /* CONFIG_64BIT */ 119 + #endif /* CONFIG_CRASH_DUMP */
+19 -9
arch/s390/kernel/ipl.c
··· 16 16 #include <linux/ctype.h> 17 17 #include <linux/fs.h> 18 18 #include <linux/gfp.h> 19 + #include <linux/crash_dump.h> 19 20 #include <asm/ipl.h> 20 21 #include <asm/smp.h> 21 22 #include <asm/setup.h> ··· 27 26 #include <asm/sclp.h> 28 27 #include <asm/sigp.h> 29 28 #include <asm/checksum.h> 29 + #include "entry.h" 30 30 31 31 #define IPL_PARM_BLOCK_VERSION 0 32 32 ··· 277 275 static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); 278 276 279 277 /* VM IPL PARM routines */ 280 - size_t reipl_get_ascii_vmparm(char *dest, size_t size, 281 - const struct ipl_parameter_block *ipb) 278 + static size_t reipl_get_ascii_vmparm(char *dest, size_t size, 279 + const struct ipl_parameter_block *ipb) 282 280 { 283 281 int i; 284 282 size_t len; ··· 340 338 return count; 341 339 } 342 340 343 - size_t reipl_append_ascii_scpdata(char *dest, size_t size, 344 - const struct ipl_parameter_block *ipb) 341 + static size_t reipl_append_ascii_scpdata(char *dest, size_t size, 342 + const struct ipl_parameter_block *ipb) 345 343 { 346 344 size_t count; 347 345 size_t i; ··· 1740 1738 1741 1739 void do_restart(void) 1742 1740 { 1741 + smp_restart_with_online_cpu(); 1743 1742 smp_send_stop(); 1743 + #ifdef CONFIG_CRASH_DUMP 1744 + crash_kexec(NULL); 1745 + #endif 1744 1746 on_restart_trigger.action->fn(&on_restart_trigger); 1745 1747 stop_run(&on_restart_trigger); 1746 1748 } ··· 2015 2009 2016 2010 u32 dump_prefix_page; 2017 2011 2018 - void s390_reset_system(void) 2012 + void s390_reset_system(void (*func)(void *), void *data) 2019 2013 { 2020 2014 struct _lowcore *lc; 2021 2015 ··· 2034 2028 __ctl_clear_bit(0,28); 2035 2029 2036 2030 /* Set new machine check handler */ 2037 - S390_lowcore.mcck_new_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK; 2031 + S390_lowcore.mcck_new_psw.mask = psw_kernel_bits | PSW_MASK_DAT; 2038 2032 S390_lowcore.mcck_new_psw.addr = 2039 2033 PSW_ADDR_AMODE | (unsigned long) s390_base_mcck_handler; 2040 2034 2041 2035 /* Set new program check handler */ 2042 - S390_lowcore.program_new_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK; 2036 + S390_lowcore.program_new_psw.mask = psw_kernel_bits | PSW_MASK_DAT; 2043 2037 S390_lowcore.program_new_psw.addr = 2044 2038 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; 2045 2039 2046 - do_reset_calls(); 2047 - } 2040 + /* Store status at absolute zero */ 2041 + store_status(); 2048 2042 2043 + do_reset_calls(); 2044 + if (func) 2045 + func(data); 2046 + }
+4 -2
arch/s390/kernel/irq.c
··· 33 33 {.name = "EXT" }, 34 34 {.name = "I/O" }, 35 35 {.name = "CLK", .desc = "[EXT] Clock Comparator" }, 36 - {.name = "IPI", .desc = "[EXT] Signal Processor" }, 36 + {.name = "EXC", .desc = "[EXT] External Call" }, 37 + {.name = "EMS", .desc = "[EXT] Emergency Signal" }, 37 38 {.name = "TMR", .desc = "[EXT] CPU Timer" }, 38 39 {.name = "TAL", .desc = "[EXT] Timing Alert" }, 39 40 {.name = "PFL", .desc = "[EXT] Pseudo Page Fault" }, ··· 43 42 {.name = "SCP", .desc = "[EXT] Service Call" }, 44 43 {.name = "IUC", .desc = "[EXT] IUCV" }, 45 44 {.name = "CPM", .desc = "[EXT] CPU Measurement" }, 45 + {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt" }, 46 46 {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt" }, 47 - {.name = "QDI", .desc = "[I/O] QDIO Interrupt" }, 48 47 {.name = "DAS", .desc = "[I/O] DASD" }, 49 48 {.name = "C15", .desc = "[I/O] 3215" }, 50 49 {.name = "C70", .desc = "[I/O] 3270" }, ··· 54 53 {.name = "CLW", .desc = "[I/O] CLAW" }, 55 54 {.name = "CTC", .desc = "[I/O] CTC" }, 56 55 {.name = "APB", .desc = "[I/O] AP Bus" }, 56 + {.name = "CSC", .desc = "[I/O] CHSC Subchannel" }, 57 57 {.name = "NMI", .desc = "[NMI] Machine Check" }, 58 58 }; 59 59
+1 -1
arch/s390/kernel/kprobes.c
··· 635 635 asm volatile(".word 0x0002"); 636 636 } 637 637 638 - void __kprobes jprobe_return_end(void) 638 + static void __used __kprobes jprobe_return_end(void) 639 639 { 640 640 asm volatile("bcr 0,0"); 641 641 }
+186 -6
arch/s390/kernel/machine_kexec.c
··· 1 1 /* 2 2 * arch/s390/kernel/machine_kexec.c 3 3 * 4 - * Copyright IBM Corp. 2005,2006 4 + * Copyright IBM Corp. 2005,2011 5 5 * 6 6 * Author(s): Rolf Adelsberger, 7 7 * Heiko Carstens <heiko.carstens@de.ibm.com> 8 + * Michael Holzheu <holzheu@linux.vnet.ibm.com> 8 9 */ 9 10 10 11 #include <linux/device.h> ··· 22 21 #include <asm/smp.h> 23 22 #include <asm/reset.h> 24 23 #include <asm/ipl.h> 24 + #include <asm/diag.h> 25 + #include <asm/asm-offsets.h> 25 26 26 27 typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long); 27 28 28 29 extern const unsigned char relocate_kernel[]; 29 30 extern const unsigned long long relocate_kernel_len; 31 + 32 + #ifdef CONFIG_CRASH_DUMP 33 + 34 + void *fill_cpu_elf_notes(void *ptr, struct save_area *sa); 35 + 36 + /* 37 + * Create ELF notes for one CPU 38 + */ 39 + static void add_elf_notes(int cpu) 40 + { 41 + struct save_area *sa = (void *) 4608 + store_prefix(); 42 + void *ptr; 43 + 44 + memcpy((void *) (4608UL + sa->pref_reg), sa, sizeof(*sa)); 45 + ptr = (u64 *) per_cpu_ptr(crash_notes, cpu); 46 + ptr = fill_cpu_elf_notes(ptr, sa); 47 + memset(ptr, 0, sizeof(struct elf_note)); 48 + } 49 + 50 + /* 51 + * Store status of next available physical CPU 52 + */ 53 + static int store_status_next(int start_cpu, int this_cpu) 54 + { 55 + struct save_area *sa = (void *) 4608 + store_prefix(); 56 + int cpu, rc; 57 + 58 + for (cpu = start_cpu; cpu < 65536; cpu++) { 59 + if (cpu == this_cpu) 60 + continue; 61 + do { 62 + rc = raw_sigp(cpu, sigp_stop_and_store_status); 63 + } while (rc == sigp_busy); 64 + if (rc != sigp_order_code_accepted) 65 + continue; 66 + if (sa->pref_reg) 67 + return cpu; 68 + } 69 + return -1; 70 + } 71 + 72 + /* 73 + * Initialize CPU ELF notes 74 + */ 75 + void setup_regs(void) 76 + { 77 + unsigned long sa = S390_lowcore.prefixreg_save_area + SAVE_AREA_BASE; 78 + int cpu, this_cpu, phys_cpu = 0, first = 1; 79 + 80 + this_cpu = stap(); 81 + 82 + if (!S390_lowcore.prefixreg_save_area) 83 + first = 0; 84 + for_each_online_cpu(cpu) { 85 + if (first) { 86 + add_elf_notes(cpu); 87 + first = 0; 88 + continue; 89 + } 90 + phys_cpu = store_status_next(phys_cpu, this_cpu); 91 + if (phys_cpu == -1) 92 + break; 93 + add_elf_notes(cpu); 94 + phys_cpu++; 95 + } 96 + /* Copy dump CPU store status info to absolute zero */ 97 + memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area)); 98 + } 99 + 100 + #endif 101 + 102 + /* 103 + * Start kdump: We expect here that a store status has been done on our CPU 104 + */ 105 + static void __do_machine_kdump(void *image) 106 + { 107 + #ifdef CONFIG_CRASH_DUMP 108 + int (*start_kdump)(int) = (void *)((struct kimage *) image)->start; 109 + 110 + __load_psw_mask(PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA); 111 + setup_regs(); 112 + start_kdump(1); 113 + #endif 114 + } 115 + 116 + /* 117 + * Check if kdump checksums are valid: We call purgatory with parameter "0" 118 + */ 119 + static int kdump_csum_valid(struct kimage *image) 120 + { 121 + #ifdef CONFIG_CRASH_DUMP 122 + int (*start_kdump)(int) = (void *)image->start; 123 + int rc; 124 + 125 + __arch_local_irq_stnsm(0xfb); /* disable DAT */ 126 + rc = start_kdump(0); 127 + __arch_local_irq_stosm(0x04); /* enable DAT */ 128 + return rc ? 0 : -EINVAL; 129 + #else 130 + return -EINVAL; 131 + #endif 132 + } 133 + 134 + /* 135 + * Map or unmap crashkernel memory 136 + */ 137 + static void crash_map_pages(int enable) 138 + { 139 + unsigned long size = resource_size(&crashk_res); 140 + 141 + BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN || 142 + size % KEXEC_CRASH_MEM_ALIGN); 143 + if (enable) 144 + vmem_add_mapping(crashk_res.start, size); 145 + else 146 + vmem_remove_mapping(crashk_res.start, size); 147 + } 148 + 149 + /* 150 + * Map crashkernel memory 151 + */ 152 + void crash_map_reserved_pages(void) 153 + { 154 + crash_map_pages(1); 155 + } 156 + 157 + /* 158 + * Unmap crashkernel memory 159 + */ 160 + void crash_unmap_reserved_pages(void) 161 + { 162 + crash_map_pages(0); 163 + } 164 + 165 + /* 166 + * Give back memory to hypervisor before new kdump is loaded 167 + */ 168 + static int machine_kexec_prepare_kdump(void) 169 + { 170 + #ifdef CONFIG_CRASH_DUMP 171 + if (MACHINE_IS_VM) 172 + diag10_range(PFN_DOWN(crashk_res.start), 173 + PFN_DOWN(crashk_res.end - crashk_res.start + 1)); 174 + return 0; 175 + #else 176 + return -EINVAL; 177 + #endif 178 + } 30 179 31 180 int machine_kexec_prepare(struct kimage *image) 32 181 { ··· 185 34 /* Can't replace kernel image since it is read-only. */ 186 35 if (ipl_flags & IPL_NSS_VALID) 187 36 return -ENOSYS; 37 + 38 + if (image->type == KEXEC_TYPE_CRASH) 39 + return machine_kexec_prepare_kdump(); 188 40 189 41 /* We don't support anything but the default image type for now. */ 190 42 if (image->type != KEXEC_TYPE_DEFAULT) ··· 205 51 { 206 52 } 207 53 54 + void arch_crash_save_vmcoreinfo(void) 55 + { 56 + VMCOREINFO_SYMBOL(lowcore_ptr); 57 + VMCOREINFO_LENGTH(lowcore_ptr, NR_CPUS); 58 + } 59 + 208 60 void machine_shutdown(void) 209 61 { 210 62 } 211 63 212 - static void __machine_kexec(void *data) 64 + /* 65 + * Do normal kexec 66 + */ 67 + static void __do_machine_kexec(void *data) 213 68 { 214 69 relocate_kernel_t data_mover; 215 70 struct kimage *image = data; 216 - 217 - pfault_fini(); 218 - s390_reset_system(); 219 71 220 72 data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page); 221 73 222 74 /* Call the moving routine */ 223 75 (*data_mover)(&image->head, image->start); 224 - for (;;); 225 76 } 226 77 78 + /* 79 + * Reset system and call either kdump or normal kexec 80 + */ 81 + static void __machine_kexec(void *data) 82 + { 83 + struct kimage *image = data; 84 + 85 + pfault_fini(); 86 + if (image->type == KEXEC_TYPE_CRASH) 87 + s390_reset_system(__do_machine_kdump, data); 88 + else 89 + s390_reset_system(__do_machine_kexec, data); 90 + disabled_wait((unsigned long) __builtin_return_address(0)); 91 + } 92 + 93 + /* 94 + * Do either kdump or normal kexec. In case of kdump we first ask 95 + * purgatory, if kdump checksums are valid. 96 + */ 227 97 void machine_kexec(struct kimage *image) 228 98 { 99 + if (image->type == KEXEC_TYPE_CRASH && !kdump_csum_valid(image)) 100 + return; 229 101 tracer_disable(); 230 102 smp_send_stop(); 231 103 smp_switch_to_ipl_cpu(__machine_kexec, image);
+69
arch/s390/kernel/mem_detect.c
··· 62 62 arch_local_irq_restore(flags); 63 63 } 64 64 EXPORT_SYMBOL(detect_memory_layout); 65 + 66 + /* 67 + * Create memory hole with given address, size, and type 68 + */ 69 + void create_mem_hole(struct mem_chunk chunks[], unsigned long addr, 70 + unsigned long size, int type) 71 + { 72 + unsigned long start, end, new_size; 73 + int i; 74 + 75 + for (i = 0; i < MEMORY_CHUNKS; i++) { 76 + if (chunks[i].size == 0) 77 + continue; 78 + if (addr + size < chunks[i].addr) 79 + continue; 80 + if (addr >= chunks[i].addr + chunks[i].size) 81 + continue; 82 + start = max(addr, chunks[i].addr); 83 + end = min(addr + size, chunks[i].addr + chunks[i].size); 84 + new_size = end - start; 85 + if (new_size == 0) 86 + continue; 87 + if (start == chunks[i].addr && 88 + end == chunks[i].addr + chunks[i].size) { 89 + /* Remove chunk */ 90 + chunks[i].type = type; 91 + } else if (start == chunks[i].addr) { 92 + /* Make chunk smaller at start */ 93 + if (i >= MEMORY_CHUNKS - 1) 94 + panic("Unable to create memory hole"); 95 + memmove(&chunks[i + 1], &chunks[i], 96 + sizeof(struct mem_chunk) * 97 + (MEMORY_CHUNKS - (i + 1))); 98 + chunks[i + 1].addr = chunks[i].addr + new_size; 99 + chunks[i + 1].size = chunks[i].size - new_size; 100 + chunks[i].size = new_size; 101 + chunks[i].type = type; 102 + i += 1; 103 + } else if (end == chunks[i].addr + chunks[i].size) { 104 + /* Make chunk smaller at end */ 105 + if (i >= MEMORY_CHUNKS - 1) 106 + panic("Unable to create memory hole"); 107 + memmove(&chunks[i + 1], &chunks[i], 108 + sizeof(struct mem_chunk) * 109 + (MEMORY_CHUNKS - (i + 1))); 110 + chunks[i + 1].addr = start; 111 + chunks[i + 1].size = new_size; 112 + chunks[i + 1].type = type; 113 + chunks[i].size -= new_size; 114 + i += 1; 115 + } else { 116 + /* Create memory hole */ 117 + if (i >= MEMORY_CHUNKS - 2) 118 + panic("Unable to create memory hole"); 119 + memmove(&chunks[i + 2], &chunks[i], 120 + sizeof(struct mem_chunk) * 121 + (MEMORY_CHUNKS - (i + 2))); 122 + chunks[i + 1].addr = addr; 123 + chunks[i + 1].size = size; 124 + chunks[i + 1].type = type; 125 + chunks[i + 2].addr = addr + size; 126 + chunks[i + 2].size = 127 + chunks[i].addr + chunks[i].size - (addr + size); 128 + chunks[i + 2].type = chunks[i].type; 129 + chunks[i].size = addr - chunks[i].addr; 130 + i += 2; 131 + } 132 + } 133 + }
+3 -1
arch/s390/kernel/process.c
··· 12 12 #include <linux/sched.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/mm.h> 15 + #include <linux/elfcore.h> 15 16 #include <linux/smp.h> 16 17 #include <linux/slab.h> 17 18 #include <linux/interrupt.h> ··· 118 117 struct pt_regs regs; 119 118 120 119 memset(&regs, 0, sizeof(regs)); 121 - regs.psw.mask = psw_kernel_bits | PSW_MASK_IO | PSW_MASK_EXT; 120 + regs.psw.mask = psw_kernel_bits | 121 + PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 122 122 regs.psw.addr = (unsigned long) kernel_thread_starter | PSW_ADDR_AMODE; 123 123 regs.gprs[9] = (unsigned long) fn; 124 124 regs.gprs[10] = (unsigned long) arg;
+1 -1
arch/s390/kernel/processor.c
··· 74 74 75 75 static void *c_start(struct seq_file *m, loff_t *pos) 76 76 { 77 - return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL; 77 + return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL; 78 78 } 79 79 80 80 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
+84 -38
arch/s390/kernel/ptrace.c
··· 42 42 REGSET_GENERAL, 43 43 REGSET_FP, 44 44 REGSET_LAST_BREAK, 45 + REGSET_SYSTEM_CALL, 45 46 REGSET_GENERAL_EXTENDED, 46 47 }; 47 48 48 49 void update_per_regs(struct task_struct *task) 49 50 { 50 - static const struct per_regs per_single_step = { 51 - .control = PER_EVENT_IFETCH, 52 - .start = 0, 53 - .end = PSW_ADDR_INSN, 54 - }; 55 51 struct pt_regs *regs = task_pt_regs(task); 56 52 struct thread_struct *thread = &task->thread; 57 - const struct per_regs *new; 58 - struct per_regs old; 53 + struct per_regs old, new; 59 54 60 - /* TIF_SINGLE_STEP overrides the user specified PER registers. */ 61 - new = test_tsk_thread_flag(task, TIF_SINGLE_STEP) ? 62 - &per_single_step : &thread->per_user; 55 + /* Copy user specified PER registers */ 56 + new.control = thread->per_user.control; 57 + new.start = thread->per_user.start; 58 + new.end = thread->per_user.end; 59 + 60 + /* merge TIF_SINGLE_STEP into user specified PER registers. */ 61 + if (test_tsk_thread_flag(task, TIF_SINGLE_STEP)) { 62 + new.control |= PER_EVENT_IFETCH; 63 + new.start = 0; 64 + new.end = PSW_ADDR_INSN; 65 + } 63 66 64 67 /* Take care of the PER enablement bit in the PSW. */ 65 - if (!(new->control & PER_EVENT_MASK)) { 68 + if (!(new.control & PER_EVENT_MASK)) { 66 69 regs->psw.mask &= ~PSW_MASK_PER; 67 70 return; 68 71 } 69 72 regs->psw.mask |= PSW_MASK_PER; 70 73 __ctl_store(old, 9, 11); 71 - if (memcmp(new, &old, sizeof(struct per_regs)) != 0) 72 - __ctl_load(*new, 9, 11); 74 + if (memcmp(&new, &old, sizeof(struct per_regs)) != 0) 75 + __ctl_load(new, 9, 11); 73 76 } 74 77 75 78 void user_enable_single_step(struct task_struct *task) ··· 169 166 */ 170 167 tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr); 171 168 if (addr == (addr_t) &dummy->regs.psw.mask) 172 - /* Remove per bit from user psw. */ 173 - tmp &= ~PSW_MASK_PER; 169 + /* Return a clean psw mask. */ 170 + tmp = psw_user_bits | (tmp & PSW_MASK_USER); 174 171 175 172 } else if (addr < (addr_t) &dummy->regs.orig_gpr2) { 176 173 /* ··· 292 289 * psw and gprs are stored on the stack 293 290 */ 294 291 if (addr == (addr_t) &dummy->regs.psw.mask && 295 - #ifdef CONFIG_COMPAT 296 - data != PSW_MASK_MERGE(psw_user32_bits, data) && 297 - #endif 298 - data != PSW_MASK_MERGE(psw_user_bits, data)) 292 + ((data & ~PSW_MASK_USER) != psw_user_bits || 293 + ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) 299 294 /* Invalid psw mask. */ 300 295 return -EINVAL; 301 - #ifndef CONFIG_64BIT 302 296 if (addr == (addr_t) &dummy->regs.psw.addr) 303 - /* I'd like to reject addresses without the 304 - high order bit but older gdb's rely on it */ 305 - data |= PSW_ADDR_AMODE; 306 - #endif 297 + /* 298 + * The debugger changed the instruction address, 299 + * reset system call restart, see signal.c:do_signal 300 + */ 301 + task_thread_info(child)->system_call = 0; 302 + 307 303 *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; 308 304 309 305 } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { ··· 497 495 __u32 tmp; 498 496 499 497 if (addr < (addr_t) &dummy32->regs.acrs) { 498 + struct pt_regs *regs = task_pt_regs(child); 500 499 /* 501 500 * psw and gprs are stored on the stack 502 501 */ 503 502 if (addr == (addr_t) &dummy32->regs.psw.mask) { 504 503 /* Fake a 31 bit psw mask. */ 505 - tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32); 506 - tmp = PSW32_MASK_MERGE(psw32_user_bits, tmp); 504 + tmp = (__u32)(regs->psw.mask >> 32); 505 + tmp = psw32_user_bits | (tmp & PSW32_MASK_USER); 507 506 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 508 507 /* Fake a 31 bit psw address. */ 509 - tmp = (__u32) task_pt_regs(child)->psw.addr | 510 - PSW32_ADDR_AMODE31; 508 + tmp = (__u32) regs->psw.addr | 509 + (__u32)(regs->psw.mask & PSW_MASK_BA); 511 510 } else { 512 511 /* gpr 0-15 */ 513 - tmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw + 514 - addr*2 + 4); 512 + tmp = *(__u32 *)((addr_t) &regs->psw + addr*2 + 4); 515 513 } 516 514 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { 517 515 /* ··· 596 594 addr_t offset; 597 595 598 596 if (addr < (addr_t) &dummy32->regs.acrs) { 597 + struct pt_regs *regs = task_pt_regs(child); 599 598 /* 600 599 * psw, gprs, acrs and orig_gpr2 are stored on the stack 601 600 */ 602 601 if (addr == (addr_t) &dummy32->regs.psw.mask) { 603 602 /* Build a 64 bit psw mask from 31 bit mask. */ 604 - if (tmp != PSW32_MASK_MERGE(psw32_user_bits, tmp)) 603 + if ((tmp & ~PSW32_MASK_USER) != psw32_user_bits) 605 604 /* Invalid psw mask. */ 606 605 return -EINVAL; 607 - task_pt_regs(child)->psw.mask = 608 - PSW_MASK_MERGE(psw_user32_bits, (__u64) tmp << 32); 606 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 607 + (regs->psw.mask & PSW_MASK_BA) | 608 + (__u64)(tmp & PSW32_MASK_USER) << 32; 609 609 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 610 610 /* Build a 64 bit psw address from 31 bit address. */ 611 - task_pt_regs(child)->psw.addr = 612 - (__u64) tmp & PSW32_ADDR_INSN; 611 + regs->psw.addr = (__u64) tmp & PSW32_ADDR_INSN; 612 + /* Transfer 31 bit amode bit to psw mask. */ 613 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | 614 + (__u64)(tmp & PSW32_ADDR_AMODE); 615 + /* 616 + * The debugger changed the instruction address, 617 + * reset system call restart, see signal.c:do_signal 618 + */ 619 + task_thread_info(child)->system_call = 0; 613 620 } else { 614 621 /* gpr 0-15 */ 615 - *(__u32*)((addr_t) &task_pt_regs(child)->psw 616 - + addr*2 + 4) = tmp; 622 + *(__u32*)((addr_t) &regs->psw + addr*2 + 4) = tmp; 617 623 } 618 624 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { 619 625 /* ··· 745 735 * debugger stored an invalid system call number. Skip 746 736 * the system call and the system call restart handling. 747 737 */ 748 - regs->svcnr = 0; 738 + clear_thread_flag(TIF_SYSCALL); 749 739 ret = -1; 750 740 } 751 741 ··· 907 897 908 898 #endif 909 899 900 + static int s390_system_call_get(struct task_struct *target, 901 + const struct user_regset *regset, 902 + unsigned int pos, unsigned int count, 903 + void *kbuf, void __user *ubuf) 904 + { 905 + unsigned int *data = &task_thread_info(target)->system_call; 906 + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 907 + data, 0, sizeof(unsigned int)); 908 + } 909 + 910 + static int s390_system_call_set(struct task_struct *target, 911 + const struct user_regset *regset, 912 + unsigned int pos, unsigned int count, 913 + const void *kbuf, const void __user *ubuf) 914 + { 915 + unsigned int *data = &task_thread_info(target)->system_call; 916 + return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 917 + data, 0, sizeof(unsigned int)); 918 + } 919 + 910 920 static const struct user_regset s390_regsets[] = { 911 921 [REGSET_GENERAL] = { 912 922 .core_note_type = NT_PRSTATUS, ··· 953 923 .get = s390_last_break_get, 954 924 }, 955 925 #endif 926 + [REGSET_SYSTEM_CALL] = { 927 + .core_note_type = NT_S390_SYSTEM_CALL, 928 + .n = 1, 929 + .size = sizeof(unsigned int), 930 + .align = sizeof(unsigned int), 931 + .get = s390_system_call_get, 932 + .set = s390_system_call_set, 933 + }, 956 934 }; 957 935 958 936 static const struct user_regset_view user_s390_view = { ··· 1139 1101 .size = sizeof(long), 1140 1102 .align = sizeof(long), 1141 1103 .get = s390_compat_last_break_get, 1104 + }, 1105 + [REGSET_SYSTEM_CALL] = { 1106 + .core_note_type = NT_S390_SYSTEM_CALL, 1107 + .n = 1, 1108 + .size = sizeof(compat_uint_t), 1109 + .align = sizeof(compat_uint_t), 1110 + .get = s390_system_call_get, 1111 + .set = s390_system_call_set, 1142 1112 }, 1143 1113 [REGSET_GENERAL_EXTENDED] = { 1144 1114 .core_note_type = NT_S390_HIGH_GPRS,
+6
arch/s390/kernel/reipl.S
··· 10 10 #include <asm/asm-offsets.h> 11 11 12 12 # 13 + # store_status: Empty implementation until kdump is supported on 31 bit 14 + # 15 + ENTRY(store_status) 16 + br %r14 17 + 18 + # 13 19 # do_reipl_asm 14 20 # Parameter: r2 = schid of reipl device 15 21 #
+6 -3
arch/s390/kernel/reipl64.S
··· 17 17 # 18 18 ENTRY(store_status) 19 19 /* Save register one and load save area base */ 20 - stg %r1,__LC_SAVE_AREA_64(%r0) 20 + stg %r1,__LC_SAVE_AREA+120(%r0) 21 21 lghi %r1,SAVE_AREA_BASE 22 22 /* General purpose registers */ 23 23 stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) 24 - lg %r2,__LC_SAVE_AREA_64(%r0) 24 + lg %r2,__LC_SAVE_AREA+120(%r0) 25 25 stg %r2,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE+8(%r1) 26 26 /* Control registers */ 27 27 stctg %c0,%c15,__LC_CREGS_SAVE_AREA-SAVE_AREA_BASE(%r1) ··· 62 62 larl %r2,store_status 63 63 stg %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 8(%r1) 64 64 br %r14 65 - .align 8 65 + 66 + .section .bss 67 + .align 8 66 68 .Lclkcmp: .quad 0x0000000000000000 69 + .previous 67 70 68 71 # 69 72 # do_reipl_asm
+244 -31
arch/s390/kernel/setup.c
··· 42 42 #include <linux/reboot.h> 43 43 #include <linux/topology.h> 44 44 #include <linux/ftrace.h> 45 + #include <linux/kexec.h> 46 + #include <linux/crash_dump.h> 47 + #include <linux/memory.h> 45 48 46 49 #include <asm/ipl.h> 47 50 #include <asm/uaccess.h> ··· 60 57 #include <asm/ebcdic.h> 61 58 #include <asm/compat.h> 62 59 #include <asm/kvm_virtio.h> 60 + #include <asm/diag.h> 63 61 64 - long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | 65 - PSW_MASK_MCHECK | PSW_DEFAULT_KEY); 66 - long psw_user_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | 67 - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 68 - PSW_MASK_PSTATE | PSW_DEFAULT_KEY); 62 + long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY | 63 + PSW_MASK_EA | PSW_MASK_BA; 64 + long psw_user_bits = PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | 65 + PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_MCHECK | 66 + PSW_MASK_PSTATE | PSW_ASC_HOME; 69 67 70 68 /* 71 69 * User copy operations. ··· 278 274 unsigned int user_mode = HOME_SPACE_MODE; 279 275 EXPORT_SYMBOL_GPL(user_mode); 280 276 281 - static int set_amode_and_uaccess(unsigned long user_amode, 282 - unsigned long user32_amode) 277 + static int set_amode_primary(void) 283 278 { 284 - psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode | 285 - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 286 - PSW_MASK_PSTATE | PSW_DEFAULT_KEY; 279 + psw_kernel_bits = (psw_kernel_bits & ~PSW_MASK_ASC) | PSW_ASC_HOME; 280 + psw_user_bits = (psw_user_bits & ~PSW_MASK_ASC) | PSW_ASC_PRIMARY; 287 281 #ifdef CONFIG_COMPAT 288 - psw_user32_bits = PSW_BASE32_BITS | PSW_MASK_DAT | user_amode | 289 - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 290 - PSW_MASK_PSTATE | PSW_DEFAULT_KEY; 291 - psw32_user_bits = PSW32_BASE_BITS | PSW32_MASK_DAT | user32_amode | 292 - PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | 293 - PSW32_MASK_PSTATE; 282 + psw32_user_bits = 283 + (psw32_user_bits & ~PSW32_MASK_ASC) | PSW32_ASC_PRIMARY; 294 284 #endif 295 - psw_kernel_bits = PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | 296 - PSW_MASK_MCHECK | PSW_DEFAULT_KEY; 297 285 298 286 if (MACHINE_HAS_MVCOS) { 299 287 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess)); ··· 321 325 static void setup_addressing_mode(void) 322 326 { 323 327 if (user_mode == PRIMARY_SPACE_MODE) { 324 - if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) 328 + if (set_amode_primary()) 325 329 pr_info("Address spaces switched, " 326 330 "mvcos available\n"); 327 331 else ··· 340 344 */ 341 345 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096); 342 346 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); 343 - lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 347 + lc->restart_psw.mask = psw_kernel_bits; 344 348 lc->restart_psw.addr = 345 349 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 346 - if (user_mode != HOME_SPACE_MODE) 347 - lc->restart_psw.mask |= PSW_ASC_HOME; 348 - lc->external_new_psw.mask = psw_kernel_bits; 350 + lc->external_new_psw.mask = psw_kernel_bits | 351 + PSW_MASK_DAT | PSW_MASK_MCHECK; 349 352 lc->external_new_psw.addr = 350 353 PSW_ADDR_AMODE | (unsigned long) ext_int_handler; 351 - lc->svc_new_psw.mask = psw_kernel_bits | PSW_MASK_IO | PSW_MASK_EXT; 354 + lc->svc_new_psw.mask = psw_kernel_bits | 355 + PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 352 356 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call; 353 - lc->program_new_psw.mask = psw_kernel_bits; 357 + lc->program_new_psw.mask = psw_kernel_bits | 358 + PSW_MASK_DAT | PSW_MASK_MCHECK; 354 359 lc->program_new_psw.addr = 355 - PSW_ADDR_AMODE | (unsigned long)pgm_check_handler; 356 - lc->mcck_new_psw.mask = 357 - psw_kernel_bits & ~PSW_MASK_MCHECK & ~PSW_MASK_DAT; 360 + PSW_ADDR_AMODE | (unsigned long) pgm_check_handler; 361 + lc->mcck_new_psw.mask = psw_kernel_bits; 358 362 lc->mcck_new_psw.addr = 359 363 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler; 360 - lc->io_new_psw.mask = psw_kernel_bits; 364 + lc->io_new_psw.mask = psw_kernel_bits | 365 + PSW_MASK_DAT | PSW_MASK_MCHECK; 361 366 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler; 362 367 lc->clock_comparator = -1ULL; 363 368 lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE; ··· 432 435 for (i = 0; i < MEMORY_CHUNKS; i++) { 433 436 if (!memory_chunk[i].size) 434 437 continue; 438 + if (memory_chunk[i].type == CHUNK_OLDMEM || 439 + memory_chunk[i].type == CHUNK_CRASHK) 440 + continue; 435 441 res = alloc_bootmem_low(sizeof(*res)); 436 442 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 437 443 switch (memory_chunk[i].type) { 438 444 case CHUNK_READ_WRITE: 445 + case CHUNK_CRASHK: 439 446 res->name = "System RAM"; 440 447 break; 441 448 case CHUNK_READ_ONLY: ··· 479 478 unsigned long memory_size; 480 479 unsigned long max_mem; 481 480 int i; 481 + 482 482 483 483 #ifdef CONFIG_ZFCPDUMP 484 484 if (ipl_info.type == IPL_TYPE_FCP_DUMP) { ··· 547 545 * Setup restart PSW for absolute zero lowcore. This is necesary 548 546 * if PSW restart is done on an offline CPU that has lowcore zero 549 547 */ 550 - psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 548 + psw.mask = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA; 551 549 psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 552 550 copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw)); 551 + } 552 + 553 + static void __init setup_vmcoreinfo(void) 554 + { 555 + #ifdef CONFIG_KEXEC 556 + unsigned long ptr = paddr_vmcoreinfo_note(); 557 + 558 + copy_to_absolute_zero(&S390_lowcore.vmcore_info, &ptr, sizeof(ptr)); 559 + #endif 560 + } 561 + 562 + #ifdef CONFIG_CRASH_DUMP 563 + 564 + /* 565 + * Find suitable location for crashkernel memory 566 + */ 567 + static unsigned long __init find_crash_base(unsigned long crash_size, 568 + char **msg) 569 + { 570 + unsigned long crash_base; 571 + struct mem_chunk *chunk; 572 + int i; 573 + 574 + if (memory_chunk[0].size < crash_size) { 575 + *msg = "first memory chunk must be at least crashkernel size"; 576 + return 0; 577 + } 578 + if (is_kdump_kernel() && (crash_size == OLDMEM_SIZE)) 579 + return OLDMEM_BASE; 580 + 581 + for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { 582 + chunk = &memory_chunk[i]; 583 + if (chunk->size == 0) 584 + continue; 585 + if (chunk->type != CHUNK_READ_WRITE) 586 + continue; 587 + if (chunk->size < crash_size) 588 + continue; 589 + crash_base = (chunk->addr + chunk->size) - crash_size; 590 + if (crash_base < crash_size) 591 + continue; 592 + if (crash_base < ZFCPDUMP_HSA_SIZE_MAX) 593 + continue; 594 + if (crash_base < (unsigned long) INITRD_START + INITRD_SIZE) 595 + continue; 596 + return crash_base; 597 + } 598 + *msg = "no suitable area found"; 599 + return 0; 600 + } 601 + 602 + /* 603 + * Check if crash_base and crash_size is valid 604 + */ 605 + static int __init verify_crash_base(unsigned long crash_base, 606 + unsigned long crash_size, 607 + char **msg) 608 + { 609 + struct mem_chunk *chunk; 610 + int i; 611 + 612 + /* 613 + * Because we do the swap to zero, we must have at least 'crash_size' 614 + * bytes free space before crash_base 615 + */ 616 + if (crash_size > crash_base) { 617 + *msg = "crashkernel offset must be greater than size"; 618 + return -EINVAL; 619 + } 620 + 621 + /* First memory chunk must be at least crash_size */ 622 + if (memory_chunk[0].size < crash_size) { 623 + *msg = "first memory chunk must be at least crashkernel size"; 624 + return -EINVAL; 625 + } 626 + /* Check if we fit into the respective memory chunk */ 627 + for (i = 0; i < MEMORY_CHUNKS; i++) { 628 + chunk = &memory_chunk[i]; 629 + if (chunk->size == 0) 630 + continue; 631 + if (crash_base < chunk->addr) 632 + continue; 633 + if (crash_base >= chunk->addr + chunk->size) 634 + continue; 635 + /* we have found the memory chunk */ 636 + if (crash_base + crash_size > chunk->addr + chunk->size) { 637 + *msg = "selected memory chunk is too small for " 638 + "crashkernel memory"; 639 + return -EINVAL; 640 + } 641 + return 0; 642 + } 643 + *msg = "invalid memory range specified"; 644 + return -EINVAL; 645 + } 646 + 647 + /* 648 + * Reserve kdump memory by creating a memory hole in the mem_chunk array 649 + */ 650 + static void __init reserve_kdump_bootmem(unsigned long addr, unsigned long size, 651 + int type) 652 + { 653 + 654 + create_mem_hole(memory_chunk, addr, size, type); 655 + } 656 + 657 + /* 658 + * When kdump is enabled, we have to ensure that no memory from 659 + * the area [0 - crashkernel memory size] and 660 + * [crashk_res.start - crashk_res.end] is set offline. 661 + */ 662 + static int kdump_mem_notifier(struct notifier_block *nb, 663 + unsigned long action, void *data) 664 + { 665 + struct memory_notify *arg = data; 666 + 667 + if (arg->start_pfn < PFN_DOWN(resource_size(&crashk_res))) 668 + return NOTIFY_BAD; 669 + if (arg->start_pfn > PFN_DOWN(crashk_res.end)) 670 + return NOTIFY_OK; 671 + if (arg->start_pfn + arg->nr_pages - 1 < PFN_DOWN(crashk_res.start)) 672 + return NOTIFY_OK; 673 + return NOTIFY_BAD; 674 + } 675 + 676 + static struct notifier_block kdump_mem_nb = { 677 + .notifier_call = kdump_mem_notifier, 678 + }; 679 + 680 + #endif 681 + 682 + /* 683 + * Make sure that oldmem, where the dump is stored, is protected 684 + */ 685 + static void reserve_oldmem(void) 686 + { 687 + #ifdef CONFIG_CRASH_DUMP 688 + if (!OLDMEM_BASE) 689 + return; 690 + 691 + reserve_kdump_bootmem(OLDMEM_BASE, OLDMEM_SIZE, CHUNK_OLDMEM); 692 + reserve_kdump_bootmem(OLDMEM_SIZE, memory_end - OLDMEM_SIZE, 693 + CHUNK_OLDMEM); 694 + if (OLDMEM_BASE + OLDMEM_SIZE == real_memory_size) 695 + saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1; 696 + else 697 + saved_max_pfn = PFN_DOWN(real_memory_size) - 1; 698 + #endif 699 + } 700 + 701 + /* 702 + * Reserve memory for kdump kernel to be loaded with kexec 703 + */ 704 + static void __init reserve_crashkernel(void) 705 + { 706 + #ifdef CONFIG_CRASH_DUMP 707 + unsigned long long crash_base, crash_size; 708 + char *msg; 709 + int rc; 710 + 711 + rc = parse_crashkernel(boot_command_line, memory_end, &crash_size, 712 + &crash_base); 713 + if (rc || crash_size == 0) 714 + return; 715 + crash_base = ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN); 716 + crash_size = ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN); 717 + if (register_memory_notifier(&kdump_mem_nb)) 718 + return; 719 + if (!crash_base) 720 + crash_base = find_crash_base(crash_size, &msg); 721 + if (!crash_base) { 722 + pr_info("crashkernel reservation failed: %s\n", msg); 723 + unregister_memory_notifier(&kdump_mem_nb); 724 + return; 725 + } 726 + if (verify_crash_base(crash_base, crash_size, &msg)) { 727 + pr_info("crashkernel reservation failed: %s\n", msg); 728 + unregister_memory_notifier(&kdump_mem_nb); 729 + return; 730 + } 731 + if (!OLDMEM_BASE && MACHINE_IS_VM) 732 + diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size)); 733 + crashk_res.start = crash_base; 734 + crashk_res.end = crash_base + crash_size - 1; 735 + insert_resource(&iomem_resource, &crashk_res); 736 + reserve_kdump_bootmem(crash_base, crash_size, CHUNK_CRASHK); 737 + pr_info("Reserving %lluMB of memory at %lluMB " 738 + "for crashkernel (System RAM: %luMB)\n", 739 + crash_size >> 20, crash_base >> 20, memory_end >> 20); 740 + #endif 553 741 } 554 742 555 743 static void __init ··· 772 580 if (PFN_PHYS(start_pfn) + bmap_size > INITRD_START) { 773 581 start = PFN_PHYS(start_pfn) + bmap_size + PAGE_SIZE; 774 582 583 + #ifdef CONFIG_CRASH_DUMP 584 + if (OLDMEM_BASE) { 585 + /* Move initrd behind kdump oldmem */ 586 + if (start + INITRD_SIZE > OLDMEM_BASE && 587 + start < OLDMEM_BASE + OLDMEM_SIZE) 588 + start = OLDMEM_BASE + OLDMEM_SIZE; 589 + } 590 + #endif 775 591 if (start + INITRD_SIZE > memory_end) { 776 592 pr_err("initrd extends beyond end of " 777 593 "memory (0x%08lx > 0x%08lx) " ··· 810 610 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 811 611 unsigned long start_chunk, end_chunk, pfn; 812 612 813 - if (memory_chunk[i].type != CHUNK_READ_WRITE) 613 + if (memory_chunk[i].type != CHUNK_READ_WRITE && 614 + memory_chunk[i].type != CHUNK_CRASHK) 814 615 continue; 815 616 start_chunk = PFN_DOWN(memory_chunk[i].addr); 816 617 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size); ··· 845 644 reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size, 846 645 BOOTMEM_DEFAULT); 847 646 647 + #ifdef CONFIG_CRASH_DUMP 648 + if (crashk_res.start) 649 + reserve_bootmem(crashk_res.start, 650 + crashk_res.end - crashk_res.start + 1, 651 + BOOTMEM_DEFAULT); 652 + if (is_kdump_kernel()) 653 + reserve_bootmem(elfcorehdr_addr - OLDMEM_BASE, 654 + PAGE_ALIGN(elfcorehdr_size), BOOTMEM_DEFAULT); 655 + #endif 848 656 #ifdef CONFIG_BLK_DEV_INITRD 849 657 if (INITRD_START && INITRD_SIZE) { 850 658 if (INITRD_START + INITRD_SIZE <= memory_end) { ··· 1022 812 setup_ipl(); 1023 813 setup_memory_end(); 1024 814 setup_addressing_mode(); 815 + reserve_oldmem(); 816 + reserve_crashkernel(); 1025 817 setup_memory(); 1026 818 setup_resources(); 819 + setup_vmcoreinfo(); 1027 820 setup_restart_psw(); 1028 821 setup_lowcore(); 1029 822
+70 -58
arch/s390/kernel/signal.c
··· 30 30 #include <asm/ucontext.h> 31 31 #include <asm/uaccess.h> 32 32 #include <asm/lowcore.h> 33 + #include <asm/compat.h> 33 34 #include "entry.h" 34 35 35 36 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) ··· 117 116 118 117 /* Copy a 'clean' PSW mask to the user to avoid leaking 119 118 information about whether PER is currently on. */ 120 - user_sregs.regs.psw.mask = PSW_MASK_MERGE(psw_user_bits, regs->psw.mask); 119 + user_sregs.regs.psw.mask = psw_user_bits | 120 + (regs->psw.mask & PSW_MASK_USER); 121 121 user_sregs.regs.psw.addr = regs->psw.addr; 122 122 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs)); 123 123 memcpy(&user_sregs.regs.acrs, current->thread.acrs, ··· 145 143 err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs)); 146 144 if (err) 147 145 return err; 148 - regs->psw.mask = PSW_MASK_MERGE(regs->psw.mask, 149 - user_sregs.regs.psw.mask); 150 - regs->psw.addr = PSW_ADDR_AMODE | user_sregs.regs.psw.addr; 146 + /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */ 147 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 148 + (user_sregs.regs.psw.mask & PSW_MASK_USER); 149 + /* Check for invalid amode */ 150 + if (regs->psw.mask & PSW_MASK_EA) 151 + regs->psw.mask |= PSW_MASK_BA; 152 + regs->psw.addr = user_sregs.regs.psw.addr; 151 153 memcpy(&regs->gprs, &user_sregs.regs.gprs, sizeof(sregs->regs.gprs)); 152 154 memcpy(&current->thread.acrs, &user_sregs.regs.acrs, 153 155 sizeof(sregs->regs.acrs)); ··· 162 156 current->thread.fp_regs.fpc &= FPC_VALID_MASK; 163 157 164 158 restore_fp_regs(&current->thread.fp_regs); 165 - regs->svcnr = 0; /* disable syscall checks */ 159 + clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 166 160 return 0; 167 161 } 168 162 ··· 294 288 295 289 /* Set up registers for signal handler */ 296 290 regs->gprs[15] = (unsigned long) frame; 291 + regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */ 297 292 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 298 293 299 294 regs->gprs[2] = map_signal(sig); ··· 363 356 364 357 /* Set up registers for signal handler */ 365 358 regs->gprs[15] = (unsigned long) frame; 359 + regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */ 366 360 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 367 361 368 362 regs->gprs[2] = map_signal(sig); ··· 409 401 */ 410 402 void do_signal(struct pt_regs *regs) 411 403 { 412 - unsigned long retval = 0, continue_addr = 0, restart_addr = 0; 413 404 siginfo_t info; 414 405 int signr; 415 406 struct k_sigaction ka; ··· 428 421 else 429 422 oldset = &current->blocked; 430 423 431 - /* Are we from a system call? */ 432 - if (regs->svcnr) { 433 - continue_addr = regs->psw.addr; 434 - restart_addr = continue_addr - regs->ilc; 435 - retval = regs->gprs[2]; 436 - 437 - /* Prepare for system call restart. We do this here so that a 438 - debugger will see the already changed PSW. */ 439 - switch (retval) { 440 - case -ERESTARTNOHAND: 441 - case -ERESTARTSYS: 442 - case -ERESTARTNOINTR: 443 - regs->gprs[2] = regs->orig_gpr2; 444 - regs->psw.addr = restart_addr; 445 - break; 446 - case -ERESTART_RESTARTBLOCK: 447 - regs->gprs[2] = -EINTR; 448 - } 449 - regs->svcnr = 0; /* Don't deal with this again. */ 450 - } 451 - 452 - /* Get signal to deliver. When running under ptrace, at this point 453 - the debugger may change all our registers ... */ 424 + /* 425 + * Get signal to deliver. When running under ptrace, at this point 426 + * the debugger may change all our registers, including the system 427 + * call information. 428 + */ 429 + current_thread_info()->system_call = 430 + test_thread_flag(TIF_SYSCALL) ? regs->svc_code : 0; 454 431 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 455 - 456 - /* Depending on the signal settings we may need to revert the 457 - decision to restart the system call. */ 458 - if (signr > 0 && regs->psw.addr == restart_addr) { 459 - if (retval == -ERESTARTNOHAND 460 - || (retval == -ERESTARTSYS 461 - && !(current->sighand->action[signr-1].sa.sa_flags 462 - & SA_RESTART))) { 463 - regs->gprs[2] = -EINTR; 464 - regs->psw.addr = continue_addr; 465 - } 466 - } 467 432 468 433 if (signr > 0) { 469 434 /* Whee! Actually deliver the signal. */ 470 - int ret; 471 - #ifdef CONFIG_COMPAT 472 - if (is_compat_task()) { 473 - ret = handle_signal32(signr, &ka, &info, oldset, regs); 474 - } 475 - else 476 - #endif 477 - ret = handle_signal(signr, &ka, &info, oldset, regs); 478 - if (!ret) { 435 + if (current_thread_info()->system_call) { 436 + regs->svc_code = current_thread_info()->system_call; 437 + /* Check for system call restarting. */ 438 + switch (regs->gprs[2]) { 439 + case -ERESTART_RESTARTBLOCK: 440 + case -ERESTARTNOHAND: 441 + regs->gprs[2] = -EINTR; 442 + break; 443 + case -ERESTARTSYS: 444 + if (!(ka.sa.sa_flags & SA_RESTART)) { 445 + regs->gprs[2] = -EINTR; 446 + break; 447 + } 448 + /* fallthrough */ 449 + case -ERESTARTNOINTR: 450 + regs->gprs[2] = regs->orig_gpr2; 451 + regs->psw.addr = 452 + __rewind_psw(regs->psw, 453 + regs->svc_code >> 16); 454 + break; 455 + } 456 + /* No longer in a system call */ 457 + clear_thread_flag(TIF_SYSCALL); 458 + } 459 + 460 + if ((is_compat_task() ? 461 + handle_signal32(signr, &ka, &info, oldset, regs) : 462 + handle_signal(signr, &ka, &info, oldset, regs)) == 0) { 479 463 /* 480 464 * A signal was successfully delivered; the saved 481 465 * sigmask will have been stored in the signal frame, ··· 480 482 * Let tracing know that we've done the handler setup. 481 483 */ 482 484 tracehook_signal_handler(signr, &info, &ka, regs, 483 - test_thread_flag(TIF_SINGLE_STEP)); 485 + test_thread_flag(TIF_SINGLE_STEP)); 484 486 } 485 487 return; 488 + } 489 + 490 + /* No handlers present - check for system call restart */ 491 + if (current_thread_info()->system_call) { 492 + regs->svc_code = current_thread_info()->system_call; 493 + switch (regs->gprs[2]) { 494 + case -ERESTART_RESTARTBLOCK: 495 + /* Restart with sys_restart_syscall */ 496 + regs->svc_code = __NR_restart_syscall; 497 + /* fallthrough */ 498 + case -ERESTARTNOHAND: 499 + case -ERESTARTSYS: 500 + case -ERESTARTNOINTR: 501 + /* Restart system call with magic TIF bit. */ 502 + regs->gprs[2] = regs->orig_gpr2; 503 + set_thread_flag(TIF_SYSCALL); 504 + break; 505 + default: 506 + clear_thread_flag(TIF_SYSCALL); 507 + break; 508 + } 486 509 } 487 510 488 511 /* ··· 512 493 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 513 494 clear_thread_flag(TIF_RESTORE_SIGMASK); 514 495 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 515 - } 516 - 517 - /* Restart a different system call. */ 518 - if (retval == -ERESTART_RESTARTBLOCK 519 - && regs->psw.addr == continue_addr) { 520 - regs->gprs[2] = __NR_restart_syscall; 521 - set_thread_flag(TIF_RESTART_SVC); 522 496 } 523 497 } 524 498
+64 -9
arch/s390/kernel/smp.c
··· 38 38 #include <linux/timex.h> 39 39 #include <linux/bootmem.h> 40 40 #include <linux/slab.h> 41 + #include <linux/crash_dump.h> 41 42 #include <asm/asm-offsets.h> 42 43 #include <asm/ipl.h> 43 44 #include <asm/setup.h> ··· 98 97 return raw_cpu_stopped(cpu_logical_map(cpu)); 99 98 } 100 99 100 + /* 101 + * Ensure that PSW restart is done on an online CPU 102 + */ 103 + void smp_restart_with_online_cpu(void) 104 + { 105 + int cpu; 106 + 107 + for_each_online_cpu(cpu) { 108 + if (stap() == __cpu_logical_map[cpu]) { 109 + /* We are online: Enable DAT again and return */ 110 + __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 111 + return; 112 + } 113 + } 114 + /* We are not online: Do PSW restart on an online CPU */ 115 + while (sigp(cpu, sigp_restart) == sigp_busy) 116 + cpu_relax(); 117 + /* And stop ourself */ 118 + while (raw_sigp(stap(), sigp_stop) == sigp_busy) 119 + cpu_relax(); 120 + for (;;); 121 + } 122 + 101 123 void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) 102 124 { 103 125 struct _lowcore *lc, *current_lc; ··· 130 106 131 107 if (smp_processor_id() == 0) 132 108 func(data); 133 - __load_psw_mask(PSW_BASE_BITS | PSW_DEFAULT_KEY); 109 + __load_psw_mask(PSW_DEFAULT_KEY | PSW_MASK_BASE | 110 + PSW_MASK_EA | PSW_MASK_BA); 134 111 /* Disable lowcore protection */ 135 112 __ctl_clear_bit(0, 28); 136 113 current_lc = lowcore_ptr[smp_processor_id()]; 137 114 lc = lowcore_ptr[0]; 138 115 if (!lc) 139 116 lc = current_lc; 140 - lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 117 + lc->restart_psw.mask = 118 + PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA; 141 119 lc->restart_psw.addr = PSW_ADDR_AMODE | (unsigned long) smp_restart_cpu; 142 120 if (!cpu_online(0)) 143 121 smp_switch_to_cpu(func, data, 0, stap(), __cpu_logical_map[0]); ··· 161 135 int cpu, rc; 162 136 163 137 /* Disable all interrupts/machine checks */ 164 - __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK); 138 + __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 165 139 trace_hardirqs_off(); 166 140 167 141 /* stop all processors */ ··· 187 161 { 188 162 unsigned long bits; 189 163 190 - kstat_cpu(smp_processor_id()).irqs[EXTINT_IPI]++; 164 + if (ext_int_code == 0x1202) 165 + kstat_cpu(smp_processor_id()).irqs[EXTINT_EXC]++; 166 + else 167 + kstat_cpu(smp_processor_id()).irqs[EXTINT_EMS]++; 191 168 /* 192 169 * handle bit signal external calls 193 170 */ ··· 212 183 */ 213 184 static void smp_ext_bitcall(int cpu, int sig) 214 185 { 186 + int order; 187 + 215 188 /* 216 189 * Set signaling bit in lowcore of target cpu and kick it 217 190 */ 218 191 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 219 - while (sigp(cpu, sigp_emergency_signal) == sigp_busy) 192 + while (1) { 193 + order = smp_vcpu_scheduled(cpu) ? 194 + sigp_external_call : sigp_emergency_signal; 195 + if (sigp(cpu, order) != sigp_busy) 196 + break; 220 197 udelay(10); 198 + } 221 199 } 222 200 223 201 void arch_send_call_function_ipi_mask(const struct cpumask *mask) ··· 317 281 } 318 282 EXPORT_SYMBOL(smp_ctl_clear_bit); 319 283 320 - #ifdef CONFIG_ZFCPDUMP 284 + #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP) 321 285 322 286 static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) 323 287 { 324 - if (ipl_info.type != IPL_TYPE_FCP_DUMP) 288 + if (ipl_info.type != IPL_TYPE_FCP_DUMP && !OLDMEM_BASE) 289 + return; 290 + if (is_kdump_kernel()) 325 291 return; 326 292 if (cpu >= NR_CPUS) { 327 293 pr_warning("CPU %i exceeds the maximum %i and is excluded from " ··· 441 403 info = kmalloc(sizeof(*info), GFP_KERNEL); 442 404 if (!info) 443 405 panic("smp_detect_cpus failed to allocate memory\n"); 406 + #ifdef CONFIG_CRASH_DUMP 407 + if (OLDMEM_BASE && !is_kdump_kernel()) { 408 + struct save_area *save_area; 409 + 410 + save_area = kmalloc(sizeof(*save_area), GFP_KERNEL); 411 + if (!save_area) 412 + panic("could not allocate memory for save area\n"); 413 + copy_oldmem_page(1, (void *) save_area, sizeof(*save_area), 414 + 0x200, 0); 415 + zfcpdump_save_areas[0] = save_area; 416 + } 417 + #endif 444 418 /* Use sigp detection algorithm if sclp doesn't work. */ 445 419 if (sclp_get_cpu_info(info)) { 446 420 smp_use_sigp_detection = 1; ··· 513 463 set_cpu_online(smp_processor_id(), true); 514 464 ipi_call_unlock(); 515 465 __ctl_clear_bit(0, 28); /* Disable lowcore protection */ 516 - S390_lowcore.restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 466 + S390_lowcore.restart_psw.mask = 467 + PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA; 517 468 S390_lowcore.restart_psw.addr = 518 469 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 519 470 __ctl_set_bit(0, 28); /* Enable lowcore protection */ ··· 562 511 memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); 563 512 lowcore->async_stack = async_stack + ASYNC_SIZE; 564 513 lowcore->panic_stack = panic_stack + PAGE_SIZE; 565 - lowcore->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 514 + lowcore->restart_psw.mask = 515 + PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA; 566 516 lowcore->restart_psw.addr = 567 517 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 568 518 if (user_mode != HOME_SPACE_MODE) ··· 764 712 /* request the 0x1201 emergency signal external interrupt */ 765 713 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 766 714 panic("Couldn't request external interrupt 0x1201"); 715 + /* request the 0x1202 external call external interrupt */ 716 + if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) 717 + panic("Couldn't request external interrupt 0x1202"); 767 718 768 719 /* Reallocate current lowcore, but keep its contents. */ 769 720 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
+1
arch/s390/kernel/suspend.c
··· 7 7 */ 8 8 9 9 #include <linux/pfn.h> 10 + #include <linux/suspend.h> 10 11 #include <linux/mm.h> 11 12 #include <asm/system.h> 12 13
+1 -1
arch/s390/kernel/sysinfo.c
··· 442 442 */ 443 443 FP_UNPACK_SP(SA, &fmil); 444 444 if ((info->capability >> 23) == 0) 445 - FP_FROM_INT_S(SB, info->capability, 32, int); 445 + FP_FROM_INT_S(SB, (long) info->capability, 64, long); 446 446 else 447 447 FP_UNPACK_SP(SB, &info->capability); 448 448 FP_DIV_S(SR, SA, SB);
+1
arch/s390/kernel/time.c
··· 48 48 #include <asm/timer.h> 49 49 #include <asm/etr.h> 50 50 #include <asm/cio.h> 51 + #include "entry.h" 51 52 52 53 /* change this if you have some constant time drift */ 53 54 #define USECS_PER_JIFFY ((unsigned long) 1000000/HZ)
+2 -2
arch/s390/kernel/topology.c
··· 299 299 } 300 300 __initcall(init_topology_update); 301 301 302 - static void alloc_masks(struct sysinfo_15_1_x *info, struct mask_info *mask, 303 - int offset) 302 + static void __init alloc_masks(struct sysinfo_15_1_x *info, 303 + struct mask_info *mask, int offset) 304 304 { 305 305 int i, nr_masks; 306 306
+3 -2
arch/s390/kernel/traps.c
··· 200 200 mask_bits(regs, PSW_MASK_PSTATE), mask_bits(regs, PSW_MASK_ASC), 201 201 mask_bits(regs, PSW_MASK_CC), mask_bits(regs, PSW_MASK_PM)); 202 202 #ifdef CONFIG_64BIT 203 - printk(" EA:%x", mask_bits(regs, PSW_BASE_BITS)); 203 + printk(" EA:%x", mask_bits(regs, PSW_MASK_EA | PSW_MASK_BA)); 204 204 #endif 205 205 printk("\n%s GPRS: " FOURLONG, mode, 206 206 regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]); ··· 334 334 info.si_signo = SIGTRAP; 335 335 info.si_errno = 0; 336 336 info.si_code = TRAP_HWBKPT; 337 - info.si_addr = (void *) current->thread.per_event.address; 337 + info.si_addr = 338 + (void __force __user *) current->thread.per_event.address; 338 339 force_sig_info(SIGTRAP, &info, current); 339 340 } 340 341
+7 -4
arch/s390/kernel/vtime.c
··· 170 170 psw_t psw; 171 171 172 172 /* Wait for external, I/O or machine check interrupt. */ 173 - psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT; 173 + psw.mask = psw_kernel_bits | PSW_MASK_WAIT | 174 + PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 174 175 175 176 idle->nohz_delay = 0; 176 177 ··· 184 183 * set_cpu_timer(VTIMER_MAX_SLICE); 185 184 * idle->idle_enter = get_clock(); 186 185 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT | 187 - * PSW_MASK_IO | PSW_MASK_EXT); 186 + * PSW_MASK_DAT | PSW_MASK_IO | 187 + * PSW_MASK_EXT | PSW_MASK_MCHECK); 188 188 * The difference is that the inline assembly makes sure that 189 189 * the last three instruction are stpt, stck and lpsw in that 190 190 * order. This is done to increase the precision. ··· 218 216 * vq->idle = get_cpu_timer(); 219 217 * idle->idle_enter = get_clock(); 220 218 * __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT | 221 - * PSW_MASK_IO | PSW_MASK_EXT); 219 + * PSW_MASK_DAT | PSW_MASK_IO | 220 + * PSW_MASK_EXT | PSW_MASK_MCHECK); 222 221 * The difference is that the inline assembly makes sure that 223 222 * the last three instruction are stpt, stck and lpsw in that 224 223 * order. This is done to increase the precision. ··· 461 458 } 462 459 EXPORT_SYMBOL(add_virt_timer_periodic); 463 460 464 - int __mod_vtimer(struct vtimer_list *timer, __u64 expires, int periodic) 461 + static int __mod_vtimer(struct vtimer_list *timer, __u64 expires, int periodic) 465 462 { 466 463 struct vtimer_queue *vq; 467 464 unsigned long flags;
+31 -1
arch/s390/kvm/diag.c
··· 1 1 /* 2 2 * diag.c - handling diagnose instructions 3 3 * 4 - * Copyright IBM Corp. 2008 4 + * Copyright IBM Corp. 2008,2011 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License (version 2 only) ··· 14 14 #include <linux/kvm.h> 15 15 #include <linux/kvm_host.h> 16 16 #include "kvm-s390.h" 17 + 18 + static int diag_release_pages(struct kvm_vcpu *vcpu) 19 + { 20 + unsigned long start, end; 21 + unsigned long prefix = vcpu->arch.sie_block->prefix; 22 + 23 + start = vcpu->arch.guest_gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4]; 24 + end = vcpu->arch.guest_gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096; 25 + 26 + if (start & ~PAGE_MASK || end & ~PAGE_MASK || start > end 27 + || start < 2 * PAGE_SIZE) 28 + return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 29 + 30 + VCPU_EVENT(vcpu, 5, "diag release pages %lX %lX", start, end); 31 + vcpu->stat.diagnose_10++; 32 + 33 + /* we checked for start > end above */ 34 + if (end < prefix || start >= prefix + 2 * PAGE_SIZE) { 35 + gmap_discard(start, end, vcpu->arch.gmap); 36 + } else { 37 + if (start < prefix) 38 + gmap_discard(start, prefix, vcpu->arch.gmap); 39 + if (end >= prefix) 40 + gmap_discard(prefix + 2 * PAGE_SIZE, 41 + end, vcpu->arch.gmap); 42 + } 43 + return 0; 44 + } 17 45 18 46 static int __diag_time_slice_end(struct kvm_vcpu *vcpu) 19 47 { ··· 85 57 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; 86 58 87 59 switch (code) { 60 + case 0x10: 61 + return diag_release_pages(vcpu); 88 62 case 0x44: 89 63 return __diag_time_slice_end(vcpu); 90 64 case 0x308:
+1
arch/s390/kvm/kvm-s390.c
··· 71 71 { "instruction_sigp_set_arch", VCPU_STAT(instruction_sigp_arch) }, 72 72 { "instruction_sigp_set_prefix", VCPU_STAT(instruction_sigp_prefix) }, 73 73 { "instruction_sigp_restart", VCPU_STAT(instruction_sigp_restart) }, 74 + { "diagnose_10", VCPU_STAT(diagnose_10) }, 74 75 { "diagnose_44", VCPU_STAT(diagnose_44) }, 75 76 { NULL } 76 77 };
+2 -1
arch/s390/lib/delay.c
··· 32 32 u64 clock_saved; 33 33 u64 end; 34 34 35 - mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; 35 + mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_WAIT | 36 + PSW_MASK_EXT | PSW_MASK_MCHECK; 36 37 end = get_clock() + (usecs << 12); 37 38 clock_saved = local_tick_disable(); 38 39 __ctl_store(cr0_saved, 0, 0);
+4 -2
arch/s390/lib/uaccess_pt.c
··· 342 342 if (segment_eq(get_fs(), KERNEL_DS)) 343 343 return __futex_atomic_op_pt(op, uaddr, oparg, old); 344 344 spin_lock(&current->mm->page_table_lock); 345 - uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr); 345 + uaddr = (u32 __force __user *) 346 + __dat_user_addr((__force unsigned long) uaddr); 346 347 if (!uaddr) { 347 348 spin_unlock(&current->mm->page_table_lock); 348 349 return -EFAULT; ··· 379 378 if (segment_eq(get_fs(), KERNEL_DS)) 380 379 return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); 381 380 spin_lock(&current->mm->page_table_lock); 382 - uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr); 381 + uaddr = (u32 __force __user *) 382 + __dat_user_addr((__force unsigned long) uaddr); 383 383 if (!uaddr) { 384 384 spin_unlock(&current->mm->page_table_lock); 385 385 return -EFAULT;
+3 -3
arch/s390/mm/fault.c
··· 307 307 308 308 #ifdef CONFIG_PGSTE 309 309 if (test_tsk_thread_flag(current, TIF_SIE) && S390_lowcore.gmap) { 310 - address = gmap_fault(address, 310 + address = __gmap_fault(address, 311 311 (struct gmap *) S390_lowcore.gmap); 312 312 if (address == -EFAULT) { 313 313 fault = VM_FAULT_BADMAP; ··· 393 393 int fault; 394 394 395 395 /* Protection exception is suppressing, decrement psw address. */ 396 - regs->psw.addr -= (pgm_int_code >> 16); 396 + regs->psw.addr = __rewind_psw(regs->psw, pgm_int_code >> 16); 397 397 /* 398 398 * Check for low-address protection. This needs to be treated 399 399 * as a special case because the translation exception code ··· 454 454 struct pt_regs regs; 455 455 int access, fault; 456 456 457 - regs.psw.mask = psw_kernel_bits; 457 + regs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK; 458 458 if (!irqs_disabled()) 459 459 regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT; 460 460 regs.psw.addr = (unsigned long) __builtin_return_address(0);
+56
arch/s390/mm/maccess.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/types.h> 13 13 #include <linux/errno.h> 14 + #include <linux/gfp.h> 14 15 #include <asm/system.h> 15 16 16 17 /* ··· 61 60 return copied < 0 ? -EFAULT : 0; 62 61 } 63 62 63 + /* 64 + * Copy memory in real mode (kernel to kernel) 65 + */ 64 66 int memcpy_real(void *dest, void *src, size_t count) 65 67 { 66 68 register unsigned long _dest asm("2") = (unsigned long) dest; ··· 104 100 memcpy_real(dest + store_prefix(), src, count); 105 101 __ctl_load(cr0, 0, 0); 106 102 preempt_enable(); 103 + } 104 + 105 + /* 106 + * Copy memory from kernel (real) to user (virtual) 107 + */ 108 + int copy_to_user_real(void __user *dest, void *src, size_t count) 109 + { 110 + int offs = 0, size, rc; 111 + char *buf; 112 + 113 + buf = (char *) __get_free_page(GFP_KERNEL); 114 + if (!buf) 115 + return -ENOMEM; 116 + rc = -EFAULT; 117 + while (offs < count) { 118 + size = min(PAGE_SIZE, count - offs); 119 + if (memcpy_real(buf, src + offs, size)) 120 + goto out; 121 + if (copy_to_user(dest + offs, buf, size)) 122 + goto out; 123 + offs += size; 124 + } 125 + rc = 0; 126 + out: 127 + free_page((unsigned long) buf); 128 + return rc; 129 + } 130 + 131 + /* 132 + * Copy memory from user (virtual) to kernel (real) 133 + */ 134 + int copy_from_user_real(void *dest, void __user *src, size_t count) 135 + { 136 + int offs = 0, size, rc; 137 + char *buf; 138 + 139 + buf = (char *) __get_free_page(GFP_KERNEL); 140 + if (!buf) 141 + return -ENOMEM; 142 + rc = -EFAULT; 143 + while (offs < count) { 144 + size = min(PAGE_SIZE, count - offs); 145 + if (copy_from_user(buf, src + offs, size)) 146 + goto out; 147 + if (memcpy_real(dest + offs, buf, size)) 148 + goto out; 149 + offs += size; 150 + } 151 + rc = 0; 152 + out: 153 + free_page((unsigned long) buf); 154 + return rc; 107 155 }
+1
arch/s390/mm/mmap.c
··· 26 26 27 27 #include <linux/personality.h> 28 28 #include <linux/mm.h> 29 + #include <linux/mman.h> 29 30 #include <linux/module.h> 30 31 #include <linux/random.h> 31 32 #include <asm/pgalloc.h>
+1
arch/s390/mm/pageattr.c
··· 5 5 #include <linux/module.h> 6 6 #include <linux/mm.h> 7 7 #include <linux/hugetlb.h> 8 + #include <asm/cacheflush.h> 8 9 #include <asm/pgtable.h> 9 10 10 11 static void change_page_attr(unsigned long addr, int numpages,
+77 -6
arch/s390/mm/pgtable.c
··· 1 1 /* 2 - * Copyright IBM Corp. 2007,2009 2 + * Copyright IBM Corp. 2007,2011 3 3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 4 4 */ 5 5 ··· 222 222 223 223 /* Free all segment & region tables. */ 224 224 down_read(&gmap->mm->mmap_sem); 225 + spin_lock(&gmap->mm->page_table_lock); 225 226 list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { 226 227 table = (unsigned long *) page_to_phys(page); 227 228 if ((*table & _REGION_ENTRY_TYPE_MASK) == 0) ··· 231 230 gmap_unlink_segment(gmap, table); 232 231 __free_pages(page, ALLOC_ORDER); 233 232 } 233 + spin_unlock(&gmap->mm->page_table_lock); 234 234 up_read(&gmap->mm->mmap_sem); 235 235 list_del(&gmap->list); 236 236 kfree(gmap); ··· 258 256 } 259 257 EXPORT_SYMBOL_GPL(gmap_disable); 260 258 259 + /* 260 + * gmap_alloc_table is assumed to be called with mmap_sem held 261 + */ 261 262 static int gmap_alloc_table(struct gmap *gmap, 262 263 unsigned long *table, unsigned long init) 263 264 { ··· 272 267 return -ENOMEM; 273 268 new = (unsigned long *) page_to_phys(page); 274 269 crst_table_init(new, init); 275 - down_read(&gmap->mm->mmap_sem); 276 270 if (*table & _REGION_ENTRY_INV) { 277 271 list_add(&page->lru, &gmap->crst_list); 278 272 *table = (unsigned long) new | _REGION_ENTRY_LENGTH | 279 273 (*table & _REGION_ENTRY_TYPE_MASK); 280 274 } else 281 275 __free_pages(page, ALLOC_ORDER); 282 - up_read(&gmap->mm->mmap_sem); 283 276 return 0; 284 277 } 285 278 ··· 302 299 303 300 flush = 0; 304 301 down_read(&gmap->mm->mmap_sem); 302 + spin_lock(&gmap->mm->page_table_lock); 305 303 for (off = 0; off < len; off += PMD_SIZE) { 306 304 /* Walk the guest addr space page table */ 307 305 table = gmap->table + (((to + off) >> 53) & 0x7ff); ··· 324 320 *table = _SEGMENT_ENTRY_INV; 325 321 } 326 322 out: 323 + spin_unlock(&gmap->mm->page_table_lock); 327 324 up_read(&gmap->mm->mmap_sem); 328 325 if (flush) 329 326 gmap_flush_tlb(gmap); ··· 355 350 356 351 flush = 0; 357 352 down_read(&gmap->mm->mmap_sem); 353 + spin_lock(&gmap->mm->page_table_lock); 358 354 for (off = 0; off < len; off += PMD_SIZE) { 359 355 /* Walk the gmap address space page table */ 360 356 table = gmap->table + (((to + off) >> 53) & 0x7ff); ··· 379 373 flush |= gmap_unlink_segment(gmap, table); 380 374 *table = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO | (from + off); 381 375 } 376 + spin_unlock(&gmap->mm->page_table_lock); 382 377 up_read(&gmap->mm->mmap_sem); 383 378 if (flush) 384 379 gmap_flush_tlb(gmap); 385 380 return 0; 386 381 387 382 out_unmap: 383 + spin_unlock(&gmap->mm->page_table_lock); 388 384 up_read(&gmap->mm->mmap_sem); 389 385 gmap_unmap_segment(gmap, to, len); 390 386 return -ENOMEM; 391 387 } 392 388 EXPORT_SYMBOL_GPL(gmap_map_segment); 393 389 394 - unsigned long gmap_fault(unsigned long address, struct gmap *gmap) 390 + /* 391 + * this function is assumed to be called with mmap_sem held 392 + */ 393 + unsigned long __gmap_fault(unsigned long address, struct gmap *gmap) 395 394 { 396 395 unsigned long *table, vmaddr, segment; 397 396 struct mm_struct *mm; ··· 456 445 page = pmd_page(*pmd); 457 446 mp = (struct gmap_pgtable *) page->index; 458 447 rmap->entry = table; 448 + spin_lock(&mm->page_table_lock); 459 449 list_add(&rmap->list, &mp->mapper); 450 + spin_unlock(&mm->page_table_lock); 460 451 /* Set gmap segment table entry to page table. */ 461 452 *table = pmd_val(*pmd) & PAGE_MASK; 462 453 return vmaddr | (address & ~PMD_MASK); 463 454 } 464 455 return -EFAULT; 456 + } 465 457 458 + unsigned long gmap_fault(unsigned long address, struct gmap *gmap) 459 + { 460 + unsigned long rc; 461 + 462 + down_read(&gmap->mm->mmap_sem); 463 + rc = __gmap_fault(address, gmap); 464 + up_read(&gmap->mm->mmap_sem); 465 + 466 + return rc; 466 467 } 467 468 EXPORT_SYMBOL_GPL(gmap_fault); 469 + 470 + void gmap_discard(unsigned long from, unsigned long to, struct gmap *gmap) 471 + { 472 + 473 + unsigned long *table, address, size; 474 + struct vm_area_struct *vma; 475 + struct gmap_pgtable *mp; 476 + struct page *page; 477 + 478 + down_read(&gmap->mm->mmap_sem); 479 + address = from; 480 + while (address < to) { 481 + /* Walk the gmap address space page table */ 482 + table = gmap->table + ((address >> 53) & 0x7ff); 483 + if (unlikely(*table & _REGION_ENTRY_INV)) { 484 + address = (address + PMD_SIZE) & PMD_MASK; 485 + continue; 486 + } 487 + table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 488 + table = table + ((address >> 42) & 0x7ff); 489 + if (unlikely(*table & _REGION_ENTRY_INV)) { 490 + address = (address + PMD_SIZE) & PMD_MASK; 491 + continue; 492 + } 493 + table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 494 + table = table + ((address >> 31) & 0x7ff); 495 + if (unlikely(*table & _REGION_ENTRY_INV)) { 496 + address = (address + PMD_SIZE) & PMD_MASK; 497 + continue; 498 + } 499 + table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 500 + table = table + ((address >> 20) & 0x7ff); 501 + if (unlikely(*table & _SEGMENT_ENTRY_INV)) { 502 + address = (address + PMD_SIZE) & PMD_MASK; 503 + continue; 504 + } 505 + page = pfn_to_page(*table >> PAGE_SHIFT); 506 + mp = (struct gmap_pgtable *) page->index; 507 + vma = find_vma(gmap->mm, mp->vmaddr); 508 + size = min(to - address, PMD_SIZE - (address & ~PMD_MASK)); 509 + zap_page_range(vma, mp->vmaddr | (address & ~PMD_MASK), 510 + size, NULL); 511 + address = (address + PMD_SIZE) & PMD_MASK; 512 + } 513 + up_read(&gmap->mm->mmap_sem); 514 + } 515 + EXPORT_SYMBOL_GPL(gmap_discard); 468 516 469 517 void gmap_unmap_notifier(struct mm_struct *mm, unsigned long *table) 470 518 { ··· 732 662 733 663 void __tlb_remove_table(void *_table) 734 664 { 735 - void *table = (void *)((unsigned long) _table & PAGE_MASK); 736 - unsigned type = (unsigned long) _table & ~PAGE_MASK; 665 + const unsigned long mask = (FRAG_MASK << 4) | FRAG_MASK; 666 + void *table = (void *)((unsigned long) _table & ~mask); 667 + unsigned type = (unsigned long) _table & mask; 737 668 738 669 if (type) 739 670 __page_table_free_rcu(table, type);
+6
arch/s390/mm/vmem.c
··· 335 335 ro_start = ((unsigned long)&_stext) & PAGE_MASK; 336 336 ro_end = PFN_ALIGN((unsigned long)&_eshared); 337 337 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 338 + if (memory_chunk[i].type == CHUNK_CRASHK || 339 + memory_chunk[i].type == CHUNK_OLDMEM) 340 + continue; 338 341 start = memory_chunk[i].addr; 339 342 end = memory_chunk[i].addr + memory_chunk[i].size; 340 343 if (start >= ro_end || end <= ro_start) ··· 370 367 mutex_lock(&vmem_mutex); 371 368 for (i = 0; i < MEMORY_CHUNKS; i++) { 372 369 if (!memory_chunk[i].size) 370 + continue; 371 + if (memory_chunk[i].type == CHUNK_CRASHK || 372 + memory_chunk[i].type == CHUNK_OLDMEM) 373 373 continue; 374 374 seg = kzalloc(sizeof(*seg), GFP_KERNEL); 375 375 if (!seg)
+4 -4
arch/s390/oprofile/hwsampler.c
··· 994 994 * 995 995 * Returns 0 on success, !0 on failure. 996 996 */ 997 - int hwsampler_deallocate() 997 + int hwsampler_deallocate(void) 998 998 { 999 999 int rc; 1000 1000 ··· 1035 1035 return cb->sample_overflow; 1036 1036 } 1037 1037 1038 - int hwsampler_setup() 1038 + int hwsampler_setup(void) 1039 1039 { 1040 1040 int rc; 1041 1041 int cpu; ··· 1102 1102 return rc; 1103 1103 } 1104 1104 1105 - int hwsampler_shutdown() 1105 + int hwsampler_shutdown(void) 1106 1106 { 1107 1107 int rc; 1108 1108 ··· 1203 1203 * 1204 1204 * Returns 0 on success, !0 on failure. 1205 1205 */ 1206 - int hwsampler_stop_all() 1206 + int hwsampler_stop_all(void) 1207 1207 { 1208 1208 int tmp_rc, rc, cpu; 1209 1209 struct hws_cpu_buffer *cb;
+14 -5
drivers/s390/block/dasd.c
··· 11 11 #define KMSG_COMPONENT "dasd" 12 12 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 13 13 14 - #include <linux/kernel_stat.h> 15 14 #include <linux/kmod.h> 16 15 #include <linux/init.h> 17 16 #include <linux/interrupt.h> ··· 1593 1594 unsigned long long now; 1594 1595 int expires; 1595 1596 1596 - kstat_cpu(smp_processor_id()).irqs[IOINT_DAS]++; 1597 1597 if (IS_ERR(irb)) { 1598 1598 switch (PTR_ERR(irb)) { 1599 1599 case -EIO: ··· 2059 2061 /* 2060 2062 * Wakeup helper for the 'sleep_on' functions. 2061 2063 */ 2062 - static void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data) 2064 + void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data) 2063 2065 { 2064 2066 spin_lock_irq(get_ccwdev_lock(cqr->startdev->cdev)); 2065 2067 cqr->callback_data = DASD_SLEEPON_END_TAG; 2066 2068 spin_unlock_irq(get_ccwdev_lock(cqr->startdev->cdev)); 2067 2069 wake_up(&generic_waitq); 2068 2070 } 2071 + EXPORT_SYMBOL_GPL(dasd_wakeup_cb); 2069 2072 2070 2073 static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr) 2071 2074 { ··· 2166 2167 } else 2167 2168 wait_event(generic_waitq, !(device->stopped)); 2168 2169 2169 - cqr->callback = dasd_wakeup_cb; 2170 + if (!cqr->callback) 2171 + cqr->callback = dasd_wakeup_cb; 2172 + 2170 2173 cqr->callback_data = DASD_SLEEPON_START_TAG; 2171 2174 dasd_add_request_tail(cqr); 2172 2175 if (interruptible) { ··· 2264 2263 cqr->callback = dasd_wakeup_cb; 2265 2264 cqr->callback_data = DASD_SLEEPON_START_TAG; 2266 2265 cqr->status = DASD_CQR_QUEUED; 2267 - list_add(&cqr->devlist, &device->ccw_queue); 2266 + /* 2267 + * add new request as second 2268 + * first the terminated cqr needs to be finished 2269 + */ 2270 + list_add(&cqr->devlist, device->ccw_queue.next); 2268 2271 2269 2272 /* let the bh start the request to keep them in order */ 2270 2273 dasd_schedule_device_bh(device); ··· 3289 3284 if (IS_ERR(device)) 3290 3285 return PTR_ERR(device); 3291 3286 3287 + /* mark device as suspended */ 3288 + set_bit(DASD_FLAG_SUSPENDED, &device->flags); 3289 + 3292 3290 if (device->discipline->freeze) 3293 3291 rc = device->discipline->freeze(device); 3294 3292 ··· 3366 3358 if (device->block) 3367 3359 dasd_schedule_block_bh(device->block); 3368 3360 3361 + clear_bit(DASD_FLAG_SUSPENDED, &device->flags); 3369 3362 dasd_put_device(device); 3370 3363 return 0; 3371 3364 }
+41 -4
drivers/s390/block/dasd_eckd.c
··· 844 844 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); 845 845 } 846 846 847 + /* 848 + * Wakeup helper for read_conf 849 + * if the cqr is not done and needs some error recovery 850 + * the buffer has to be re-initialized with the EBCDIC "V1.0" 851 + * to show support for virtual device SNEQ 852 + */ 853 + static void read_conf_cb(struct dasd_ccw_req *cqr, void *data) 854 + { 855 + struct ccw1 *ccw; 856 + __u8 *rcd_buffer; 857 + 858 + if (cqr->status != DASD_CQR_DONE) { 859 + ccw = cqr->cpaddr; 860 + rcd_buffer = (__u8 *)((addr_t) ccw->cda); 861 + memset(rcd_buffer, 0, sizeof(*rcd_buffer)); 862 + 863 + rcd_buffer[0] = 0xE5; 864 + rcd_buffer[1] = 0xF1; 865 + rcd_buffer[2] = 0x4B; 866 + rcd_buffer[3] = 0xF0; 867 + } 868 + dasd_wakeup_cb(cqr, data); 869 + } 870 + 847 871 static int dasd_eckd_read_conf_immediately(struct dasd_device *device, 848 872 struct dasd_ccw_req *cqr, 849 873 __u8 *rcd_buffer, ··· 887 863 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); 888 864 set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags); 889 865 cqr->retries = 5; 866 + cqr->callback = read_conf_cb; 890 867 rc = dasd_sleep_on_immediatly(cqr); 891 868 return rc; 892 869 } ··· 925 900 goto out_error; 926 901 } 927 902 dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buf, lpm); 903 + cqr->callback = read_conf_cb; 928 904 ret = dasd_sleep_on(cqr); 929 905 /* 930 906 * on success we update the user input parms ··· 1100 1074 1101 1075 data = container_of(work, struct path_verification_work_data, worker); 1102 1076 device = data->device; 1077 + 1078 + /* delay path verification until device was resumed */ 1079 + if (test_bit(DASD_FLAG_SUSPENDED, &device->flags)) { 1080 + schedule_work(work); 1081 + return; 1082 + } 1103 1083 1104 1084 opm = 0; 1105 1085 npm = 0; ··· 2053 2021 /* first of all check for state change pending interrupt */ 2054 2022 mask = DEV_STAT_ATTENTION | DEV_STAT_DEV_END | DEV_STAT_UNIT_EXCEP; 2055 2023 if ((scsw_dstat(&irb->scsw) & mask) == mask) { 2056 - /* for alias only and not in offline processing*/ 2024 + /* 2025 + * for alias only, not in offline processing 2026 + * and only if not suspended 2027 + */ 2057 2028 if (!device->block && private->lcu && 2058 - !test_bit(DASD_FLAG_OFFLINE, &device->flags)) { 2029 + !test_bit(DASD_FLAG_OFFLINE, &device->flags) && 2030 + !test_bit(DASD_FLAG_SUSPENDED, &device->flags)) { 2059 2031 /* 2060 2032 * the state change could be caused by an alias 2061 2033 * reassignment remove device from alias handling ··· 2386 2350 new_track = 1; 2387 2351 end_idaw = 0; 2388 2352 len_to_track_end = 0; 2389 - idaw_dst = 0; 2353 + idaw_dst = NULL; 2390 2354 idaw_len = 0; 2391 2355 rq_for_each_segment(bv, req, iter) { 2392 2356 dst = page_address(bv->bv_page) + bv->bv_offset; ··· 2448 2412 if (end_idaw) { 2449 2413 idaws = idal_create_words(idaws, idaw_dst, 2450 2414 idaw_len); 2451 - idaw_dst = 0; 2415 + idaw_dst = NULL; 2452 2416 idaw_len = 0; 2453 2417 end_idaw = 0; 2454 2418 } ··· 4034 3998 .thaw = dasd_generic_restore_device, 4035 3999 .restore = dasd_generic_restore_device, 4036 4000 .uc_handler = dasd_generic_uc_handler, 4001 + .int_class = IOINT_DAS, 4037 4002 }; 4038 4003 4039 4004 /*
+1
drivers/s390/block/dasd_fba.c
··· 79 79 .freeze = dasd_generic_pm_freeze, 80 80 .thaw = dasd_generic_restore_device, 81 81 .restore = dasd_generic_restore_device, 82 + .int_class = IOINT_DAS, 82 83 }; 83 84 84 85 static void
+2
drivers/s390/block/dasd_int.h
··· 516 516 */ 517 517 #define DASD_FLAG_IS_RESERVED 7 /* The device is reserved */ 518 518 #define DASD_FLAG_LOCK_STOLEN 8 /* The device lock was stolen */ 519 + #define DASD_FLAG_SUSPENDED 9 /* The device was suspended */ 519 520 520 521 521 522 void dasd_put_device_wake(struct dasd_device *); ··· 644 643 dasd_smalloc_request(int , int, int, struct dasd_device *); 645 644 void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *); 646 645 void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *); 646 + void dasd_wakeup_cb(struct dasd_ccw_req *, void *); 647 647 648 648 static inline int 649 649 dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device)
+1 -2
drivers/s390/char/con3215.c
··· 9 9 * Dan Morrison, IBM Corporation <dmorriso@cse.buffalo.edu> 10 10 */ 11 11 12 - #include <linux/kernel_stat.h> 13 12 #include <linux/module.h> 14 13 #include <linux/types.h> 15 14 #include <linux/kdev_t.h> ··· 361 362 int cstat, dstat; 362 363 int count; 363 364 364 - kstat_cpu(smp_processor_id()).irqs[IOINT_C15]++; 365 365 raw = dev_get_drvdata(&cdev->dev); 366 366 req = (struct raw3215_req *) intparm; 367 367 cstat = irb->scsw.cmd.cstat; ··· 774 776 .freeze = &raw3215_pm_stop, 775 777 .thaw = &raw3215_pm_start, 776 778 .restore = &raw3215_pm_start, 779 + .int_class = IOINT_C15, 777 780 }; 778 781 779 782 #ifdef CONFIG_TN3215_CONSOLE
+1 -2
drivers/s390/char/raw3270.c
··· 7 7 * Copyright IBM Corp. 2003, 2009 8 8 */ 9 9 10 - #include <linux/kernel_stat.h> 11 10 #include <linux/module.h> 12 11 #include <linux/err.h> 13 12 #include <linux/init.h> ··· 329 330 struct raw3270_request *rq; 330 331 int rc; 331 332 332 - kstat_cpu(smp_processor_id()).irqs[IOINT_C70]++; 333 333 rp = dev_get_drvdata(&cdev->dev); 334 334 if (!rp) 335 335 return; ··· 1396 1398 .freeze = &raw3270_pm_stop, 1397 1399 .thaw = &raw3270_pm_start, 1398 1400 .restore = &raw3270_pm_start, 1401 + .int_class = IOINT_C70, 1399 1402 }; 1400 1403 1401 1404 static int
+2 -2
drivers/s390/char/sclp_cmd.c
··· 61 61 rc = sclp_service_call(cmd, sccb); 62 62 if (rc) 63 63 goto out; 64 - __load_psw_mask(PSW_BASE_BITS | PSW_MASK_EXT | 65 - PSW_MASK_WAIT | PSW_DEFAULT_KEY); 64 + __load_psw_mask(PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | 65 + PSW_MASK_BA | PSW_MASK_EXT | PSW_MASK_WAIT); 66 66 local_irq_disable(); 67 67 out: 68 68 /* Contents of the sccb might have changed. */
+2 -1
drivers/s390/char/sclp_quiesce.c
··· 30 30 psw_t quiesce_psw; 31 31 32 32 smp_send_stop(); 33 - quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; 33 + quiesce_psw.mask = 34 + PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA | PSW_MASK_WAIT; 34 35 quiesce_psw.addr = 0xfff; 35 36 __load_psw(quiesce_psw); 36 37 }
+1
drivers/s390/char/tape_34xx.c
··· 1330 1330 .set_online = tape_34xx_online, 1331 1331 .set_offline = tape_generic_offline, 1332 1332 .freeze = tape_generic_pm_suspend, 1333 + .int_class = IOINT_TAP, 1333 1334 }; 1334 1335 1335 1336 static int
+1
drivers/s390/char/tape_3590.c
··· 1762 1762 .set_offline = tape_generic_offline, 1763 1763 .set_online = tape_3590_online, 1764 1764 .freeze = tape_generic_pm_suspend, 1765 + .int_class = IOINT_TAP, 1765 1766 }; 1766 1767 1767 1768 /*
-2
drivers/s390/char/tape_core.c
··· 14 14 #define KMSG_COMPONENT "tape" 15 15 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 16 16 17 - #include <linux/kernel_stat.h> 18 17 #include <linux/module.h> 19 18 #include <linux/init.h> // for kernel parameters 20 19 #include <linux/kmod.h> // for requesting modules ··· 1114 1115 struct tape_request *request; 1115 1116 int rc; 1116 1117 1117 - kstat_cpu(smp_processor_id()).irqs[IOINT_TAP]++; 1118 1118 device = dev_get_drvdata(&cdev->dev); 1119 1119 if (device == NULL) { 1120 1120 return;
+1 -2
drivers/s390/char/vmur.c
··· 11 11 #define KMSG_COMPONENT "vmur" 12 12 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 13 13 14 - #include <linux/kernel_stat.h> 15 14 #include <linux/cdev.h> 16 15 #include <linux/slab.h> 17 16 ··· 73 74 .set_online = ur_set_online, 74 75 .set_offline = ur_set_offline, 75 76 .freeze = ur_pm_suspend, 77 + .int_class = IOINT_VMR, 76 78 }; 77 79 78 80 static DEFINE_MUTEX(vmur_mutex); ··· 305 305 { 306 306 struct urdev *urd; 307 307 308 - kstat_cpu(smp_processor_id()).irqs[IOINT_VMR]++; 309 308 TRACE("ur_int_handler: intparm=0x%lx cstat=%02x dstat=%02x res=%u\n", 310 309 intparm, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat, 311 310 irb->scsw.cmd.count);
+3 -18
drivers/s390/char/zcore.c
··· 16 16 #include <linux/slab.h> 17 17 #include <linux/miscdevice.h> 18 18 #include <linux/debugfs.h> 19 + #include <linux/module.h> 19 20 #include <asm/asm-offsets.h> 20 21 #include <asm/ipl.h> 21 22 #include <asm/sclp.h> ··· 141 140 static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count) 142 141 { 143 142 return memcpy_hsa(dest, src, count, TO_KERNEL); 144 - } 145 - 146 - static int memcpy_real_user(void __user *dest, unsigned long src, size_t count) 147 - { 148 - static char buf[4096]; 149 - int offs = 0, size; 150 - 151 - while (offs < count) { 152 - size = min(sizeof(buf), count - offs); 153 - if (memcpy_real(buf, (void *) src + offs, size)) 154 - return -EFAULT; 155 - if (copy_to_user(dest + offs, buf, size)) 156 - return -EFAULT; 157 - offs += size; 158 - } 159 - return 0; 160 143 } 161 144 162 145 static int __init init_cpu_info(enum arch_id arch) ··· 331 346 332 347 /* Copy from real mem */ 333 348 size = count - mem_offs - hdr_count; 334 - rc = memcpy_real_user(buf + hdr_count + mem_offs, mem_start + mem_offs, 335 - size); 349 + rc = copy_to_user_real(buf + hdr_count + mem_offs, 350 + (void *) mem_start + mem_offs, size); 336 351 if (rc) 337 352 goto fail; 338 353
+137 -196
drivers/s390/cio/ccwgroup.c
··· 29 29 30 30 /* a device matches a driver if all its slave devices match the same 31 31 * entry of the driver */ 32 - static int 33 - ccwgroup_bus_match (struct device * dev, struct device_driver * drv) 32 + static int ccwgroup_bus_match(struct device *dev, struct device_driver * drv) 34 33 { 35 - struct ccwgroup_device *gdev; 36 - struct ccwgroup_driver *gdrv; 37 - 38 - gdev = to_ccwgroupdev(dev); 39 - gdrv = to_ccwgroupdrv(drv); 34 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 35 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(drv); 40 36 41 37 if (gdev->creator_id == gdrv->driver_id) 42 38 return 1; 43 39 44 40 return 0; 45 41 } 46 - static int 47 - ccwgroup_uevent (struct device *dev, struct kobj_uevent_env *env) 48 - { 49 - /* TODO */ 50 - return 0; 51 - } 52 42 53 43 static struct bus_type ccwgroup_bus_type; 54 44 55 - static void 56 - __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) 45 + static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) 57 46 { 58 47 int i; 59 48 char str[8]; ··· 52 63 sysfs_remove_link(&gdev->dev.kobj, str); 53 64 sysfs_remove_link(&gdev->cdev[i]->dev.kobj, "group_device"); 54 65 } 55 - 56 66 } 57 67 58 68 /* ··· 75 87 } 76 88 } 77 89 90 + static int ccwgroup_set_online(struct ccwgroup_device *gdev) 91 + { 92 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); 93 + int ret = 0; 94 + 95 + if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) 96 + return -EAGAIN; 97 + if (gdev->state == CCWGROUP_ONLINE) 98 + goto out; 99 + if (gdrv->set_online) 100 + ret = gdrv->set_online(gdev); 101 + if (ret) 102 + goto out; 103 + 104 + gdev->state = CCWGROUP_ONLINE; 105 + out: 106 + atomic_set(&gdev->onoff, 0); 107 + return ret; 108 + } 109 + 110 + static int ccwgroup_set_offline(struct ccwgroup_device *gdev) 111 + { 112 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); 113 + int ret = 0; 114 + 115 + if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) 116 + return -EAGAIN; 117 + if (gdev->state == CCWGROUP_OFFLINE) 118 + goto out; 119 + if (gdrv->set_offline) 120 + ret = gdrv->set_offline(gdev); 121 + if (ret) 122 + goto out; 123 + 124 + gdev->state = CCWGROUP_OFFLINE; 125 + out: 126 + atomic_set(&gdev->onoff, 0); 127 + return ret; 128 + } 129 + 130 + static ssize_t ccwgroup_online_store(struct device *dev, 131 + struct device_attribute *attr, 132 + const char *buf, size_t count) 133 + { 134 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 135 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver); 136 + unsigned long value; 137 + int ret; 138 + 139 + if (!dev->driver) 140 + return -EINVAL; 141 + if (!try_module_get(gdrv->driver.owner)) 142 + return -EINVAL; 143 + 144 + ret = strict_strtoul(buf, 0, &value); 145 + if (ret) 146 + goto out; 147 + 148 + if (value == 1) 149 + ret = ccwgroup_set_online(gdev); 150 + else if (value == 0) 151 + ret = ccwgroup_set_offline(gdev); 152 + else 153 + ret = -EINVAL; 154 + out: 155 + module_put(gdrv->driver.owner); 156 + return (ret == 0) ? count : ret; 157 + } 158 + 159 + static ssize_t ccwgroup_online_show(struct device *dev, 160 + struct device_attribute *attr, 161 + char *buf) 162 + { 163 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 164 + int online; 165 + 166 + online = (gdev->state == CCWGROUP_ONLINE) ? 1 : 0; 167 + 168 + return scnprintf(buf, PAGE_SIZE, "%d\n", online); 169 + } 170 + 78 171 /* 79 172 * Provide an 'ungroup' attribute so the user can remove group devices no 80 173 * longer needed or accidentially created. Saves memory :) ··· 173 104 mutex_unlock(&gdev->reg_mutex); 174 105 } 175 106 176 - static ssize_t 177 - ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 107 + static ssize_t ccwgroup_ungroup_store(struct device *dev, 108 + struct device_attribute *attr, 109 + const char *buf, size_t count) 178 110 { 179 - struct ccwgroup_device *gdev; 111 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 180 112 int rc; 181 - 182 - gdev = to_ccwgroupdev(dev); 183 113 184 114 /* Prevent concurrent online/offline processing and ungrouping. */ 185 115 if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) ··· 200 132 } 201 133 return count; 202 134 } 203 - 204 135 static DEVICE_ATTR(ungroup, 0200, NULL, ccwgroup_ungroup_store); 136 + static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store); 205 137 206 - static void 207 - ccwgroup_release (struct device *dev) 138 + static struct attribute *ccwgroup_attrs[] = { 139 + &dev_attr_online.attr, 140 + &dev_attr_ungroup.attr, 141 + NULL, 142 + }; 143 + static struct attribute_group ccwgroup_attr_group = { 144 + .attrs = ccwgroup_attrs, 145 + }; 146 + static const struct attribute_group *ccwgroup_attr_groups[] = { 147 + &ccwgroup_attr_group, 148 + NULL, 149 + }; 150 + 151 + static void ccwgroup_release(struct device *dev) 208 152 { 209 153 kfree(to_ccwgroupdev(dev)); 210 154 } 211 155 212 - static int 213 - __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) 156 + static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) 214 157 { 215 158 char str[8]; 216 159 int i, rc; 217 160 218 161 for (i = 0; i < gdev->count; i++) { 219 - rc = sysfs_create_link(&gdev->cdev[i]->dev.kobj, &gdev->dev.kobj, 220 - "group_device"); 162 + rc = sysfs_create_link(&gdev->cdev[i]->dev.kobj, 163 + &gdev->dev.kobj, "group_device"); 221 164 if (rc) { 222 165 for (--i; i >= 0; i--) 223 166 sysfs_remove_link(&gdev->cdev[i]->dev.kobj, ··· 238 159 } 239 160 for (i = 0; i < gdev->count; i++) { 240 161 sprintf(str, "cdev%d", i); 241 - rc = sysfs_create_link(&gdev->dev.kobj, &gdev->cdev[i]->dev.kobj, 242 - str); 162 + rc = sysfs_create_link(&gdev->dev.kobj, 163 + &gdev->cdev[i]->dev.kobj, str); 243 164 if (rc) { 244 165 for (--i; i >= 0; i--) { 245 166 sprintf(str, "cdev%d", i); ··· 372 293 } 373 294 374 295 dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev)); 375 - 296 + gdev->dev.groups = ccwgroup_attr_groups; 376 297 rc = device_add(&gdev->dev); 377 298 if (rc) 378 299 goto error; 379 - get_device(&gdev->dev); 380 - rc = device_create_file(&gdev->dev, &dev_attr_ungroup); 381 - 300 + rc = __ccwgroup_create_symlinks(gdev); 382 301 if (rc) { 383 - device_unregister(&gdev->dev); 302 + device_del(&gdev->dev); 384 303 goto error; 385 304 } 386 - 387 - rc = __ccwgroup_create_symlinks(gdev); 388 - if (!rc) { 389 - mutex_unlock(&gdev->reg_mutex); 390 - put_device(&gdev->dev); 391 - return 0; 392 - } 393 - device_remove_file(&gdev->dev, &dev_attr_ungroup); 394 - device_unregister(&gdev->dev); 305 + mutex_unlock(&gdev->reg_mutex); 306 + return 0; 395 307 error: 396 308 for (i = 0; i < num_devices; i++) 397 309 if (gdev->cdev[i]) { ··· 400 330 EXPORT_SYMBOL(ccwgroup_create_from_string); 401 331 402 332 static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action, 403 - void *data); 333 + void *data) 334 + { 335 + struct device *dev = data; 336 + 337 + if (action == BUS_NOTIFY_UNBIND_DRIVER) 338 + device_schedule_callback(dev, ccwgroup_ungroup_callback); 339 + 340 + return NOTIFY_OK; 341 + } 404 342 405 343 static struct notifier_block ccwgroup_nb = { 406 344 .notifier_call = ccwgroup_notifier ··· 440 362 441 363 /************************** driver stuff ******************************/ 442 364 443 - static int 444 - ccwgroup_set_online(struct ccwgroup_device *gdev) 365 + static int ccwgroup_probe(struct device *dev) 445 366 { 446 - struct ccwgroup_driver *gdrv; 447 - int ret; 367 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 368 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver); 448 369 449 - if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) 450 - return -EAGAIN; 451 - if (gdev->state == CCWGROUP_ONLINE) { 452 - ret = 0; 453 - goto out; 454 - } 455 - if (!gdev->dev.driver) { 456 - ret = -EINVAL; 457 - goto out; 458 - } 459 - gdrv = to_ccwgroupdrv (gdev->dev.driver); 460 - if ((ret = gdrv->set_online ? gdrv->set_online(gdev) : 0)) 461 - goto out; 462 - 463 - gdev->state = CCWGROUP_ONLINE; 464 - out: 465 - atomic_set(&gdev->onoff, 0); 466 - return ret; 370 + return gdrv->probe ? gdrv->probe(gdev) : -ENODEV; 467 371 } 468 372 469 - static int 470 - ccwgroup_set_offline(struct ccwgroup_device *gdev) 373 + static int ccwgroup_remove(struct device *dev) 471 374 { 472 - struct ccwgroup_driver *gdrv; 473 - int ret; 474 - 475 - if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) 476 - return -EAGAIN; 477 - if (gdev->state == CCWGROUP_OFFLINE) { 478 - ret = 0; 479 - goto out; 480 - } 481 - if (!gdev->dev.driver) { 482 - ret = -EINVAL; 483 - goto out; 484 - } 485 - gdrv = to_ccwgroupdrv (gdev->dev.driver); 486 - if ((ret = gdrv->set_offline ? gdrv->set_offline(gdev) : 0)) 487 - goto out; 488 - 489 - gdev->state = CCWGROUP_OFFLINE; 490 - out: 491 - atomic_set(&gdev->onoff, 0); 492 - return ret; 493 - } 494 - 495 - static ssize_t 496 - ccwgroup_online_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 497 - { 498 - struct ccwgroup_device *gdev; 499 - struct ccwgroup_driver *gdrv; 500 - unsigned long value; 501 - int ret; 502 - 503 - if (!dev->driver) 504 - return -ENODEV; 505 - 506 - gdev = to_ccwgroupdev(dev); 507 - gdrv = to_ccwgroupdrv(dev->driver); 508 - 509 - if (!try_module_get(gdrv->driver.owner)) 510 - return -EINVAL; 511 - 512 - ret = strict_strtoul(buf, 0, &value); 513 - if (ret) 514 - goto out; 515 - 516 - if (value == 1) 517 - ret = ccwgroup_set_online(gdev); 518 - else if (value == 0) 519 - ret = ccwgroup_set_offline(gdev); 520 - else 521 - ret = -EINVAL; 522 - out: 523 - module_put(gdrv->driver.owner); 524 - return (ret == 0) ? count : ret; 525 - } 526 - 527 - static ssize_t 528 - ccwgroup_online_show (struct device *dev, struct device_attribute *attr, char *buf) 529 - { 530 - int online; 531 - 532 - online = (to_ccwgroupdev(dev)->state == CCWGROUP_ONLINE); 533 - 534 - return sprintf(buf, online ? "1\n" : "0\n"); 535 - } 536 - 537 - static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store); 538 - 539 - static int 540 - ccwgroup_probe (struct device *dev) 541 - { 542 - struct ccwgroup_device *gdev; 543 - struct ccwgroup_driver *gdrv; 544 - 545 - int ret; 546 - 547 - gdev = to_ccwgroupdev(dev); 548 - gdrv = to_ccwgroupdrv(dev->driver); 549 - 550 - if ((ret = device_create_file(dev, &dev_attr_online))) 551 - return ret; 552 - 553 - ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV; 554 - if (ret) 555 - device_remove_file(dev, &dev_attr_online); 556 - 557 - return ret; 558 - } 559 - 560 - static int 561 - ccwgroup_remove (struct device *dev) 562 - { 563 - struct ccwgroup_device *gdev; 564 - struct ccwgroup_driver *gdrv; 565 - 566 - device_remove_file(dev, &dev_attr_online); 567 - device_remove_file(dev, &dev_attr_ungroup); 375 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 376 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver); 568 377 569 378 if (!dev->driver) 570 379 return 0; 571 - 572 - gdev = to_ccwgroupdev(dev); 573 - gdrv = to_ccwgroupdrv(dev->driver); 574 - 575 380 if (gdrv->remove) 576 381 gdrv->remove(gdev); 577 382 ··· 463 502 464 503 static void ccwgroup_shutdown(struct device *dev) 465 504 { 466 - struct ccwgroup_device *gdev; 467 - struct ccwgroup_driver *gdrv; 505 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 506 + struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver); 468 507 469 508 if (!dev->driver) 470 509 return; 471 - 472 - gdev = to_ccwgroupdev(dev); 473 - gdrv = to_ccwgroupdrv(dev->driver); 474 - 475 510 if (gdrv->shutdown) 476 511 gdrv->shutdown(gdev); 477 512 } ··· 543 586 static struct bus_type ccwgroup_bus_type = { 544 587 .name = "ccwgroup", 545 588 .match = ccwgroup_bus_match, 546 - .uevent = ccwgroup_uevent, 547 589 .probe = ccwgroup_probe, 548 590 .remove = ccwgroup_remove, 549 591 .shutdown = ccwgroup_shutdown, 550 592 .pm = &ccwgroup_pm_ops, 551 593 }; 552 - 553 - 554 - static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action, 555 - void *data) 556 - { 557 - struct device *dev = data; 558 - 559 - if (action == BUS_NOTIFY_UNBIND_DRIVER) 560 - device_schedule_callback(dev, ccwgroup_ungroup_callback); 561 - 562 - return NOTIFY_OK; 563 - } 564 - 565 594 566 595 /** 567 596 * ccwgroup_driver_register() - register a ccw group driver ··· 562 619 563 620 return driver_register(&cdriver->driver); 564 621 } 622 + EXPORT_SYMBOL(ccwgroup_driver_register); 565 623 566 - static int 567 - __ccwgroup_match_all(struct device *dev, void *data) 624 + static int __ccwgroup_match_all(struct device *dev, void *data) 568 625 { 569 626 return 1; 570 627 } ··· 595 652 put_driver(&cdriver->driver); 596 653 driver_unregister(&cdriver->driver); 597 654 } 655 + EXPORT_SYMBOL(ccwgroup_driver_unregister); 598 656 599 657 /** 600 658 * ccwgroup_probe_ccwdev() - probe function for slave devices ··· 610 666 { 611 667 return 0; 612 668 } 669 + EXPORT_SYMBOL(ccwgroup_probe_ccwdev); 613 670 614 671 /** 615 672 * ccwgroup_remove_ccwdev() - remove function for slave devices ··· 647 702 /* Release ccwgroup device reference for local processing. */ 648 703 put_device(&gdev->dev); 649 704 } 650 - 651 - MODULE_LICENSE("GPL"); 652 - EXPORT_SYMBOL(ccwgroup_driver_register); 653 - EXPORT_SYMBOL(ccwgroup_driver_unregister); 654 - EXPORT_SYMBOL(ccwgroup_probe_ccwdev); 655 705 EXPORT_SYMBOL(ccwgroup_remove_ccwdev); 706 + MODULE_LICENSE("GPL");
+20 -3
drivers/s390/cio/ccwreq.c
··· 1 1 /* 2 2 * Handling of internal CCW device requests. 3 3 * 4 - * Copyright IBM Corp. 2009 4 + * Copyright IBM Corp. 2009, 2011 5 5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> 6 6 */ 7 + 8 + #define KMSG_COMPONENT "cio" 9 + #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 7 10 8 11 #include <linux/types.h> 9 12 #include <linux/err.h> ··· 326 323 { 327 324 struct subchannel *sch = to_subchannel(cdev->dev.parent); 328 325 struct ccw_request *req = &cdev->private->req; 329 - int rc; 326 + int rc = -ENODEV, chp; 327 + 328 + if (cio_update_schib(sch)) 329 + goto err; 330 + 331 + for (chp = 0; chp < 8; chp++) { 332 + if ((0x80 >> chp) & sch->schib.pmcw.lpum) 333 + pr_warning("%s: No interrupt was received within %lus " 334 + "(CS=%02x, DS=%02x, CHPID=%x.%02x)\n", 335 + dev_name(&cdev->dev), req->timeout / HZ, 336 + scsw_cstat(&sch->schib.scsw), 337 + scsw_dstat(&sch->schib.scsw), 338 + sch->schid.cssid, 339 + sch->schib.pmcw.chpid[chp]); 340 + } 330 341 331 342 if (!ccwreq_next_path(cdev)) { 332 343 /* set the final return code for this request */ ··· 359 342 * ccw_request_notoper - notoper handler for I/O request procedure 360 343 * @cdev: ccw device 361 344 * 362 - * Handle timeout during I/O request procedure. 345 + * Handle notoper during I/O request procedure. 363 346 */ 364 347 void ccw_request_notoper(struct ccw_device *cdev) 365 348 {
+4 -1
drivers/s390/cio/chsc_sch.c
··· 1 1 /* 2 2 * Driver for s390 chsc subchannels 3 3 * 4 - * Copyright IBM Corp. 2008, 2009 4 + * Copyright IBM Corp. 2008, 2011 5 5 * 6 6 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 7 7 * ··· 12 12 #include <linux/module.h> 13 13 #include <linux/uaccess.h> 14 14 #include <linux/miscdevice.h> 15 + #include <linux/kernel_stat.h> 15 16 16 17 #include <asm/compat.h> 17 18 #include <asm/cio.h> ··· 57 56 58 57 CHSC_LOG(4, "irb"); 59 58 CHSC_LOG_HEX(4, irb, sizeof(*irb)); 59 + kstat_cpu(smp_processor_id()).irqs[IOINT_CSC]++; 60 + 60 61 /* Copy irb to provided request and set done. */ 61 62 if (!request) { 62 63 CHSC_MSG(0, "Interrupt on sch 0.%x.%04x with no request\n",
+15 -4
drivers/s390/cio/cio.c
··· 622 622 sch = (struct subchannel *)(unsigned long)tpi_info->intparm; 623 623 if (!sch) { 624 624 /* Clear pending interrupt condition. */ 625 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 625 626 tsch(tpi_info->schid, irb); 626 627 continue; 627 628 } ··· 635 634 /* Call interrupt handler if there is one. */ 636 635 if (sch->driver && sch->driver->irq) 637 636 sch->driver->irq(sch); 638 - } 637 + else 638 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 639 + } else 640 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 639 641 spin_unlock(sch->lock); 640 642 /* 641 643 * Are more interrupts pending? ··· 671 667 tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; 672 668 if (tpi(NULL) != 1) 673 669 return 0; 670 + kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++; 674 671 if (tpi_info->adapter_IO) { 675 672 do_adapter_IO(tpi_info->isc); 676 673 return 1; 677 674 } 678 675 irb = (struct irb *)&S390_lowcore.irb; 679 676 /* Store interrupt response block to lowcore. */ 680 - if (tsch(tpi_info->schid, irb) != 0) 677 + if (tsch(tpi_info->schid, irb) != 0) { 681 678 /* Not status pending or not operational. */ 679 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 682 680 return 1; 681 + } 683 682 sch = (struct subchannel *)(unsigned long)tpi_info->intparm; 684 - if (!sch) 683 + if (!sch) { 684 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 685 685 return 1; 686 + } 686 687 irq_context = in_interrupt(); 687 688 if (!irq_context) 688 689 local_bh_disable(); ··· 696 687 memcpy(&sch->schib.scsw, &irb->scsw, sizeof(union scsw)); 697 688 if (sch->driver && sch->driver->irq) 698 689 sch->driver->irq(sch); 690 + else 691 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 699 692 spin_unlock(sch->lock); 700 693 irq_exit(); 701 694 if (!irq_context) ··· 1069 1058 { 1070 1059 struct subchannel_id schid; 1071 1060 1072 - s390_reset_system(); 1061 + s390_reset_system(NULL, NULL); 1073 1062 if (reipl_find_schid(devid, &schid) != 0) 1074 1063 panic("IPL Device not found\n"); 1075 1064 do_reipl_asm(*((__u32*)&schid));
+2
drivers/s390/cio/css.h
··· 133 133 134 134 extern struct channel_subsystem *channel_subsystems[]; 135 135 136 + void channel_subsystem_reinit(void); 137 + 136 138 /* Helper functions to build lists for the slow path. */ 137 139 void css_schedule_eval(struct subchannel_id schid); 138 140 void css_schedule_eval_all(void);
+13
drivers/s390/cio/device.c
··· 21 21 #include <linux/device.h> 22 22 #include <linux/workqueue.h> 23 23 #include <linux/timer.h> 24 + #include <linux/kernel_stat.h> 24 25 25 26 #include <asm/ccwdev.h> 26 27 #include <asm/cio.h> ··· 748 747 struct ccw_device *cdev) 749 748 { 750 749 cdev->private->cdev = cdev; 750 + cdev->private->int_class = IOINT_CIO; 751 751 atomic_set(&cdev->private->onoff, 0); 752 752 cdev->dev.parent = &sch->dev; 753 753 cdev->dev.release = ccw_device_release; ··· 1012 1010 CIO_TRACE_EVENT(6, dev_name(&sch->dev)); 1013 1011 if (cdev) 1014 1012 dev_fsm_event(cdev, DEV_EVENT_INTERRUPT); 1013 + else 1014 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 1015 1015 } 1016 1016 1017 1017 void io_subchannel_init_config(struct subchannel *sch) ··· 1625 1621 memset(&console_private, 0, sizeof(struct ccw_device_private)); 1626 1622 console_cdev.private = &console_private; 1627 1623 console_private.cdev = &console_cdev; 1624 + console_private.int_class = IOINT_CIO; 1628 1625 ret = ccw_device_console_enable(&console_cdev, sch); 1629 1626 if (ret) { 1630 1627 cio_release_console(); ··· 1707 1702 int ret; 1708 1703 1709 1704 cdev->drv = cdrv; /* to let the driver call _set_online */ 1705 + /* Note: we interpret class 0 in this context as an uninitialized 1706 + * field since it translates to a non-I/O interrupt class. */ 1707 + if (cdrv->int_class != 0) 1708 + cdev->private->int_class = cdrv->int_class; 1709 + else 1710 + cdev->private->int_class = IOINT_CIO; 1710 1711 1711 1712 ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; 1712 1713 1713 1714 if (ret) { 1714 1715 cdev->drv = NULL; 1716 + cdev->private->int_class = IOINT_CIO; 1715 1717 return ret; 1716 1718 } 1717 1719 ··· 1752 1740 } 1753 1741 ccw_device_set_timeout(cdev, 0); 1754 1742 cdev->drv = NULL; 1743 + cdev->private->int_class = IOINT_CIO; 1755 1744 return 0; 1756 1745 } 1757 1746
+12 -1
drivers/s390/cio/device.h
··· 5 5 #include <linux/atomic.h> 6 6 #include <linux/wait.h> 7 7 #include <linux/notifier.h> 8 + #include <linux/kernel_stat.h> 8 9 #include "io_sch.h" 9 10 10 11 /* ··· 57 56 static inline void 58 57 dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event) 59 58 { 60 - dev_jumptable[cdev->private->state][dev_event](cdev, dev_event); 59 + int state = cdev->private->state; 60 + 61 + if (dev_event == DEV_EVENT_INTERRUPT) { 62 + if (state == DEV_STATE_ONLINE) 63 + kstat_cpu(smp_processor_id()). 64 + irqs[cdev->private->int_class]++; 65 + else if (state != DEV_STATE_CMFCHANGE && 66 + state != DEV_STATE_CMFUPDATE) 67 + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 68 + } 69 + dev_jumptable[state][dev_event](cdev, dev_event); 61 70 } 62 71 63 72 /*
+2
drivers/s390/cio/io_sch.h
··· 4 4 #include <linux/types.h> 5 5 #include <asm/schid.h> 6 6 #include <asm/ccwdev.h> 7 + #include <asm/irq.h> 7 8 #include "css.h" 8 9 #include "orb.h" 9 10 ··· 158 157 struct list_head cmb_list; /* list of measured devices */ 159 158 u64 cmb_start_time; /* clock value of cmb reset */ 160 159 void *cmb_wait; /* deferred cmb enable/disable */ 160 + enum interruption_class int_class; 161 161 }; 162 162 163 163 static inline int rsch(struct subchannel_id schid)
+6 -34
drivers/s390/cio/qdio.h
··· 18 18 #define QDIO_BUSY_BIT_RETRIES 1000 /* = 10s retry time */ 19 19 #define QDIO_INPUT_THRESHOLD (500 << 12) /* 500 microseconds */ 20 20 21 - /* 22 - * if an asynchronous HiperSockets queue runs full, the 10 seconds timer wait 23 - * till next initiative to give transmitted skbs back to the stack is too long. 24 - * Therefore polling is started in case of multicast queue is filled more 25 - * than 50 percent. 26 - */ 27 - #define QDIO_IQDIO_POLL_LVL 65 /* HS multicast queue */ 28 - 29 21 enum qdio_irq_states { 30 22 QDIO_IRQ_STATE_INACTIVE, 31 23 QDIO_IRQ_STATE_ESTABLISHED, ··· 282 290 /* error condition during a data transfer */ 283 291 unsigned int qdio_error; 284 292 293 + /* last scan of the queue */ 294 + u64 timestamp; 295 + 285 296 struct tasklet_struct tasklet; 286 297 struct qdio_queue_perf_stat q_stats; 287 298 ··· 418 423 #define queue_irqs_disabled(q) \ 419 424 (test_bit(QDIO_QUEUE_IRQS_DISABLED, &q->u.in.queue_irq_state) != 0) 420 425 421 - #define TIQDIO_SHARED_IND 63 422 - 423 - /* device state change indicators */ 424 - struct indicator_t { 425 - u32 ind; /* u32 because of compare-and-swap performance */ 426 - atomic_t count; /* use count, 0 or 1 for non-shared indicators */ 427 - }; 428 - 429 - extern struct indicator_t *q_indicators; 430 - 431 - static inline int has_multiple_inq_on_dsci(struct qdio_irq *irq) 432 - { 433 - return irq->nr_input_qs > 1; 434 - } 435 - 436 - static inline int references_shared_dsci(struct qdio_irq *irq) 437 - { 438 - return irq->dsci == &q_indicators[TIQDIO_SHARED_IND].ind; 439 - } 440 - 441 - static inline int shared_ind(struct qdio_q *q) 442 - { 443 - struct qdio_irq *i = q->irq_ptr; 444 - return references_shared_dsci(i) || has_multiple_inq_on_dsci(i); 445 - } 426 + extern u64 last_ai_time; 446 427 447 428 /* prototypes for thin interrupt */ 448 429 void qdio_setup_thinint(struct qdio_irq *irq_ptr); ··· 431 460 void tiqdio_free_memory(void); 432 461 int tiqdio_register_thinints(void); 433 462 void tiqdio_unregister_thinints(void); 434 - 463 + void clear_nonshared_ind(struct qdio_irq *); 464 + int test_nonshared_ind(struct qdio_irq *); 435 465 436 466 /* prototypes for setup */ 437 467 void qdio_inbound_processing(unsigned long data);
+6 -4
drivers/s390/cio/qdio_debug.c
··· 54 54 if (!q) 55 55 return 0; 56 56 57 - seq_printf(m, "DSCI: %d nr_used: %d\n", 58 - *(u32 *)q->irq_ptr->dsci, atomic_read(&q->nr_buf_used)); 59 - seq_printf(m, "ftc: %d last_move: %d\n", 57 + seq_printf(m, "Timestamp: %Lx Last AI: %Lx\n", 58 + q->timestamp, last_ai_time); 59 + seq_printf(m, "nr_used: %d ftc: %d last_move: %d\n", 60 + atomic_read(&q->nr_buf_used), 60 61 q->first_to_check, q->last_move); 61 62 if (q->is_input_q) { 62 63 seq_printf(m, "polling: %d ack start: %d ack count: %d\n", 63 64 q->u.in.polling, q->u.in.ack_start, 64 65 q->u.in.ack_count); 65 - seq_printf(m, "IRQs disabled: %u\n", 66 + seq_printf(m, "DSCI: %d IRQs disabled: %u\n", 67 + *(u32 *)q->irq_ptr->dsci, 66 68 test_bit(QDIO_QUEUE_IRQS_DISABLED, 67 69 &q->u.in.queue_irq_state)); 68 70 }
+50 -52
drivers/s390/cio/qdio_main.c
··· 15 15 #include <linux/delay.h> 16 16 #include <linux/gfp.h> 17 17 #include <linux/io.h> 18 - #include <linux/kernel_stat.h> 19 18 #include <linux/atomic.h> 20 19 #include <asm/debug.h> 21 20 #include <asm/qdio.h> ··· 104 105 /* all done or next buffer state different */ 105 106 if (ccq == 0 || ccq == 32) 106 107 return 0; 107 - /* not all buffers processed */ 108 - if (ccq == 96 || ccq == 97) 108 + /* no buffer processed */ 109 + if (ccq == 97) 109 110 return 1; 111 + /* not all buffers processed */ 112 + if (ccq == 96) 113 + return 2; 110 114 /* notify devices immediately */ 111 115 DBF_ERROR("%4x ccq:%3d", SCH_NO(q), ccq); 112 116 return -EIO; ··· 129 127 static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state, 130 128 int start, int count, int auto_ack) 131 129 { 130 + int rc, tmp_count = count, tmp_start = start, nr = q->nr, retried = 0; 132 131 unsigned int ccq = 0; 133 - int tmp_count = count, tmp_start = start; 134 - int nr = q->nr; 135 - int rc; 136 132 137 133 BUG_ON(!q->irq_ptr->sch_token); 138 134 qperf_inc(q, eqbs); ··· 141 141 ccq = do_eqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count, 142 142 auto_ack); 143 143 rc = qdio_check_ccq(q, ccq); 144 - 145 - /* At least one buffer was processed, return and extract the remaining 146 - * buffers later. 147 - */ 148 - if ((ccq == 96) && (count != tmp_count)) { 149 - qperf_inc(q, eqbs_partial); 150 - return (count - tmp_count); 151 - } 144 + if (!rc) 145 + return count - tmp_count; 152 146 153 147 if (rc == 1) { 154 148 DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS again:%2d", ccq); 155 149 goto again; 156 150 } 157 151 158 - if (rc < 0) { 159 - DBF_ERROR("%4x EQBS ERROR", SCH_NO(q)); 160 - DBF_ERROR("%3d%3d%2d", count, tmp_count, nr); 161 - q->handler(q->irq_ptr->cdev, 162 - QDIO_ERROR_ACTIVATE_CHECK_CONDITION, 163 - q->nr, q->first_to_kick, count, 164 - q->irq_ptr->int_parm); 165 - return 0; 152 + if (rc == 2) { 153 + BUG_ON(tmp_count == count); 154 + qperf_inc(q, eqbs_partial); 155 + DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS part:%02x", 156 + tmp_count); 157 + /* 158 + * Retry once, if that fails bail out and process the 159 + * extracted buffers before trying again. 160 + */ 161 + if (!retried++) 162 + goto again; 163 + else 164 + return count - tmp_count; 166 165 } 167 - return count - tmp_count; 166 + 167 + DBF_ERROR("%4x EQBS ERROR", SCH_NO(q)); 168 + DBF_ERROR("%3d%3d%2d", count, tmp_count, nr); 169 + q->handler(q->irq_ptr->cdev, QDIO_ERROR_ACTIVATE_CHECK_CONDITION, 170 + 0, -1, -1, q->irq_ptr->int_parm); 171 + return 0; 168 172 } 169 173 170 174 /** ··· 201 197 again: 202 198 ccq = do_sqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count); 203 199 rc = qdio_check_ccq(q, ccq); 204 - if (rc == 1) { 200 + if (!rc) { 201 + WARN_ON(tmp_count); 202 + return count - tmp_count; 203 + } 204 + 205 + if (rc == 1 || rc == 2) { 205 206 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq); 206 207 qperf_inc(q, sqbs_partial); 207 208 goto again; 208 209 } 209 - if (rc < 0) { 210 - DBF_ERROR("%4x SQBS ERROR", SCH_NO(q)); 211 - DBF_ERROR("%3d%3d%2d", count, tmp_count, nr); 212 - q->handler(q->irq_ptr->cdev, 213 - QDIO_ERROR_ACTIVATE_CHECK_CONDITION, 214 - q->nr, q->first_to_kick, count, 215 - q->irq_ptr->int_parm); 216 - return 0; 217 - } 218 - WARN_ON(tmp_count); 219 - return count - tmp_count; 210 + 211 + DBF_ERROR("%4x SQBS ERROR", SCH_NO(q)); 212 + DBF_ERROR("%3d%3d%2d", count, tmp_count, nr); 213 + q->handler(q->irq_ptr->cdev, QDIO_ERROR_ACTIVATE_CHECK_CONDITION, 214 + 0, -1, -1, q->irq_ptr->int_parm); 215 + return 0; 220 216 } 221 217 222 218 /* returns number of examined buffers and their common state in *state */ ··· 281 277 } 282 278 283 279 /* set slsb states to initial state */ 284 - void qdio_init_buf_states(struct qdio_irq *irq_ptr) 280 + static void qdio_init_buf_states(struct qdio_irq *irq_ptr) 285 281 { 286 282 struct qdio_q *q; 287 283 int i; ··· 450 446 qperf_inc(q, target_full); 451 447 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", 452 448 q->first_to_check); 453 - return; 449 + goto set; 454 450 } 455 451 456 452 DBF_ERROR("%4x BUF ERROR", SCH_NO(q)); ··· 460 456 q->sbal[q->first_to_check]->element[14].sflags, 461 457 q->sbal[q->first_to_check]->element[15].sflags); 462 458 459 + set: 463 460 /* 464 461 * Interrupts may be avoided as long as the error is present 465 462 * so change the buffer state immediately to avoid starvation. ··· 517 512 { 518 513 int count, stop; 519 514 unsigned char state = 0; 515 + 516 + q->timestamp = get_clock_fast(); 520 517 521 518 /* 522 519 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved ··· 789 782 int count, stop; 790 783 unsigned char state = 0; 791 784 785 + q->timestamp = get_clock_fast(); 786 + 792 787 if (need_siga_sync(q)) 793 788 if (((queue_type(q) != QDIO_IQDIO_QFMT) && 794 789 !pci_out_supported(q)) || ··· 921 912 if (!pci_out_supported(q) && !qdio_outbound_q_done(q)) 922 913 goto sched; 923 914 924 - /* bail out for HiperSockets unicast queues */ 925 - if (queue_type(q) == QDIO_IQDIO_QFMT && !multicast_outbound(q)) 926 - return; 927 - 928 - if ((queue_type(q) == QDIO_IQDIO_QFMT) && 929 - (atomic_read(&q->nr_buf_used)) > QDIO_IQDIO_POLL_LVL) 930 - goto sched; 931 - 932 915 if (q->u.out.pci_out_enabled) 933 916 return; 934 917 935 918 /* 936 919 * Now we know that queue type is either qeth without pci enabled 937 - * or HiperSockets multicast. Make sure buffer switch from PRIMED to 938 - * EMPTY is noticed and outbound_handler is called after some time. 920 + * or HiperSockets. Make sure buffer switch from PRIMED to EMPTY 921 + * is noticed and outbound_handler is called after some time. 939 922 */ 940 923 if (qdio_outbound_q_done(q)) 941 924 del_timer(&q->u.out.timer); ··· 1129 1128 return; 1130 1129 } 1131 1130 1132 - kstat_cpu(smp_processor_id()).irqs[IOINT_QDI]++; 1133 1131 if (irq_ptr->perf_stat_enabled) 1134 1132 irq_ptr->perf_stat.qdio_int++; 1135 1133 ··· 1719 1719 1720 1720 WARN_ON(queue_irqs_enabled(q)); 1721 1721 1722 - if (!shared_ind(q)) 1723 - xchg(q->irq_ptr->dsci, 0); 1724 - 1722 + clear_nonshared_ind(irq_ptr); 1725 1723 qdio_stop_polling(q); 1726 1724 clear_bit(QDIO_QUEUE_IRQS_DISABLED, &q->u.in.queue_irq_state); 1727 1725 ··· 1727 1729 * We need to check again to not lose initiative after 1728 1730 * resetting the ACK state. 1729 1731 */ 1730 - if (!shared_ind(q) && *q->irq_ptr->dsci) 1732 + if (test_nonshared_ind(irq_ptr)) 1731 1733 goto rescan; 1732 1734 if (!qdio_inbound_q_done(q)) 1733 1735 goto rescan;
+48 -4
drivers/s390/cio/qdio_thinint.c
··· 26 26 */ 27 27 #define TIQDIO_NR_NONSHARED_IND 63 28 28 #define TIQDIO_NR_INDICATORS (TIQDIO_NR_NONSHARED_IND + 1) 29 + #define TIQDIO_SHARED_IND 63 30 + 31 + /* device state change indicators */ 32 + struct indicator_t { 33 + u32 ind; /* u32 because of compare-and-swap performance */ 34 + atomic_t count; /* use count, 0 or 1 for non-shared indicators */ 35 + }; 29 36 30 37 /* list of thin interrupt input queues */ 31 38 static LIST_HEAD(tiq_list); 32 - DEFINE_MUTEX(tiq_list_lock); 39 + static DEFINE_MUTEX(tiq_list_lock); 33 40 34 41 /* adapter local summary indicator */ 35 42 static u8 *tiqdio_alsi; 36 43 37 - struct indicator_t *q_indicators; 44 + static struct indicator_t *q_indicators; 38 45 39 - static u64 last_ai_time; 46 + u64 last_ai_time; 40 47 41 48 /* returns addr for the device state change indicator */ 42 49 static u32 *get_indicator(void) ··· 97 90 synchronize_rcu(); 98 91 } 99 92 93 + static inline int has_multiple_inq_on_dsci(struct qdio_irq *irq_ptr) 94 + { 95 + return irq_ptr->nr_input_qs > 1; 96 + } 97 + 98 + static inline int references_shared_dsci(struct qdio_irq *irq_ptr) 99 + { 100 + return irq_ptr->dsci == &q_indicators[TIQDIO_SHARED_IND].ind; 101 + } 102 + 103 + static inline int shared_ind(struct qdio_irq *irq_ptr) 104 + { 105 + return references_shared_dsci(irq_ptr) || 106 + has_multiple_inq_on_dsci(irq_ptr); 107 + } 108 + 109 + void clear_nonshared_ind(struct qdio_irq *irq_ptr) 110 + { 111 + if (!is_thinint_irq(irq_ptr)) 112 + return; 113 + if (shared_ind(irq_ptr)) 114 + return; 115 + xchg(irq_ptr->dsci, 0); 116 + } 117 + 118 + int test_nonshared_ind(struct qdio_irq *irq_ptr) 119 + { 120 + if (!is_thinint_irq(irq_ptr)) 121 + return 0; 122 + if (shared_ind(irq_ptr)) 123 + return 0; 124 + if (*irq_ptr->dsci) 125 + return 1; 126 + else 127 + return 0; 128 + } 129 + 100 130 static inline u32 clear_shared_ind(void) 101 131 { 102 132 if (!atomic_read(&q_indicators[TIQDIO_SHARED_IND].count)) ··· 163 119 q->u.in.queue_start_poll(q->irq_ptr->cdev, q->nr, 164 120 q->irq_ptr->int_parm); 165 121 } else { 166 - if (!shared_ind(q)) 122 + if (!shared_ind(q->irq_ptr)) 167 123 xchg(q->irq_ptr->dsci, 0); 168 124 169 125 /*
+4 -4
drivers/s390/kvm/kvm_virtio.c
··· 33 33 * The pointer to our (page) of device descriptions. 34 34 */ 35 35 static void *kvm_devices; 36 - struct work_struct hotplug_work; 36 + static struct work_struct hotplug_work; 37 37 38 38 struct kvm_device { 39 39 struct virtio_device vdev; ··· 334 334 */ 335 335 static int match_desc(struct device *dev, void *data) 336 336 { 337 - if ((ulong)to_kvmdev(dev_to_virtio(dev))->desc == (ulong)data) 338 - return 1; 337 + struct virtio_device *vdev = dev_to_virtio(dev); 338 + struct kvm_device *kdev = to_kvmdev(vdev); 339 339 340 - return 0; 340 + return kdev->desc == data; 341 341 } 342 342 343 343 /*
+1 -2
drivers/s390/net/claw.c
··· 63 63 64 64 #define KMSG_COMPONENT "claw" 65 65 66 - #include <linux/kernel_stat.h> 67 66 #include <asm/ccwdev.h> 68 67 #include <asm/ccwgroup.h> 69 68 #include <asm/debug.h> ··· 290 291 .ids = claw_ids, 291 292 .probe = ccwgroup_probe_ccwdev, 292 293 .remove = ccwgroup_remove_ccwdev, 294 + .int_class = IOINT_CLW, 293 295 }; 294 296 295 297 static ssize_t ··· 645 645 struct claw_env *p_env; 646 646 struct chbk *p_ch_r=NULL; 647 647 648 - kstat_cpu(smp_processor_id()).irqs[IOINT_CLW]++; 649 648 CLAW_DBF_TEXT(4, trace, "clawirq"); 650 649 /* Bypass all 'unsolicited interrupts' */ 651 650 privptr = dev_get_drvdata(&cdev->dev);
+1 -2
drivers/s390/net/ctcm_main.c
··· 24 24 #define KMSG_COMPONENT "ctcm" 25 25 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 26 26 27 - #include <linux/kernel_stat.h> 28 27 #include <linux/module.h> 29 28 #include <linux/init.h> 30 29 #include <linux/kernel.h> ··· 1202 1203 int cstat; 1203 1204 int dstat; 1204 1205 1205 - kstat_cpu(smp_processor_id()).irqs[IOINT_CTC]++; 1206 1206 CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, 1207 1207 "Enter %s(%s)", CTCM_FUNTAIL, dev_name(&cdev->dev)); 1208 1208 ··· 1767 1769 .ids = ctcm_ids, 1768 1770 .probe = ccwgroup_probe_ccwdev, 1769 1771 .remove = ccwgroup_remove_ccwdev, 1772 + .int_class = IOINT_CTC, 1770 1773 }; 1771 1774 1772 1775 static struct ccwgroup_driver ctcm_group_driver = {
+1 -1
drivers/s390/net/ctcm_sysfs.c
··· 159 159 return count; 160 160 } 161 161 162 - const char *ctcm_type[] = { 162 + static const char *ctcm_type[] = { 163 163 "not a channel", 164 164 "CTC/A", 165 165 "FICON channel",
+2 -3
drivers/s390/net/lcs.c
··· 26 26 #define KMSG_COMPONENT "lcs" 27 27 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 28 28 29 - #include <linux/kernel_stat.h> 30 29 #include <linux/module.h> 31 30 #include <linux/if.h> 32 31 #include <linux/netdevice.h> ··· 1398 1399 int rc, index; 1399 1400 int cstat, dstat; 1400 1401 1401 - kstat_cpu(smp_processor_id()).irqs[IOINT_LCS]++; 1402 1402 if (lcs_check_irb_error(cdev, irb)) 1403 1403 return; 1404 1404 ··· 1970 1972 1971 1973 static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store); 1972 1974 1973 - const char *lcs_type[] = { 1975 + static const char *lcs_type[] = { 1974 1976 "not a channel", 1975 1977 "2216 parallel", 1976 1978 "2216 channel", ··· 2397 2399 .ids = lcs_ids, 2398 2400 .probe = ccwgroup_probe_ccwdev, 2399 2401 .remove = ccwgroup_remove_ccwdev, 2402 + .int_class = IOINT_LCS, 2400 2403 }; 2401 2404 2402 2405 /**
+1 -1
drivers/s390/net/qeth_l3_main.c
··· 1415 1415 return 0; 1416 1416 } 1417 1417 1418 - int qeth_l3_set_rx_csum(struct qeth_card *card, int on) 1418 + static int qeth_l3_set_rx_csum(struct qeth_card *card, int on) 1419 1419 { 1420 1420 int rc = 0; 1421 1421
+1
include/linux/crash_dump.h
··· 10 10 #define ELFCORE_ADDR_ERR (-2ULL) 11 11 12 12 extern unsigned long long elfcorehdr_addr; 13 + extern unsigned long long elfcorehdr_size; 13 14 14 15 extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 15 16 unsigned long, int);
+1
include/linux/elf.h
··· 395 395 #define NT_S390_CTRS 0x304 /* s390 control registers */ 396 396 #define NT_S390_PREFIX 0x305 /* s390 prefix register */ 397 397 #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 398 + #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 398 399 #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 399 400 400 401
+10
include/linux/kexec.h
··· 33 33 #error KEXEC_ARCH not defined 34 34 #endif 35 35 36 + #ifndef KEXEC_CRASH_CONTROL_MEMORY_LIMIT 37 + #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT KEXEC_CONTROL_MEMORY_LIMIT 38 + #endif 39 + 40 + #ifndef KEXEC_CRASH_MEM_ALIGN 41 + #define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE 42 + #endif 43 + 36 44 #define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4) 37 45 #define KEXEC_CORE_NOTE_NAME "CORE" 38 46 #define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4) ··· 137 129 int kexec_should_crash(struct task_struct *); 138 130 void crash_save_cpu(struct pt_regs *regs, int cpu); 139 131 void crash_save_vmcoreinfo(void); 132 + void crash_map_reserved_pages(void); 133 + void crash_unmap_reserved_pages(void); 140 134 void arch_crash_save_vmcoreinfo(void); 141 135 void vmcoreinfo_append_str(const char *fmt, ...) 142 136 __attribute__ ((format (printf, 1, 2)));
+11
kernel/crash_dump.c
··· 20 20 unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; 21 21 22 22 /* 23 + * stores the size of elf header of crash image 24 + */ 25 + unsigned long long elfcorehdr_size; 26 + 27 + /* 23 28 * elfcorehdr= specifies the location of elf core header stored by the crashed 24 29 * kernel. This option will be passed by kexec loader to the capture kernel. 30 + * 31 + * Syntax: elfcorehdr=[size[KMG]@]offset[KMG] 25 32 */ 26 33 static int __init setup_elfcorehdr(char *arg) 27 34 { ··· 36 29 if (!arg) 37 30 return -EINVAL; 38 31 elfcorehdr_addr = memparse(arg, &end); 32 + if (*end == '@') { 33 + elfcorehdr_size = elfcorehdr_addr; 34 + elfcorehdr_addr = memparse(end + 1, &end); 35 + } 39 36 return end > arg ? 0 : -EINVAL; 40 37 } 41 38 early_param("elfcorehdr", setup_elfcorehdr);
+29 -12
kernel/kexec.c
··· 498 498 while (hole_end <= crashk_res.end) { 499 499 unsigned long i; 500 500 501 - if (hole_end > KEXEC_CONTROL_MEMORY_LIMIT) 501 + if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT) 502 502 break; 503 503 if (hole_end > crashk_res.end) 504 504 break; ··· 999 999 kimage_free(xchg(&kexec_crash_image, NULL)); 1000 1000 result = kimage_crash_alloc(&image, entry, 1001 1001 nr_segments, segments); 1002 + crash_map_reserved_pages(); 1002 1003 } 1003 1004 if (result) 1004 1005 goto out; ··· 1016 1015 goto out; 1017 1016 } 1018 1017 kimage_terminate(image); 1018 + if (flags & KEXEC_ON_CRASH) 1019 + crash_unmap_reserved_pages(); 1019 1020 } 1020 1021 /* Install the new kernel, and Uninstall the old */ 1021 1022 image = xchg(dest_image, image); ··· 1028 1025 1029 1026 return result; 1030 1027 } 1028 + 1029 + /* 1030 + * Add and remove page tables for crashkernel memory 1031 + * 1032 + * Provide an empty default implementation here -- architecture 1033 + * code may override this 1034 + */ 1035 + void __weak crash_map_reserved_pages(void) 1036 + {} 1037 + 1038 + void __weak crash_unmap_reserved_pages(void) 1039 + {} 1031 1040 1032 1041 #ifdef CONFIG_COMPAT 1033 1042 asmlinkage long compat_sys_kexec_load(unsigned long entry, ··· 1149 1134 goto unlock; 1150 1135 } 1151 1136 1152 - start = roundup(start, PAGE_SIZE); 1153 - end = roundup(start + new_size, PAGE_SIZE); 1137 + start = roundup(start, KEXEC_CRASH_MEM_ALIGN); 1138 + end = roundup(start + new_size, KEXEC_CRASH_MEM_ALIGN); 1154 1139 1140 + crash_map_reserved_pages(); 1155 1141 crash_free_reserved_phys_range(end, crashk_res.end); 1156 1142 1157 1143 if ((start == end) && (crashk_res.parent != NULL)) 1158 1144 release_resource(&crashk_res); 1159 1145 crashk_res.end = end - 1; 1146 + crash_unmap_reserved_pages(); 1160 1147 1161 1148 unlock: 1162 1149 mutex_unlock(&kexec_mutex); ··· 1397 1380 } 1398 1381 1399 1382 1400 - 1401 - void crash_save_vmcoreinfo(void) 1383 + static void update_vmcoreinfo_note(void) 1402 1384 { 1403 - u32 *buf; 1385 + u32 *buf = vmcoreinfo_note; 1404 1386 1405 1387 if (!vmcoreinfo_size) 1406 1388 return; 1407 - 1408 - vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); 1409 - 1410 - buf = (u32 *)vmcoreinfo_note; 1411 - 1412 1389 buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data, 1413 1390 vmcoreinfo_size); 1414 - 1415 1391 final_note(buf); 1392 + } 1393 + 1394 + void crash_save_vmcoreinfo(void) 1395 + { 1396 + vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); 1397 + update_vmcoreinfo_note(); 1416 1398 } 1417 1399 1418 1400 void vmcoreinfo_append_str(const char *fmt, ...) ··· 1499 1483 VMCOREINFO_NUMBER(PG_swapcache); 1500 1484 1501 1485 arch_crash_save_vmcoreinfo(); 1486 + update_vmcoreinfo_note(); 1502 1487 1503 1488 return 0; 1504 1489 }
-8
kernel/sysctl.c
··· 151 151 extern int unaligned_enabled; 152 152 #endif 153 153 154 - #ifdef CONFIG_S390 155 - #ifdef CONFIG_MATHEMU 156 - extern int sysctl_ieee_emulation_warnings; 157 - #endif 158 - extern int sysctl_userprocess_debug; 159 - extern int spin_retry; 160 - #endif 161 - 162 154 #ifdef CONFIG_IA64 163 155 extern int no_unaligned_warning; 164 156 extern int unaligned_dump_stack;