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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 's390-5.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 updates from Vasily Gorbik:

- Rework inline asm to get rid of error prone "register asm"
constructs, which are problematic especially when code
instrumentation is enabled.

In particular introduce and use register pair union to allocate
even/odd register pairs. Unfortunately this breaks compatibility with
older clang compilers and minimum clang version for s390 has been
raised to 13.

https://lore.kernel.org/linux-next/CAK7LNARuSmPCEy-ak0erPrPTgZdGVypBROFhtw+=3spoGoYsyw@mail.gmail.com/

- Fix gcc 11 warnings, which triggered various minor reworks all over
the code.

- Add zstd kernel image compression support.

- Rework boot CPU lowcore handling.

- De-duplicate and move kernel memory layout setup logic earlier.

- Few fixes in preparation for FORTIFY_SOURCE performing compile-time
and run-time field bounds checking for mem functions.

- Remove broken and unused power management support leftovers in s390
drivers.

- Disable stack-protector for decompressor and purgatory to fix
buildroot build.

- Fix vt220 sclp console name to match the char device name.

- Enable HAVE_IOREMAP_PROT and add zpci_set_irq()/zpci_clear_irq() in
zPCI code.

- Remove some implausible WARN_ON_ONCEs and remove arch specific
counter transaction call backs in favour of default transaction
handling in perf code.

- Extend/add new uevents for online/config/mode state changes of AP
card / queue device in zcrypt.

- Minor entry and ccwgroup code improvements.

- Other small various fixes and improvements all over the code.

* tag 's390-5.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (91 commits)
s390/dasd: use register pair instead of register asm
s390/qdio: get rid of register asm
s390/ioasm: use symbolic names for asm operands
s390/ioasm: get rid of register asm
s390/cmf: get rid of register asm
s390/lib,string: get rid of register asm
s390/lib,uaccess: get rid of register asm
s390/string: get rid of register asm
s390/cmpxchg: use register pair instead of register asm
s390/mm,pages-states: get rid of register asm
s390/lib,xor: get rid of register asm
s390/timex: get rid of register asm
s390/hypfs: use register pair instead of register asm
s390/zcrypt: Switch to flexible array member
s390/speculation: Use statically initialized const for instructions
virtio/s390: get rid of open-coded kvm hypercall
s390/pci: add zpci_set_irq()/zpci_clear_irq()
scripts/min-tool-version.sh: Raise minimum clang version to 13.0.0 for s390
s390/ipl: use register pair instead of register asm
s390/mem_detect: fix tprot() program check new psw handling
...

+1249 -1852
+3 -1
arch/s390/Kconfig
··· 162 162 select HAVE_FUTEX_CMPXCHG if FUTEX 163 163 select HAVE_GCC_PLUGINS 164 164 select HAVE_GENERIC_VDSO 165 + select HAVE_IOREMAP_PROT if PCI 165 166 select HAVE_IRQ_EXIT_ON_IRQ_STACK 166 167 select HAVE_KERNEL_BZIP2 167 168 select HAVE_KERNEL_GZIP ··· 171 170 select HAVE_KERNEL_LZO 172 171 select HAVE_KERNEL_UNCOMPRESSED 173 172 select HAVE_KERNEL_XZ 173 + select HAVE_KERNEL_ZSTD 174 174 select HAVE_KPROBES 175 175 select HAVE_KPROBES_ON_FTRACE 176 176 select HAVE_KRETPROBES ··· 854 852 config APPLDATA_BASE 855 853 def_bool n 856 854 prompt "Linux - VM Monitor Stream, base infrastructure" 857 - depends on PROC_FS 855 + depends on PROC_SYSCTL 858 856 help 859 857 This provides a kernel interface for creating and updating z/VM APPLDATA 860 858 monitor records. The monitor records are updated at certain time
+1
arch/s390/Makefile
··· 28 28 KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain 29 29 KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables 30 30 KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding 31 + KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector 31 32 KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) 32 33 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) 33 34 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+3 -3
arch/s390/boot/als.c
··· 68 68 69 69 first = 1; 70 70 for (i = 0; i < ARRAY_SIZE(als); i++) { 71 - val = ~S390_lowcore.stfle_fac_list[i] & als[i]; 71 + val = ~stfle_fac_list[i] & als[i]; 72 72 for (j = 0; j < BITS_PER_LONG; j++) { 73 73 if (!(val & (1UL << (BITS_PER_LONG - 1 - j)))) 74 74 continue; ··· 106 106 { 107 107 int i; 108 108 109 - __stfle(S390_lowcore.stfle_fac_list, ARRAY_SIZE(S390_lowcore.stfle_fac_list)); 109 + __stfle(stfle_fac_list, ARRAY_SIZE(stfle_fac_list)); 110 110 for (i = 0; i < ARRAY_SIZE(als); i++) { 111 - if ((S390_lowcore.stfle_fac_list[i] & als[i]) != als[i]) 111 + if ((stfle_fac_list[i] & als[i]) != als[i]) 112 112 facility_mismatch(); 113 113 } 114 114 }
+1
arch/s390/boot/boot.h
··· 24 24 25 25 extern const char kernel_version[]; 26 26 extern unsigned long memory_limit; 27 + extern unsigned long vmalloc_size; 27 28 extern int vmalloc_size_set; 28 29 extern int kaslr_enabled; 29 30
+5 -1
arch/s390/boot/compressed/Makefile
··· 14 14 obj-all := $(obj-y) piggy.o syms.o 15 15 targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 16 16 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 17 + targets += vmlinux.bin.zst 17 18 targets += info.bin syms.bin vmlinux.syms $(obj-all) 18 19 19 20 KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) ··· 34 33 35 34 quiet_cmd_dumpsyms = DUMPSYMS $< 36 35 define cmd_dumpsyms 37 - $(NM) -n -S --format=bsd "$<" | $(PERL) -ne '/(\w+)\s+(\w+)\s+[tT]\s+(\w+)/ and printf "%x %x %s\0",hex $$1,hex $$2,$$3' > "$@" 36 + $(NM) -n -S --format=bsd "$<" | sed -nE 's/^0*([0-9a-fA-F]+) 0*([0-9a-fA-F]+) [tT] ([^ ]*)$$/\1 \2 \3/p' | tr '\n' '\0' > "$@" 38 37 endef 39 38 40 39 $(obj)/syms.bin: $(obj)/vmlinux.syms FORCE ··· 64 63 suffix-$(CONFIG_KERNEL_LZMA) := .lzma 65 64 suffix-$(CONFIG_KERNEL_LZO) := .lzo 66 65 suffix-$(CONFIG_KERNEL_XZ) := .xz 66 + suffix-$(CONFIG_KERNEL_ZSTD) := .zst 67 67 68 68 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE 69 69 $(call if_changed,gzip) ··· 78 76 $(call if_changed,lzo) 79 77 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE 80 78 $(call if_changed,xzkern) 79 + $(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE 80 + $(call if_changed,zstd22) 81 81 82 82 OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed 83 83 $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE
+7 -1
arch/s390/boot/compressed/decompressor.c
··· 28 28 extern unsigned char _compressed_start[]; 29 29 extern unsigned char _compressed_end[]; 30 30 31 - #ifdef CONFIG_HAVE_KERNEL_BZIP2 31 + #ifdef CONFIG_KERNEL_BZIP2 32 32 #define BOOT_HEAP_SIZE 0x400000 33 + #elif CONFIG_KERNEL_ZSTD 34 + #define BOOT_HEAP_SIZE 0x30000 33 35 #else 34 36 #define BOOT_HEAP_SIZE 0x10000 35 37 #endif ··· 61 59 62 60 #ifdef CONFIG_KERNEL_XZ 63 61 #include "../../../../lib/decompress_unxz.c" 62 + #endif 63 + 64 + #ifdef CONFIG_KERNEL_ZSTD 65 + #include "../../../../lib/decompress_unzstd.c" 64 66 #endif 65 67 66 68 #define decompress_offset ALIGN((unsigned long)_end + BOOT_HEAP_SIZE, PAGE_SIZE)
+3
arch/s390/boot/head.S
··· 401 401 # Must be keept in sync with struct parmarea in setup.h 402 402 # 403 403 .org PARMAREA 404 + SYM_DATA_START(parmarea) 404 405 .quad 0 # IPL_DEVICE 405 406 .quad 0 # INITRD_START 406 407 .quad 0 # INITRD_SIZE ··· 412 411 .org COMMAND_LINE 413 412 .byte "root=/dev/ram0 ro" 414 413 .byte 0 414 + .org PARMAREA+__PARMAREA_SIZE 415 + SYM_DATA_END(parmarea) 415 416 416 417 .org EARLY_SCCB_OFFSET 417 418 .fill 4096
+33 -28
arch/s390/boot/ipl_parm.c
··· 12 12 #include "boot.h" 13 13 14 14 char __bootdata(early_command_line)[COMMAND_LINE_SIZE]; 15 - struct ipl_parameter_block __bootdata_preserved(ipl_block); 16 - int __bootdata_preserved(ipl_block_valid); 17 - unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL; 18 - 19 - unsigned long __bootdata(vmalloc_size) = VMALLOC_DEFAULT_SIZE; 20 15 int __bootdata(noexec_disabled); 21 16 17 + unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL; 18 + struct ipl_parameter_block __bootdata_preserved(ipl_block); 19 + int __bootdata_preserved(ipl_block_valid); 20 + 21 + unsigned long vmalloc_size = VMALLOC_DEFAULT_SIZE; 22 22 unsigned long memory_limit; 23 23 int vmalloc_size_set; 24 24 int kaslr_enabled; 25 25 26 26 static inline int __diag308(unsigned long subcode, void *addr) 27 27 { 28 - register unsigned long _addr asm("0") = (unsigned long)addr; 29 - register unsigned long _rc asm("1") = 0; 30 28 unsigned long reg1, reg2; 31 - psw_t old = S390_lowcore.program_new_psw; 29 + union register_pair r1; 30 + psw_t old; 32 31 32 + r1.even = (unsigned long) addr; 33 + r1.odd = 0; 33 34 asm volatile( 34 - " epsw %0,%1\n" 35 - " st %0,%[psw_pgm]\n" 36 - " st %1,%[psw_pgm]+4\n" 37 - " larl %0,1f\n" 38 - " stg %0,%[psw_pgm]+8\n" 39 - " diag %[addr],%[subcode],0x308\n" 40 - "1: nopr %%r7\n" 41 - : "=&d" (reg1), "=&a" (reg2), 42 - [psw_pgm] "=Q" (S390_lowcore.program_new_psw), 43 - [addr] "+d" (_addr), "+d" (_rc) 44 - : [subcode] "d" (subcode) 35 + " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" 36 + " epsw %[reg1],%[reg2]\n" 37 + " st %[reg1],0(%[psw_pgm])\n" 38 + " st %[reg2],4(%[psw_pgm])\n" 39 + " larl %[reg1],1f\n" 40 + " stg %[reg1],8(%[psw_pgm])\n" 41 + " diag %[r1],%[subcode],0x308\n" 42 + "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" 43 + : [r1] "+&d" (r1.pair), 44 + [reg1] "=&d" (reg1), 45 + [reg2] "=&a" (reg2), 46 + "+Q" (S390_lowcore.program_new_psw), 47 + "=Q" (old) 48 + : [subcode] "d" (subcode), 49 + [psw_old] "a" (&old), 50 + [psw_pgm] "a" (&S390_lowcore.program_new_psw) 45 51 : "cc", "memory"); 46 - S390_lowcore.program_new_psw = old; 47 - return _rc; 52 + return r1.odd; 48 53 } 49 54 50 55 void store_ipl_parmblock(void) ··· 170 165 171 166 void setup_boot_command_line(void) 172 167 { 173 - COMMAND_LINE[ARCH_COMMAND_LINE_SIZE - 1] = 0; 168 + parmarea.command_line[ARCH_COMMAND_LINE_SIZE - 1] = 0; 174 169 /* convert arch command line to ascii if necessary */ 175 - if (has_ebcdic_char(COMMAND_LINE)) 176 - EBCASC(COMMAND_LINE, ARCH_COMMAND_LINE_SIZE); 170 + if (has_ebcdic_char(parmarea.command_line)) 171 + EBCASC(parmarea.command_line, ARCH_COMMAND_LINE_SIZE); 177 172 /* copy arch command line */ 178 - strcpy(early_command_line, strim(COMMAND_LINE)); 173 + strcpy(early_command_line, strim(parmarea.command_line)); 179 174 180 175 /* append IPL PARM data to the boot command line */ 181 176 if (!is_prot_virt_guest() && ipl_block_valid) ··· 185 180 static void modify_facility(unsigned long nr, bool clear) 186 181 { 187 182 if (clear) 188 - __clear_facility(nr, S390_lowcore.stfle_fac_list); 183 + __clear_facility(nr, stfle_fac_list); 189 184 else 190 - __set_facility(nr, S390_lowcore.stfle_fac_list); 185 + __set_facility(nr, stfle_fac_list); 191 186 } 192 187 193 188 static void check_cleared_facilities(void) ··· 196 191 int i; 197 192 198 193 for (i = 0; i < ARRAY_SIZE(als); i++) { 199 - if ((S390_lowcore.stfle_fac_list[i] & als[i]) != als[i]) { 194 + if ((stfle_fac_list[i] & als[i]) != als[i]) { 200 195 sclp_early_printk("Warning: The Linux kernel requires facilities cleared via command line option\n"); 201 196 print_missing_facilities(); 202 197 break;
+42 -29
arch/s390/boot/mem_detect.c
··· 64 64 65 65 static int __diag260(unsigned long rx1, unsigned long rx2) 66 66 { 67 - register unsigned long _rx1 asm("2") = rx1; 68 - register unsigned long _rx2 asm("3") = rx2; 69 - register unsigned long _ry asm("4") = 0x10; /* storage configuration */ 70 - int rc = -1; /* fail */ 71 - unsigned long reg1, reg2; 72 - psw_t old = S390_lowcore.program_new_psw; 67 + unsigned long reg1, reg2, ry; 68 + union register_pair rx; 69 + psw_t old; 70 + int rc; 73 71 72 + rx.even = rx1; 73 + rx.odd = rx2; 74 + ry = 0x10; /* storage configuration */ 75 + rc = -1; /* fail */ 74 76 asm volatile( 75 - " epsw %0,%1\n" 76 - " st %0,%[psw_pgm]\n" 77 - " st %1,%[psw_pgm]+4\n" 78 - " larl %0,1f\n" 79 - " stg %0,%[psw_pgm]+8\n" 77 + " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" 78 + " epsw %[reg1],%[reg2]\n" 79 + " st %[reg1],0(%[psw_pgm])\n" 80 + " st %[reg2],4(%[psw_pgm])\n" 81 + " larl %[reg1],1f\n" 82 + " stg %[reg1],8(%[psw_pgm])\n" 80 83 " diag %[rx],%[ry],0x260\n" 81 84 " ipm %[rc]\n" 82 85 " srl %[rc],28\n" 83 - "1:\n" 84 - : "=&d" (reg1), "=&a" (reg2), 85 - [psw_pgm] "=Q" (S390_lowcore.program_new_psw), 86 - [rc] "+&d" (rc), [ry] "+d" (_ry) 87 - : [rx] "d" (_rx1), "d" (_rx2) 86 + "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" 87 + : [reg1] "=&d" (reg1), 88 + [reg2] "=&a" (reg2), 89 + [rc] "+&d" (rc), 90 + [ry] "+&d" (ry), 91 + "+Q" (S390_lowcore.program_new_psw), 92 + "=Q" (old) 93 + : [rx] "d" (rx.pair), 94 + [psw_old] "a" (&old), 95 + [psw_pgm] "a" (&S390_lowcore.program_new_psw) 88 96 : "cc", "memory"); 89 - S390_lowcore.program_new_psw = old; 90 - return rc == 0 ? _ry : -1; 97 + return rc == 0 ? ry : -1; 91 98 } 92 99 93 100 static int diag260(void) ··· 118 111 119 112 static int tprot(unsigned long addr) 120 113 { 121 - unsigned long pgm_addr; 114 + unsigned long reg1, reg2; 122 115 int rc = -EFAULT; 123 - psw_t old = S390_lowcore.program_new_psw; 116 + psw_t old; 124 117 125 - S390_lowcore.program_new_psw.mask = __extract_psw(); 126 118 asm volatile( 127 - " larl %[pgm_addr],1f\n" 128 - " stg %[pgm_addr],%[psw_pgm_addr]\n" 119 + " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" 120 + " epsw %[reg1],%[reg2]\n" 121 + " st %[reg1],0(%[psw_pgm])\n" 122 + " st %[reg2],4(%[psw_pgm])\n" 123 + " larl %[reg1],1f\n" 124 + " stg %[reg1],8(%[psw_pgm])\n" 129 125 " tprot 0(%[addr]),0\n" 130 126 " ipm %[rc]\n" 131 127 " srl %[rc],28\n" 132 - "1:\n" 133 - : [pgm_addr] "=&d"(pgm_addr), 134 - [psw_pgm_addr] "=Q"(S390_lowcore.program_new_psw.addr), 135 - [rc] "+&d"(rc) 136 - : [addr] "a"(addr) 128 + "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" 129 + : [reg1] "=&d" (reg1), 130 + [reg2] "=&a" (reg2), 131 + [rc] "+&d" (rc), 132 + "=Q" (S390_lowcore.program_new_psw.addr), 133 + "=Q" (old) 134 + : [psw_old] "a" (&old), 135 + [psw_pgm] "a" (&S390_lowcore.program_new_psw), 136 + [addr] "a" (addr) 137 137 : "cc", "memory"); 138 - S390_lowcore.program_new_psw = old; 139 138 return rc; 140 139 } 141 140
+91
arch/s390/boot/startup.c
··· 5 5 #include <asm/sections.h> 6 6 #include <asm/cpu_mf.h> 7 7 #include <asm/setup.h> 8 + #include <asm/kasan.h> 8 9 #include <asm/kexec.h> 9 10 #include <asm/sclp.h> 10 11 #include <asm/diag.h> ··· 16 15 extern char __boot_data_start[], __boot_data_end[]; 17 16 extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; 18 17 unsigned long __bootdata_preserved(__kaslr_offset); 18 + unsigned long __bootdata_preserved(VMALLOC_START); 19 + unsigned long __bootdata_preserved(VMALLOC_END); 20 + struct page *__bootdata_preserved(vmemmap); 21 + unsigned long __bootdata_preserved(vmemmap_size); 22 + unsigned long __bootdata_preserved(MODULES_VADDR); 23 + unsigned long __bootdata_preserved(MODULES_END); 19 24 unsigned long __bootdata(ident_map_size); 25 + 26 + u64 __bootdata_preserved(stfle_fac_list[16]); 27 + u64 __bootdata_preserved(alt_stfle_fac_list[16]); 20 28 21 29 /* 22 30 * Some code and data needs to stay below 2 GB, even when the kernel would be ··· 179 169 #endif 180 170 } 181 171 172 + static void setup_kernel_memory_layout(void) 173 + { 174 + bool vmalloc_size_verified = false; 175 + unsigned long vmemmap_off; 176 + unsigned long vspace_left; 177 + unsigned long rte_size; 178 + unsigned long pages; 179 + unsigned long vmax; 180 + 181 + pages = ident_map_size / PAGE_SIZE; 182 + /* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */ 183 + vmemmap_size = SECTION_ALIGN_UP(pages) * sizeof(struct page); 184 + 185 + /* choose kernel address space layout: 4 or 3 levels. */ 186 + vmemmap_off = round_up(ident_map_size, _REGION3_SIZE); 187 + if (IS_ENABLED(CONFIG_KASAN) || 188 + vmalloc_size > _REGION2_SIZE || 189 + vmemmap_off + vmemmap_size + vmalloc_size + MODULES_LEN > _REGION2_SIZE) 190 + vmax = _REGION1_SIZE; 191 + else 192 + vmax = _REGION2_SIZE; 193 + 194 + /* keep vmemmap_off aligned to a top level region table entry */ 195 + rte_size = vmax == _REGION1_SIZE ? _REGION2_SIZE : _REGION3_SIZE; 196 + MODULES_END = vmax; 197 + if (is_prot_virt_host()) { 198 + /* 199 + * forcing modules and vmalloc area under the ultravisor 200 + * secure storage limit, so that any vmalloc allocation 201 + * we do could be used to back secure guest storage. 202 + */ 203 + adjust_to_uv_max(&MODULES_END); 204 + } 205 + 206 + #ifdef CONFIG_KASAN 207 + if (MODULES_END < vmax) { 208 + /* force vmalloc and modules below kasan shadow */ 209 + MODULES_END = min(MODULES_END, KASAN_SHADOW_START); 210 + } else { 211 + /* 212 + * leave vmalloc and modules above kasan shadow but make 213 + * sure they don't overlap with it 214 + */ 215 + vmalloc_size = min(vmalloc_size, vmax - KASAN_SHADOW_END - MODULES_LEN); 216 + vmalloc_size_verified = true; 217 + vspace_left = KASAN_SHADOW_START; 218 + } 219 + #endif 220 + MODULES_VADDR = MODULES_END - MODULES_LEN; 221 + VMALLOC_END = MODULES_VADDR; 222 + 223 + if (vmalloc_size_verified) { 224 + VMALLOC_START = VMALLOC_END - vmalloc_size; 225 + } else { 226 + vmemmap_off = round_up(ident_map_size, rte_size); 227 + 228 + if (vmemmap_off + vmemmap_size > VMALLOC_END || 229 + vmalloc_size > VMALLOC_END - vmemmap_off - vmemmap_size) { 230 + /* 231 + * allow vmalloc area to occupy up to 1/2 of 232 + * the rest virtual space left. 233 + */ 234 + vmalloc_size = min(vmalloc_size, VMALLOC_END / 2); 235 + } 236 + VMALLOC_START = VMALLOC_END - vmalloc_size; 237 + vspace_left = VMALLOC_START; 238 + } 239 + 240 + pages = vspace_left / (PAGE_SIZE + sizeof(struct page)); 241 + pages = SECTION_ALIGN_UP(pages); 242 + vmemmap_off = round_up(vspace_left - pages * sizeof(struct page), rte_size); 243 + /* keep vmemmap left most starting from a fresh region table entry */ 244 + vmemmap_off = min(vmemmap_off, round_up(ident_map_size, rte_size)); 245 + /* take care that identity map is lower then vmemmap */ 246 + ident_map_size = min(ident_map_size, vmemmap_off); 247 + vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page); 248 + VMALLOC_START = max(vmemmap_off + vmemmap_size, VMALLOC_START); 249 + vmemmap = (struct page *)vmemmap_off; 250 + } 251 + 182 252 /* 183 253 * This function clears the BSS section of the decompressed Linux kernel and NOT the decompressor's. 184 254 */ ··· 298 208 parse_boot_command_line(); 299 209 setup_ident_map_size(detect_memory()); 300 210 setup_vmalloc_size(); 211 + setup_kernel_memory_layout(); 301 212 302 213 random_lma = __kaslr_offset = 0; 303 214 if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) {
+25
arch/s390/boot/uv.c
··· 44 44 prot_virt_guest = 1; 45 45 #endif 46 46 } 47 + 48 + #if IS_ENABLED(CONFIG_KVM) 49 + static bool has_uv_sec_stor_limit(void) 50 + { 51 + /* 52 + * keep these conditions in line with setup_uv() 53 + */ 54 + if (!is_prot_virt_host()) 55 + return false; 56 + 57 + if (is_prot_virt_guest()) 58 + return false; 59 + 60 + if (!test_facility(158)) 61 + return false; 62 + 63 + return !!uv_info.max_sec_stor_addr; 64 + } 65 + 66 + void adjust_to_uv_max(unsigned long *vmax) 67 + { 68 + if (has_uv_sec_stor_limit()) 69 + *vmax = min_t(unsigned long, *vmax, uv_info.max_sec_stor_addr); 70 + } 71 + #endif
+6 -7
arch/s390/hypfs/hypfs_sprp.c
··· 25 25 26 26 static inline unsigned long __hypfs_sprp_diag304(void *data, unsigned long cmd) 27 27 { 28 - register unsigned long _data asm("2") = (unsigned long) data; 29 - register unsigned long _rc asm("3"); 30 - register unsigned long _cmd asm("4") = cmd; 28 + union register_pair r1 = { .even = (unsigned long)data, }; 31 29 32 - asm volatile("diag %1,%2,0x304\n" 33 - : "=d" (_rc) : "d" (_data), "d" (_cmd) : "memory"); 34 - 35 - return _rc; 30 + asm volatile("diag %[r1],%[r3],0x304\n" 31 + : [r1] "+&d" (r1.pair) 32 + : [r3] "d" (cmd) 33 + : "memory"); 34 + return r1.odd; 36 35 } 37 36 38 37 static unsigned long hypfs_sprp_diag304(void *data, unsigned long cmd)
+5 -5
arch/s390/include/asm/bitops.h
··· 299 299 } 300 300 return bit; 301 301 } else { 302 - register unsigned long bit asm("4") = word; 303 - register unsigned long out asm("5"); 302 + union register_pair rp; 304 303 304 + rp.even = word; 305 305 asm volatile( 306 - " flogr %[bit],%[bit]\n" 307 - : [bit] "+d" (bit), [out] "=d" (out) : : "cc"); 308 - return bit; 306 + " flogr %[rp],%[rp]\n" 307 + : [rp] "+d" (rp.pair) : : "cc"); 308 + return rp.even; 309 309 } 310 310 } 311 311
+1 -2
arch/s390/include/asm/ccwgroup.h
··· 11 11 * @count: number of attached slave devices 12 12 * @dev: embedded device structure 13 13 * @cdev: variable number of slave devices, allocated as needed 14 - * @ungroup_work: work to be done when a ccwgroup notifier has action 15 - * type %BUS_NOTIFY_UNBIND_DRIVER 14 + * @ungroup_work: used to ungroup the ccwgroup device 16 15 */ 17 16 struct ccwgroup_device { 18 17 enum {
+6 -4
arch/s390/include/asm/checksum.h
··· 29 29 */ 30 30 static inline __wsum csum_partial(const void *buff, int len, __wsum sum) 31 31 { 32 - register unsigned long reg2 asm("2") = (unsigned long) buff; 33 - register unsigned long reg3 asm("3") = (unsigned long) len; 32 + union register_pair rp = { 33 + .even = (unsigned long) buff, 34 + .odd = (unsigned long) len, 35 + }; 34 36 35 37 asm volatile( 36 - "0: cksm %0,%1\n" /* do checksum on longs */ 38 + "0: cksm %[sum],%[rp]\n" 37 39 " jo 0b\n" 38 - : "+d" (sum), "+d" (reg2), "+d" (reg3) : : "cc", "memory"); 40 + : [sum] "+&d" (sum), [rp] "+&d" (rp.pair) : : "cc", "memory"); 39 41 return sum; 40 42 } 41 43
+1
arch/s390/include/asm/cio.h
··· 9 9 #include <linux/bitops.h> 10 10 #include <linux/genalloc.h> 11 11 #include <asm/types.h> 12 + #include <asm/tpi.h> 12 13 13 14 #define LPM_ANYPATH 0xff 14 15 #define __MAX_CSSID 0
+24 -20
arch/s390/include/asm/cmpxchg.h
··· 169 169 170 170 #define system_has_cmpxchg_double() 1 171 171 172 - #define __cmpxchg_double(p1, p2, o1, o2, n1, n2) \ 173 - ({ \ 174 - register __typeof__(*(p1)) __old1 asm("2") = (o1); \ 175 - register __typeof__(*(p2)) __old2 asm("3") = (o2); \ 176 - register __typeof__(*(p1)) __new1 asm("4") = (n1); \ 177 - register __typeof__(*(p2)) __new2 asm("5") = (n2); \ 178 - int cc; \ 179 - asm volatile( \ 180 - " cdsg %[old],%[new],%[ptr]\n" \ 181 - " ipm %[cc]\n" \ 182 - " srl %[cc],28" \ 183 - : [cc] "=d" (cc), [old] "+d" (__old1), "+d" (__old2) \ 184 - : [new] "d" (__new1), "d" (__new2), \ 185 - [ptr] "Q" (*(p1)), "Q" (*(p2)) \ 186 - : "memory", "cc"); \ 187 - !cc; \ 188 - }) 172 + static __always_inline int __cmpxchg_double(unsigned long p1, unsigned long p2, 173 + unsigned long o1, unsigned long o2, 174 + unsigned long n1, unsigned long n2) 175 + { 176 + union register_pair old = { .even = o1, .odd = o2, }; 177 + union register_pair new = { .even = n1, .odd = n2, }; 178 + int cc; 179 + 180 + asm volatile( 181 + " cdsg %[old],%[new],%[ptr]\n" 182 + " ipm %[cc]\n" 183 + " srl %[cc],28\n" 184 + : [cc] "=&d" (cc), [old] "+&d" (old.pair) 185 + : [new] "d" (new.pair), 186 + [ptr] "QS" (*(unsigned long *)p1), "Q" (*(unsigned long *)p2) 187 + : "memory", "cc"); 188 + return !cc; 189 + } 189 190 190 191 #define arch_cmpxchg_double(p1, p2, o1, o2, n1, n2) \ 191 192 ({ \ 192 - __typeof__(p1) __p1 = (p1); \ 193 - __typeof__(p2) __p2 = (p2); \ 193 + typeof(p1) __p1 = (p1); \ 194 + typeof(p2) __p2 = (p2); \ 195 + \ 194 196 BUILD_BUG_ON(sizeof(*(p1)) != sizeof(long)); \ 195 197 BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long)); \ 196 198 VM_BUG_ON((unsigned long)((__p1) + 1) != (unsigned long)(__p2));\ 197 - __cmpxchg_double(__p1, __p2, o1, o2, n1, n2); \ 199 + __cmpxchg_double((unsigned long)__p1, (unsigned long)__p2, \ 200 + (unsigned long)(o1), (unsigned long)(o2), \ 201 + (unsigned long)(n1), (unsigned long)(n2)); \ 198 202 }) 199 203 200 204 #endif /* __ASM_CMPXCHG_H */
+1 -2
arch/s390/include/asm/cpu_mcf.h
··· 92 92 struct cpumf_ctr_info info; 93 93 atomic_t ctr_set[CPUMF_CTR_SET_MAX]; 94 94 atomic64_t alert; 95 - u64 state, tx_state; 95 + u64 state; 96 96 unsigned int flags; 97 - unsigned int txn_flags; 98 97 }; 99 98 DECLARE_PER_CPU(struct cpu_cf_events, cpu_cf_events); 100 99
+16 -9
arch/s390/include/asm/facility.h
··· 13 13 #include <linux/preempt.h> 14 14 #include <asm/lowcore.h> 15 15 16 - #define MAX_FACILITY_BIT (sizeof(((struct lowcore *)0)->stfle_fac_list) * 8) 16 + #define MAX_FACILITY_BIT (sizeof(stfle_fac_list) * 8) 17 + 18 + extern u64 stfle_fac_list[16]; 19 + extern u64 alt_stfle_fac_list[16]; 17 20 18 21 static inline void __set_facility(unsigned long nr, void *facilities) 19 22 { ··· 59 56 if (__test_facility(nr, &facilities_als)) 60 57 return 1; 61 58 } 62 - return __test_facility(nr, &S390_lowcore.stfle_fac_list); 59 + return __test_facility(nr, &stfle_fac_list); 63 60 } 64 61 65 62 static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size) 66 63 { 67 - register unsigned long reg0 asm("0") = size - 1; 64 + unsigned long reg0 = size - 1; 68 65 69 66 asm volatile( 70 - ".insn s,0xb2b00000,0(%1)" /* stfle */ 71 - : "+d" (reg0) 72 - : "a" (stfle_fac_list) 73 - : "memory", "cc"); 67 + " lgr 0,%[reg0]\n" 68 + " .insn s,0xb2b00000,%[list]\n" /* stfle */ 69 + " lgr %[reg0],0\n" 70 + : [reg0] "+&d" (reg0), [list] "+Q" (*stfle_fac_list) 71 + : 72 + : "memory", "cc", "0"); 74 73 return reg0; 75 74 } 76 75 ··· 84 79 static inline void __stfle(u64 *stfle_fac_list, int size) 85 80 { 86 81 unsigned long nr; 82 + u32 stfl_fac_list; 87 83 88 84 asm volatile( 89 85 " stfl 0(0)\n" 90 86 : "=m" (S390_lowcore.stfl_fac_list)); 87 + stfl_fac_list = S390_lowcore.stfl_fac_list; 88 + memcpy(stfle_fac_list, &stfl_fac_list, 4); 91 89 nr = 4; /* bytes stored by stfl */ 92 - memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); 93 - if (S390_lowcore.stfl_fac_list & 0x01000000) { 90 + if (stfl_fac_list & 0x01000000) { 94 91 /* More facility bits available with stfle */ 95 92 nr = __stfle_asm(stfle_fac_list, size); 96 93 nr = min_t(unsigned long, (nr + 1) * 8, size * 8);
+8 -8
arch/s390/include/asm/irqflags.h
··· 32 32 }) 33 33 34 34 /* set system mask. */ 35 - static inline notrace void __arch_local_irq_ssm(unsigned long flags) 35 + static __always_inline void __arch_local_irq_ssm(unsigned long flags) 36 36 { 37 37 asm volatile("ssm %0" : : "Q" (flags) : "memory"); 38 38 } 39 39 40 - static inline notrace unsigned long arch_local_save_flags(void) 40 + static __always_inline unsigned long arch_local_save_flags(void) 41 41 { 42 42 return __arch_local_irq_stnsm(0xff); 43 43 } 44 44 45 - static inline notrace unsigned long arch_local_irq_save(void) 45 + static __always_inline unsigned long arch_local_irq_save(void) 46 46 { 47 47 return __arch_local_irq_stnsm(0xfc); 48 48 } 49 49 50 - static inline notrace void arch_local_irq_disable(void) 50 + static __always_inline void arch_local_irq_disable(void) 51 51 { 52 52 arch_local_irq_save(); 53 53 } 54 54 55 - static inline notrace void arch_local_irq_enable(void) 55 + static __always_inline void arch_local_irq_enable(void) 56 56 { 57 57 __arch_local_irq_stosm(0x03); 58 58 } 59 59 60 60 /* This only restores external and I/O interrupt state */ 61 - static inline notrace void arch_local_irq_restore(unsigned long flags) 61 + static __always_inline void arch_local_irq_restore(unsigned long flags) 62 62 { 63 63 /* only disabled->disabled and disabled->enabled is valid */ 64 64 if (flags & ARCH_IRQ_ENABLED) 65 65 arch_local_irq_enable(); 66 66 } 67 67 68 - static inline notrace bool arch_irqs_disabled_flags(unsigned long flags) 68 + static __always_inline bool arch_irqs_disabled_flags(unsigned long flags) 69 69 { 70 70 return !(flags & ARCH_IRQ_ENABLED); 71 71 } 72 72 73 - static inline notrace bool arch_irqs_disabled(void) 73 + static __always_inline bool arch_irqs_disabled(void) 74 74 { 75 75 return arch_irqs_disabled_flags(arch_local_save_flags()); 76 76 }
-1
arch/s390/include/asm/kasan.h
··· 16 16 extern void kasan_early_init(void); 17 17 extern void kasan_copy_shadow_mapping(void); 18 18 extern void kasan_free_early_identity(void); 19 - extern unsigned long kasan_vmax; 20 19 21 20 /* 22 21 * Estimate kasan memory requirements, which it will reserve
+23 -15
arch/s390/include/asm/lowcore.h
··· 17 17 #define LC_ORDER 1 18 18 #define LC_PAGES 2 19 19 20 + struct pgm_tdb { 21 + u64 data[32]; 22 + }; 23 + 20 24 struct lowcore { 21 25 __u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */ 22 26 __u32 ipl_parmblock_ptr; /* 0x0014 */ 23 27 __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */ 24 28 __u32 ext_params; /* 0x0080 */ 25 - __u16 ext_cpu_addr; /* 0x0084 */ 26 - __u16 ext_int_code; /* 0x0086 */ 27 - __u16 svc_ilc; /* 0x0088 */ 28 - __u16 svc_code; /* 0x008a */ 29 + union { 30 + struct { 31 + __u16 ext_cpu_addr; /* 0x0084 */ 32 + __u16 ext_int_code; /* 0x0086 */ 33 + }; 34 + __u32 ext_int_code_addr; 35 + }; 36 + __u32 svc_int_code; /* 0x0088 */ 29 37 __u16 pgm_ilc; /* 0x008c */ 30 38 __u16 pgm_code; /* 0x008e */ 31 39 __u32 data_exc_code; /* 0x0090 */ ··· 48 40 __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */ 49 41 __u64 trans_exc_code; /* 0x00a8 */ 50 42 __u64 monitor_code; /* 0x00b0 */ 51 - __u16 subchannel_id; /* 0x00b8 */ 52 - __u16 subchannel_nr; /* 0x00ba */ 53 - __u32 io_int_parm; /* 0x00bc */ 54 - __u32 io_int_word; /* 0x00c0 */ 43 + union { 44 + struct { 45 + __u16 subchannel_id; /* 0x00b8 */ 46 + __u16 subchannel_nr; /* 0x00ba */ 47 + __u32 io_int_parm; /* 0x00bc */ 48 + __u32 io_int_word; /* 0x00c0 */ 49 + }; 50 + struct tpi_info tpi_info; /* 0x00b8 */ 51 + }; 55 52 __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */ 56 53 __u32 stfl_fac_list; /* 0x00c8 */ 57 54 __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */ ··· 167 154 __u64 vmcore_info; /* 0x0e0c */ 168 155 __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */ 169 156 __u64 os_info; /* 0x0e18 */ 170 - __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */ 171 - 172 - /* Extended facility list */ 173 - __u64 stfle_fac_list[16]; /* 0x0f00 */ 174 - __u64 alt_stfle_fac_list[16]; /* 0x0f80 */ 175 - __u8 pad_0x1000[0x11b0-0x1000]; /* 0x1000 */ 157 + __u8 pad_0x0e20[0x11b0-0x0e20]; /* 0x0e20 */ 176 158 177 159 /* Pointer to the machine check extended save area */ 178 160 __u64 mcesad; /* 0x11b0 */ ··· 193 185 __u8 pad_0x1400[0x1800-0x1400]; /* 0x1400 */ 194 186 195 187 /* Transaction abort diagnostic block */ 196 - __u8 pgm_tdb[256]; /* 0x1800 */ 188 + struct pgm_tdb pgm_tdb; /* 0x1800 */ 197 189 __u8 pad_0x1900[0x2000-0x1900]; /* 0x1900 */ 198 190 } __packed __aligned(8192); 199 191
+13 -2
arch/s390/include/asm/mmu_context.h
··· 70 70 return 0; 71 71 } 72 72 73 - static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 74 - struct task_struct *tsk) 73 + static inline void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, 74 + struct task_struct *tsk) 75 75 { 76 76 int cpu = smp_processor_id(); 77 77 ··· 84 84 __ctl_load(s390_invalid_asce, 7, 7); 85 85 if (prev != next) 86 86 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); 87 + } 88 + #define switch_mm_irqs_off switch_mm_irqs_off 89 + 90 + static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 91 + struct task_struct *tsk) 92 + { 93 + unsigned long flags; 94 + 95 + local_irq_save(flags); 96 + switch_mm_irqs_off(prev, next, tsk); 97 + local_irq_restore(flags); 87 98 } 88 99 89 100 #define finish_arch_post_lock_switch finish_arch_post_lock_switch
+9 -6
arch/s390/include/asm/page.h
··· 55 55 */ 56 56 static inline void copy_page(void *to, void *from) 57 57 { 58 - register void *reg2 asm ("2") = to; 59 - register unsigned long reg3 asm ("3") = 0x1000; 60 - register void *reg4 asm ("4") = from; 61 - register unsigned long reg5 asm ("5") = 0xb0001000; 58 + union register_pair dst, src; 59 + 60 + dst.even = (unsigned long) to; 61 + dst.odd = 0x1000; 62 + src.even = (unsigned long) from; 63 + src.odd = 0xb0001000; 64 + 62 65 asm volatile( 63 - " mvcl 2,4" 64 - : "+d" (reg2), "+d" (reg3), "+d" (reg4), "+d" (reg5) 66 + " mvcl %[dst],%[src]" 67 + : [dst] "+&d" (dst.pair), [src] "+&d" (src.pair) 65 68 : : "memory", "cc"); 66 69 } 67 70
+6 -1
arch/s390/include/asm/pci.h
··· 133 133 u8 has_resources : 1; 134 134 u8 is_physfn : 1; 135 135 u8 util_str_avail : 1; 136 - u8 reserved : 3; 136 + u8 irqs_registered : 1; 137 + u8 reserved : 2; 137 138 unsigned int devfn; /* DEVFN part of the RID*/ 138 139 139 140 struct mutex lock; ··· 272 271 int zpci_dma_init(void); 273 272 void zpci_dma_exit(void); 274 273 274 + /* IRQ */ 275 275 int __init zpci_irq_init(void); 276 276 void __init zpci_irq_exit(void); 277 + 278 + int zpci_set_irq(struct zpci_dev *zdev); 279 + int zpci_clear_irq(struct zpci_dev *zdev); 277 280 278 281 /* FMB */ 279 282 int zpci_fmb_enable_device(struct zpci_dev *);
+14 -13
arch/s390/include/asm/percpu.h
··· 164 164 #define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval) 165 165 #define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval) 166 166 167 - #define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \ 168 - ({ \ 169 - typeof(pcp1) o1__ = (o1), n1__ = (n1); \ 170 - typeof(pcp2) o2__ = (o2), n2__ = (n2); \ 171 - typeof(pcp1) *p1__; \ 172 - typeof(pcp2) *p2__; \ 173 - int ret__; \ 174 - preempt_disable_notrace(); \ 175 - p1__ = raw_cpu_ptr(&(pcp1)); \ 176 - p2__ = raw_cpu_ptr(&(pcp2)); \ 177 - ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__); \ 178 - preempt_enable_notrace(); \ 179 - ret__; \ 167 + #define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \ 168 + ({ \ 169 + typeof(pcp1) *p1__; \ 170 + typeof(pcp2) *p2__; \ 171 + int ret__; \ 172 + \ 173 + preempt_disable_notrace(); \ 174 + p1__ = raw_cpu_ptr(&(pcp1)); \ 175 + p2__ = raw_cpu_ptr(&(pcp2)); \ 176 + ret__ = __cmpxchg_double((unsigned long)p1__, (unsigned long)p2__, \ 177 + (unsigned long)(o1), (unsigned long)(o2), \ 178 + (unsigned long)(n1), (unsigned long)(n2)); \ 179 + preempt_enable_notrace(); \ 180 + ret__; \ 180 181 }) 181 182 182 183 #define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double
+39 -23
arch/s390/include/asm/pgtable.h
··· 17 17 #include <linux/page-flags.h> 18 18 #include <linux/radix-tree.h> 19 19 #include <linux/atomic.h> 20 + #include <asm/sections.h> 20 21 #include <asm/bug.h> 21 22 #include <asm/page.h> 22 23 #include <asm/uv.h> ··· 85 84 * happen without trampolines and in addition the placement within a 86 85 * 2GB frame is branch prediction unit friendly. 87 86 */ 88 - extern unsigned long VMALLOC_START; 89 - extern unsigned long VMALLOC_END; 87 + extern unsigned long __bootdata_preserved(VMALLOC_START); 88 + extern unsigned long __bootdata_preserved(VMALLOC_END); 90 89 #define VMALLOC_DEFAULT_SIZE ((512UL << 30) - MODULES_LEN) 91 - extern struct page *vmemmap; 92 - extern unsigned long vmemmap_size; 90 + extern struct page *__bootdata_preserved(vmemmap); 91 + extern unsigned long __bootdata_preserved(vmemmap_size); 93 92 94 93 #define VMEM_MAX_PHYS ((unsigned long) vmemmap) 95 94 96 - extern unsigned long MODULES_VADDR; 97 - extern unsigned long MODULES_END; 95 + extern unsigned long __bootdata_preserved(MODULES_VADDR); 96 + extern unsigned long __bootdata_preserved(MODULES_END); 98 97 #define MODULES_VADDR MODULES_VADDR 99 98 #define MODULES_END MODULES_END 100 99 #define MODULES_LEN (1UL << 31) ··· 554 553 555 554 static inline void csp(unsigned int *ptr, unsigned int old, unsigned int new) 556 555 { 557 - register unsigned long reg2 asm("2") = old; 558 - register unsigned long reg3 asm("3") = new; 556 + union register_pair r1 = { .even = old, .odd = new, }; 559 557 unsigned long address = (unsigned long)ptr | 1; 560 558 561 559 asm volatile( 562 - " csp %0,%3" 563 - : "+d" (reg2), "+m" (*ptr) 564 - : "d" (reg3), "d" (address) 560 + " csp %[r1],%[address]" 561 + : [r1] "+&d" (r1.pair), "+m" (*ptr) 562 + : [address] "d" (address) 565 563 : "cc"); 566 564 } 567 565 568 566 static inline void cspg(unsigned long *ptr, unsigned long old, unsigned long new) 569 567 { 570 - register unsigned long reg2 asm("2") = old; 571 - register unsigned long reg3 asm("3") = new; 568 + union register_pair r1 = { .even = old, .odd = new, }; 572 569 unsigned long address = (unsigned long)ptr | 1; 573 570 574 571 asm volatile( 575 - " .insn rre,0xb98a0000,%0,%3" 576 - : "+d" (reg2), "+m" (*ptr) 577 - : "d" (reg3), "d" (address) 572 + " .insn rre,0xb98a0000,%[r1],%[address]" 573 + : [r1] "+&d" (r1.pair), "+m" (*ptr) 574 + : [address] "d" (address) 578 575 : "cc"); 579 576 } 580 577 ··· 586 587 unsigned long table, unsigned long dtt, 587 588 unsigned long address, unsigned long asce) 588 589 { 589 - register unsigned long reg2 asm("2") = old; 590 - register unsigned long reg3 asm("3") = new; 591 - register unsigned long reg4 asm("4") = table | dtt; 592 - register unsigned long reg5 asm("5") = address; 590 + union register_pair r1 = { .even = old, .odd = new, }; 591 + union register_pair r2 = { .even = table | dtt, .odd = address, }; 593 592 594 - asm volatile(".insn rrf,0xb98f0000,%0,%2,%4,0" 595 - : "+d" (reg2) 596 - : "d" (reg3), "d" (reg4), "d" (reg5), "a" (asce) 593 + asm volatile(".insn rrf,0xb98f0000,%[r1],%[r2],%[asce],0" 594 + : [r1] "+&d" (r1.pair) 595 + : [r2] "d" (r2.pair), [asce] "a" (asce) 597 596 : "memory", "cc"); 598 597 } 599 598 ··· 856 859 static inline int pte_unused(pte_t pte) 857 860 { 858 861 return pte_val(pte) & _PAGE_UNUSED; 862 + } 863 + 864 + /* 865 + * Extract the pgprot value from the given pte while at the same time making it 866 + * usable for kernel address space mappings where fault driven dirty and 867 + * young/old accounting is not supported, i.e _PAGE_PROTECT and _PAGE_INVALID 868 + * must not be set. 869 + */ 870 + static inline pgprot_t pte_pgprot(pte_t pte) 871 + { 872 + unsigned long pte_flags = pte_val(pte) & _PAGE_CHG_MASK; 873 + 874 + if (pte_write(pte)) 875 + pte_flags |= pgprot_val(PAGE_KERNEL); 876 + else 877 + pte_flags |= pgprot_val(PAGE_KERNEL_RO); 878 + pte_flags |= pte_val(pte) & mio_wb_bit_mask; 879 + 880 + return __pgprot(pte_flags); 859 881 } 860 882 861 883 /*
+3 -3
arch/s390/include/asm/processor.h
··· 129 129 struct runtime_instr_cb *ri_cb; 130 130 struct gs_cb *gs_cb; /* Current guarded storage cb */ 131 131 struct gs_cb *gs_bc_cb; /* Broadcast guarded storage cb */ 132 - unsigned char trap_tdb[256]; /* Transaction abort diagnose block */ 132 + struct pgm_tdb trap_tdb; /* Transaction abort diagnose block */ 133 133 /* 134 134 * Warning: 'fpu' is dynamically-sized. It *MUST* be at 135 135 * the end. ··· 207 207 return sp; 208 208 } 209 209 210 - static __no_kasan_or_inline unsigned short stap(void) 210 + static __always_inline unsigned short stap(void) 211 211 { 212 212 unsigned short cpu_address; 213 213 ··· 246 246 * Set PSW mask to specified value, while leaving the 247 247 * PSW addr pointing to the next instruction. 248 248 */ 249 - static __no_kasan_or_inline void __load_psw_mask(unsigned long mask) 249 + static __always_inline void __load_psw_mask(unsigned long mask) 250 250 { 251 251 unsigned long addr; 252 252 psw_t psw;
+9 -3
arch/s390/include/asm/ptrace.h
··· 9 9 10 10 #include <linux/bits.h> 11 11 #include <uapi/asm/ptrace.h> 12 + #include <asm/tpi.h> 12 13 13 14 #define PIF_SYSCALL 0 /* inside a system call */ 14 15 #define PIF_SYSCALL_RESTART 1 /* restart the current system call */ ··· 87 86 }; 88 87 }; 89 88 unsigned long orig_gpr2; 90 - unsigned int int_code; 91 - unsigned int int_parm; 92 - unsigned long int_parm_long; 89 + union { 90 + struct { 91 + unsigned int int_code; 92 + unsigned int int_parm; 93 + unsigned long int_parm_long; 94 + }; 95 + struct tpi_info tpi_info; 96 + }; 93 97 unsigned long flags; 94 98 unsigned long cr1; 95 99 };
+2 -1
arch/s390/include/asm/setup.h
··· 78 78 char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */ 79 79 }; 80 80 81 + extern struct parmarea parmarea; 82 + 81 83 extern unsigned int zlib_dfltcc_support; 82 84 #define ZLIB_DFLTCC_DISABLED 0 83 85 #define ZLIB_DFLTCC_FULL 1 ··· 89 87 90 88 extern int noexec_disabled; 91 89 extern unsigned long ident_map_size; 92 - extern unsigned long vmalloc_size; 93 90 94 91 /* The Write Back bit position in the physaddr is given by the SLPC PCI */ 95 92 extern unsigned long mio_wb_bit_mask;
+8 -6
arch/s390/include/asm/sigp.h
··· 41 41 static inline int ____pcpu_sigp(u16 addr, u8 order, unsigned long parm, 42 42 u32 *status) 43 43 { 44 - register unsigned long reg1 asm ("1") = parm; 44 + union register_pair r1 = { .odd = parm, }; 45 45 int cc; 46 46 47 47 asm volatile( 48 - " sigp %1,%2,0(%3)\n" 49 - " ipm %0\n" 50 - " srl %0,28\n" 51 - : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc"); 52 - *status = reg1; 48 + " sigp %[r1],%[addr],0(%[order])\n" 49 + " ipm %[cc]\n" 50 + " srl %[cc],28\n" 51 + : [cc] "=&d" (cc), [r1] "+&d" (r1.pair) 52 + : [addr] "d" (addr), [order] "a" (order) 53 + : "cc"); 54 + *status = r1.even; 53 55 return cc; 54 56 } 55 57
+35 -24
arch/s390/include/asm/string.h
··· 107 107 #ifdef __HAVE_ARCH_MEMCHR 108 108 static inline void *memchr(const void * s, int c, size_t n) 109 109 { 110 - register int r0 asm("0") = (char) c; 111 110 const void *ret = s + n; 112 111 113 112 asm volatile( 114 - "0: srst %0,%1\n" 113 + " lgr 0,%[c]\n" 114 + "0: srst %[ret],%[s]\n" 115 115 " jo 0b\n" 116 116 " jl 1f\n" 117 - " la %0,0\n" 117 + " la %[ret],0\n" 118 118 "1:" 119 - : "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory"); 119 + : [ret] "+&a" (ret), [s] "+&a" (s) 120 + : [c] "d" (c) 121 + : "cc", "memory", "0"); 120 122 return (void *) ret; 121 123 } 122 124 #endif ··· 126 124 #ifdef __HAVE_ARCH_MEMSCAN 127 125 static inline void *memscan(void *s, int c, size_t n) 128 126 { 129 - register int r0 asm("0") = (char) c; 130 127 const void *ret = s + n; 131 128 132 129 asm volatile( 133 - "0: srst %0,%1\n" 130 + " lgr 0,%[c]\n" 131 + "0: srst %[ret],%[s]\n" 134 132 " jo 0b\n" 135 - : "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory"); 133 + : [ret] "+&a" (ret), [s] "+&a" (s) 134 + : [c] "d" (c) 135 + : "cc", "memory", "0"); 136 136 return (void *) ret; 137 137 } 138 138 #endif ··· 142 138 #ifdef __HAVE_ARCH_STRCAT 143 139 static inline char *strcat(char *dst, const char *src) 144 140 { 145 - register int r0 asm("0") = 0; 146 - unsigned long dummy; 141 + unsigned long dummy = 0; 147 142 char *ret = dst; 148 143 149 144 asm volatile( 150 - "0: srst %0,%1\n" 145 + " lghi 0,0\n" 146 + "0: srst %[dummy],%[dst]\n" 151 147 " jo 0b\n" 152 - "1: mvst %0,%2\n" 148 + "1: mvst %[dummy],%[src]\n" 153 149 " jo 1b" 154 - : "=&a" (dummy), "+a" (dst), "+a" (src) 155 - : "d" (r0), "0" (0) : "cc", "memory" ); 150 + : [dummy] "+&a" (dummy), [dst] "+&a" (dst), [src] "+&a" (src) 151 + : 152 + : "cc", "memory", "0"); 156 153 return ret; 157 154 } 158 155 #endif ··· 161 156 #ifdef __HAVE_ARCH_STRCPY 162 157 static inline char *strcpy(char *dst, const char *src) 163 158 { 164 - register int r0 asm("0") = 0; 165 159 char *ret = dst; 166 160 167 161 asm volatile( 168 - "0: mvst %0,%1\n" 162 + " lghi 0,0\n" 163 + "0: mvst %[dst],%[src]\n" 169 164 " jo 0b" 170 - : "+&a" (dst), "+&a" (src) : "d" (r0) 171 - : "cc", "memory"); 165 + : [dst] "+&a" (dst), [src] "+&a" (src) 166 + : 167 + : "cc", "memory", "0"); 172 168 return ret; 173 169 } 174 170 #endif ··· 177 171 #if defined(__HAVE_ARCH_STRLEN) || (defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)) 178 172 static inline size_t __no_sanitize_prefix_strfunc(strlen)(const char *s) 179 173 { 180 - register unsigned long r0 asm("0") = 0; 174 + unsigned long end = 0; 181 175 const char *tmp = s; 182 176 183 177 asm volatile( 184 - "0: srst %0,%1\n" 178 + " lghi 0,0\n" 179 + "0: srst %[end],%[tmp]\n" 185 180 " jo 0b" 186 - : "+d" (r0), "+a" (tmp) : : "cc", "memory"); 187 - return r0 - (unsigned long) s; 181 + : [end] "+&a" (end), [tmp] "+&a" (tmp) 182 + : 183 + : "cc", "memory", "0"); 184 + return end - (unsigned long)s; 188 185 } 189 186 #endif 190 187 191 188 #ifdef __HAVE_ARCH_STRNLEN 192 189 static inline size_t strnlen(const char * s, size_t n) 193 190 { 194 - register int r0 asm("0") = 0; 195 191 const char *tmp = s; 196 192 const char *end = s + n; 197 193 198 194 asm volatile( 199 - "0: srst %0,%1\n" 195 + " lghi 0,0\n" 196 + "0: srst %[end],%[tmp]\n" 200 197 " jo 0b" 201 - : "+a" (end), "+a" (tmp) : "d" (r0) : "cc", "memory"); 198 + : [end] "+&a" (end), [tmp] "+&a" (tmp) 199 + : 200 + : "cc", "memory", "0"); 202 201 return end - s; 203 202 } 204 203 #endif
+16 -10
arch/s390/include/asm/timex.h
··· 75 75 76 76 static inline void set_tod_programmable_field(u16 val) 77 77 { 78 - register unsigned long reg0 asm("0") = val; 79 - 80 - asm volatile("sckpf" : : "d" (reg0)); 78 + asm volatile( 79 + " lgr 0,%[val]\n" 80 + " sckpf\n" 81 + : 82 + : [val] "d" ((unsigned long)val) 83 + : "0"); 81 84 } 82 85 83 86 void clock_comparator_work(void); ··· 141 138 #define ptff(ptff_block, len, func) \ 142 139 ({ \ 143 140 struct addrtype { char _[len]; }; \ 144 - register unsigned int reg0 asm("0") = func; \ 145 - register unsigned long reg1 asm("1") = (unsigned long) (ptff_block);\ 141 + unsigned int reg0 = func; \ 142 + unsigned long reg1 = (unsigned long)(ptff_block); \ 146 143 int rc; \ 147 144 \ 148 145 asm volatile( \ 149 - " .word 0x0104\n" \ 150 - " ipm %0\n" \ 151 - " srl %0,28\n" \ 152 - : "=d" (rc), "+m" (*(struct addrtype *) reg1) \ 153 - : "d" (reg0), "d" (reg1) : "cc"); \ 146 + " lgr 0,%[reg0]\n" \ 147 + " lgr 1,%[reg1]\n" \ 148 + " .insn e,0x0104\n" \ 149 + " ipm %[rc]\n" \ 150 + " srl %[rc],28\n" \ 151 + : [rc] "=&d" (rc), "+m" (*(struct addrtype *)reg1) \ 152 + : [reg0] "d" (reg0), [reg1] "d" (reg1) \ 153 + : "cc", "0", "1"); \ 154 154 rc; \ 155 155 }) 156 156
+24
arch/s390/include/asm/tpi.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _ASM_S390_TPI_H 3 + #define _ASM_S390_TPI_H 4 + 5 + #include <linux/types.h> 6 + #include <uapi/asm/schid.h> 7 + 8 + #ifndef __ASSEMBLY__ 9 + 10 + /* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */ 11 + struct tpi_info { 12 + struct subchannel_id schid; 13 + u32 intparm; 14 + u32 adapter_IO:1; 15 + u32 directed_irq:1; 16 + u32 isc:3; 17 + u32 :12; 18 + u32 type:3; 19 + u32 :12; 20 + } __packed __aligned(4); 21 + 22 + #endif /* __ASSEMBLY__ */ 23 + 24 + #endif /* _ASM_S390_TPI_H */
+19
arch/s390/include/asm/types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + 3 + #ifndef _ASM_S390_TYPES_H 4 + #define _ASM_S390_TYPES_H 5 + 6 + #include <uapi/asm/types.h> 7 + 8 + #ifndef __ASSEMBLY__ 9 + 10 + union register_pair { 11 + unsigned __int128 pair; 12 + struct { 13 + unsigned long even; 14 + unsigned long odd; 15 + }; 16 + }; 17 + 18 + #endif /* __ASSEMBLY__ */ 19 + #endif /* _ASM_S390_TYPES_H */
+17 -19
arch/s390/include/asm/uaccess.h
··· 49 49 50 50 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES 51 51 52 - #define __put_get_user_asm(to, from, size, spec) \ 52 + #define __put_get_user_asm(to, from, size, insn) \ 53 53 ({ \ 54 - register unsigned long __reg0 asm("0") = spec; \ 55 54 int __rc; \ 56 55 \ 57 56 asm volatile( \ 58 - "0: mvcos %1,%3,%2\n" \ 59 - "1: xr %0,%0\n" \ 57 + insn " 0,%[spec]\n" \ 58 + "0: mvcos %[_to],%[_from],%[_size]\n" \ 59 + "1: xr %[rc],%[rc]\n" \ 60 60 "2:\n" \ 61 61 ".pushsection .fixup, \"ax\"\n" \ 62 - "3: lhi %0,%5\n" \ 62 + "3: lhi %[rc],%[retval]\n" \ 63 63 " jg 2b\n" \ 64 64 ".popsection\n" \ 65 65 EX_TABLE(0b,3b) EX_TABLE(1b,3b) \ 66 - : "=d" (__rc), "+Q" (*(to)) \ 67 - : "d" (size), "Q" (*(from)), \ 68 - "d" (__reg0), "K" (-EFAULT) \ 69 - : "cc"); \ 66 + : [rc] "=&d" (__rc), [_to] "+Q" (*(to)) \ 67 + : [_size] "d" (size), [_from] "Q" (*(from)), \ 68 + [retval] "K" (-EFAULT), [spec] "K" (0x81UL) \ 69 + : "cc", "0"); \ 70 70 __rc; \ 71 71 }) 72 72 73 73 static __always_inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) 74 74 { 75 - unsigned long spec = 0x810000UL; 76 75 int rc; 77 76 78 77 switch (size) { 79 78 case 1: 80 79 rc = __put_get_user_asm((unsigned char __user *)ptr, 81 80 (unsigned char *)x, 82 - size, spec); 81 + size, "llilh"); 83 82 break; 84 83 case 2: 85 84 rc = __put_get_user_asm((unsigned short __user *)ptr, 86 85 (unsigned short *)x, 87 - size, spec); 86 + size, "llilh"); 88 87 break; 89 88 case 4: 90 89 rc = __put_get_user_asm((unsigned int __user *)ptr, 91 90 (unsigned int *)x, 92 - size, spec); 91 + size, "llilh"); 93 92 break; 94 93 case 8: 95 94 rc = __put_get_user_asm((unsigned long __user *)ptr, 96 95 (unsigned long *)x, 97 - size, spec); 96 + size, "llilh"); 98 97 break; 99 98 default: 100 99 __put_user_bad(); ··· 104 105 105 106 static __always_inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size) 106 107 { 107 - unsigned long spec = 0x81UL; 108 108 int rc; 109 109 110 110 switch (size) { 111 111 case 1: 112 112 rc = __put_get_user_asm((unsigned char *)x, 113 113 (unsigned char __user *)ptr, 114 - size, spec); 114 + size, "lghi"); 115 115 break; 116 116 case 2: 117 117 rc = __put_get_user_asm((unsigned short *)x, 118 118 (unsigned short __user *)ptr, 119 - size, spec); 119 + size, "lghi"); 120 120 break; 121 121 case 4: 122 122 rc = __put_get_user_asm((unsigned int *)x, 123 123 (unsigned int __user *)ptr, 124 - size, spec); 124 + size, "lghi"); 125 125 break; 126 126 case 8: 127 127 rc = __put_get_user_asm((unsigned long *)x, 128 128 (unsigned long __user *)ptr, 129 - size, spec); 129 + size, "lghi"); 130 130 break; 131 131 default: 132 132 __get_user_bad();
+3
arch/s390/include/uapi/asm/schid.h
··· 4 4 5 5 #include <linux/types.h> 6 6 7 + #ifndef __ASSEMBLY__ 8 + 7 9 struct subchannel_id { 8 10 __u32 cssid : 8; 9 11 __u32 : 4; ··· 15 13 __u32 sch_no : 16; 16 14 } __attribute__ ((packed, aligned(4))); 17 15 16 + #endif /* __ASSEMBLY__ */ 18 17 19 18 #endif /* _UAPIASM_SCHID_H */
+1 -2
arch/s390/kernel/alternative.c
··· 76 76 instr = (u8 *)&a->instr_offset + a->instr_offset; 77 77 replacement = (u8 *)&a->repl_offset + a->repl_offset; 78 78 79 - if (!__test_facility(a->facility, 80 - S390_lowcore.alt_stfle_fac_list)) 79 + if (!__test_facility(a->facility, alt_stfle_fac_list)) 81 80 continue; 82 81 83 82 if (unlikely(a->instrlen % 2 || a->replacementlen % 2)) {
+3 -4
arch/s390/kernel/asm-offsets.c
··· 15 15 #include <asm/idle.h> 16 16 #include <asm/gmap.h> 17 17 #include <asm/nmi.h> 18 + #include <asm/setup.h> 18 19 #include <asm/stacktrace.h> 19 20 20 21 int main(void) ··· 59 58 OFFSET(__LC_EXT_PARAMS, lowcore, ext_params); 60 59 OFFSET(__LC_EXT_CPU_ADDR, lowcore, ext_cpu_addr); 61 60 OFFSET(__LC_EXT_INT_CODE, lowcore, ext_int_code); 62 - OFFSET(__LC_SVC_ILC, lowcore, svc_ilc); 63 - OFFSET(__LC_SVC_INT_CODE, lowcore, svc_code); 64 61 OFFSET(__LC_PGM_ILC, lowcore, pgm_ilc); 65 62 OFFSET(__LC_PGM_INT_CODE, lowcore, pgm_code); 66 63 OFFSET(__LC_DATA_EXC_CODE, lowcore, data_exc_code); ··· 76 77 OFFSET(__LC_SUBCHANNEL_NR, lowcore, subchannel_nr); 77 78 OFFSET(__LC_IO_INT_PARM, lowcore, io_int_parm); 78 79 OFFSET(__LC_IO_INT_WORD, lowcore, io_int_word); 79 - OFFSET(__LC_STFL_FAC_LIST, lowcore, stfl_fac_list); 80 - OFFSET(__LC_STFLE_FAC_LIST, lowcore, stfle_fac_list); 81 80 OFFSET(__LC_MCCK_CODE, lowcore, mcck_interruption_code); 82 81 OFFSET(__LC_EXT_DAMAGE_CODE, lowcore, external_damage_code); 83 82 OFFSET(__LC_MCCK_FAIL_STOR_ADDR, lowcore, failing_storage_address); ··· 156 159 OFFSET(__KEXEC_SHA_REGION_START, kexec_sha_region, start); 157 160 OFFSET(__KEXEC_SHA_REGION_LEN, kexec_sha_region, len); 158 161 DEFINE(__KEXEC_SHA_REGION_SIZE, sizeof(struct kexec_sha_region)); 162 + /* sizeof kernel parameter area */ 163 + DEFINE(__PARMAREA_SIZE, sizeof(struct parmarea)); 159 164 return 0; 160 165 }
+22 -20
arch/s390/kernel/cpcmd.c
··· 26 26 27 27 static int diag8_noresponse(int cmdlen) 28 28 { 29 - register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; 30 - register unsigned long reg3 asm ("3") = cmdlen; 31 - 32 29 asm volatile( 33 - " diag %1,%0,0x8\n" 34 - : "+d" (reg3) : "d" (reg2) : "cc"); 35 - return reg3; 30 + " diag %[rx],%[ry],0x8\n" 31 + : [ry] "+&d" (cmdlen) 32 + : [rx] "d" ((addr_t) cpcmd_buf) 33 + : "cc"); 34 + return cmdlen; 36 35 } 37 36 38 37 static int diag8_response(int cmdlen, char *response, int *rlen) 39 38 { 40 - unsigned long _cmdlen = cmdlen | 0x40000000L; 41 - unsigned long _rlen = *rlen; 42 - register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; 43 - register unsigned long reg3 asm ("3") = (addr_t) response; 44 - register unsigned long reg4 asm ("4") = _cmdlen; 45 - register unsigned long reg5 asm ("5") = _rlen; 39 + union register_pair rx, ry; 40 + int cc; 46 41 42 + rx.even = (addr_t) cpcmd_buf; 43 + rx.odd = (addr_t) response; 44 + ry.even = cmdlen | 0x40000000L; 45 + ry.odd = *rlen; 47 46 asm volatile( 48 - " diag %2,%0,0x8\n" 49 - " brc 8,1f\n" 50 - " agr %1,%4\n" 51 - "1:\n" 52 - : "+d" (reg4), "+d" (reg5) 53 - : "d" (reg2), "d" (reg3), "d" (*rlen) : "cc"); 54 - *rlen = reg5; 55 - return reg4; 47 + " diag %[rx],%[ry],0x8\n" 48 + " ipm %[cc]\n" 49 + " srl %[cc],28\n" 50 + : [cc] "=&d" (cc), [ry] "+&d" (ry.pair) 51 + : [rx] "d" (rx.pair) 52 + : "cc"); 53 + if (cc) 54 + *rlen += ry.odd; 55 + else 56 + *rlen = ry.odd; 57 + return ry.even; 56 58 } 57 59 58 60 /*
+1 -1
arch/s390/kernel/debug.c
··· 1418 1418 else 1419 1419 except_str = "-"; 1420 1420 caller = (unsigned long) entry->caller; 1421 - rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %04u %pK ", 1421 + rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %04u %px ", 1422 1422 area, sec, usec, level, except_str, 1423 1423 entry->cpu, (void *)caller); 1424 1424 return rc;
+5 -6
arch/s390/kernel/diag.c
··· 141 141 142 142 static inline int __diag204(unsigned long *subcode, unsigned long size, void *addr) 143 143 { 144 - register unsigned long _subcode asm("0") = *subcode; 145 - register unsigned long _size asm("1") = size; 144 + union register_pair rp = { .even = *subcode, .odd = size }; 146 145 147 146 asm volatile( 148 - " diag %2,%0,0x204\n" 147 + " diag %[addr],%[rp],0x204\n" 149 148 "0: nopr %%r7\n" 150 149 EX_TABLE(0b,0b) 151 - : "+d" (_subcode), "+d" (_size) : "d" (addr) : "memory"); 152 - *subcode = _subcode; 153 - return _size; 150 + : [rp] "+&d" (rp.pair) : [addr] "d" (addr) : "memory"); 151 + *subcode = rp.even; 152 + return rp.odd; 154 153 } 155 154 156 155 int diag204(unsigned long subcode, unsigned long size, void *addr)
+2 -4
arch/s390/kernel/early.c
··· 180 180 181 181 static noinline __init void setup_facility_list(void) 182 182 { 183 - memcpy(S390_lowcore.alt_stfle_fac_list, 184 - S390_lowcore.stfle_fac_list, 185 - sizeof(S390_lowcore.alt_stfle_fac_list)); 183 + memcpy(alt_stfle_fac_list, stfle_fac_list, sizeof(alt_stfle_fac_list)); 186 184 if (!IS_ENABLED(CONFIG_KERNEL_NOBP)) 187 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 185 + __clear_facility(82, alt_stfle_fac_list); 188 186 } 189 187 190 188 static __init void detect_diag9c(void)
+31 -30
arch/s390/kernel/entry.S
··· 129 129 "jnz .+8; .long 0xb2e8d000", 82 130 130 .endm 131 131 132 + #if IS_ENABLED(CONFIG_KVM) 133 + /* 134 + * The OUTSIDE macro jumps to the provided label in case the value 135 + * in the provided register is outside of the provided range. The 136 + * macro is useful for checking whether a PSW stored in a register 137 + * pair points inside or outside of a block of instructions. 138 + * @reg: register to check 139 + * @start: start of the range 140 + * @end: end of the range 141 + * @outside_label: jump here if @reg is outside of [@start..@end) 142 + */ 143 + .macro OUTSIDE reg,start,end,outside_label 144 + lgr %r14,\reg 145 + larl %r13,\start 146 + slgr %r14,%r13 147 + lghi %r13,\end - \start 148 + clgr %r14,%r13 149 + jhe \outside_label 150 + .endm 151 + #endif 152 + 132 153 GEN_BR_THUNK %r14 133 154 GEN_BR_THUNK %r14,%r13 134 155 ··· 235 214 # are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable. 236 215 # Other instructions between sie64a and .Lsie_done should not cause program 237 216 # interrupts. So lets use 3 nops as a landing pad for all possible rewinds. 238 - # See also .Lcleanup_sie_mcck/.Lcleanup_sie_int 217 + # See also .Lcleanup_sie 239 218 .Lrewind_pad6: 240 219 nopr 7 241 220 .Lrewind_pad4: ··· 297 276 xgr %r10,%r10 298 277 xgr %r11,%r11 299 278 la %r2,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs 279 + mvc __PT_R8(64,%r2),__LC_SAVE_AREA_SYNC 300 280 lgr %r3,%r14 301 281 brasl %r14,__do_syscall 302 282 lctlg %c1,%c1,__LC_USER_ASCE ··· 340 318 .Lpgm_skip_asce: 341 319 #if IS_ENABLED(CONFIG_KVM) 342 320 # cleanup critical section for program checks in sie64a 343 - lgr %r14,%r9 344 - larl %r13,.Lsie_gmap 345 - slgr %r14,%r13 346 - lghi %r13,.Lsie_done - .Lsie_gmap 347 - clgr %r14,%r13 348 - jhe 1f 321 + OUTSIDE %r9,.Lsie_gmap,.Lsie_done,1f 349 322 lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer 350 323 ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE 351 324 lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce ··· 409 392 tmhh %r8,0x0001 # interrupting from user ? 410 393 jnz 1f 411 394 #if IS_ENABLED(CONFIG_KVM) 412 - lgr %r14,%r9 413 - larl %r13,.Lsie_gmap 414 - slgr %r14,%r13 415 - lghi %r13,.Lsie_done - .Lsie_gmap 416 - clgr %r14,%r13 417 - jhe 0f 418 - brasl %r14,.Lcleanup_sie_int 395 + OUTSIDE %r9,.Lsie_gmap,.Lsie_done,0f 396 + brasl %r14,.Lcleanup_sie 419 397 #endif 420 398 0: CHECK_STACK __LC_SAVE_AREA_ASYNC 421 399 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) ··· 553 541 tmhh %r8,0x0001 # interrupting from user ? 554 542 jnz .Lmcck_user 555 543 #if IS_ENABLED(CONFIG_KVM) 556 - lgr %r14,%r9 557 - larl %r13,.Lsie_gmap 558 - slgr %r14,%r13 559 - lghi %r13,.Lsie_done - .Lsie_gmap 560 - clgr %r14,%r13 561 - jhe .Lmcck_stack 562 - brasl %r14,.Lcleanup_sie_mcck 544 + OUTSIDE %r9,.Lsie_gmap,.Lsie_done,.Lmcck_stack 545 + OUTSIDE %r9,.Lsie_entry,.Lsie_skip,5f 546 + oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST 547 + 5: brasl %r14,.Lcleanup_sie 563 548 #endif 564 549 j .Lmcck_stack 565 550 .Lmcck_user: ··· 658 649 #endif 659 650 660 651 #if IS_ENABLED(CONFIG_KVM) 661 - .Lcleanup_sie_mcck: 662 - larl %r13,.Lsie_entry 663 - slgr %r9,%r13 664 - lghi %r13,.Lsie_skip - .Lsie_entry 665 - clgr %r9,%r13 666 - jhe .Lcleanup_sie_int 667 - oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST 668 - .Lcleanup_sie_int: 652 + .Lcleanup_sie: 669 653 BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST) 670 654 lg %r9,__SF_SIE_CONTROL(%r15) # get control block pointer 671 655 ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE 672 656 lctlg %c1,%c1,__LC_KERNEL_ASCE 673 657 larl %r9,sie_exit # skip forward to sie_exit 674 658 BR_EX %r14,%r13 675 - 676 659 #endif 677 660 .section .rodata, "a" 678 661 #define SYSCALL(esame,emu) .quad __s390x_ ## esame
+8 -6
arch/s390/kernel/ipl.c
··· 163 163 164 164 static inline int __diag308(unsigned long subcode, void *addr) 165 165 { 166 - register unsigned long _addr asm("0") = (unsigned long) addr; 167 - register unsigned long _rc asm("1") = 0; 166 + union register_pair r1; 168 167 168 + r1.even = (unsigned long) addr; 169 + r1.odd = 0; 169 170 asm volatile( 170 - " diag %0,%2,0x308\n" 171 + " diag %[r1],%[subcode],0x308\n" 171 172 "0: nopr %%r7\n" 172 173 EX_TABLE(0b,0b) 173 - : "+d" (_addr), "+d" (_rc) 174 - : "d" (subcode) : "cc", "memory"); 175 - return _rc; 174 + : [r1] "+&d" (r1.pair) 175 + : [subcode] "d" (subcode) 176 + : "cc", "memory"); 177 + return r1.odd; 176 178 } 177 179 178 180 int diag308(unsigned long subcode, void *addr)
+3 -3
arch/s390/kernel/irq.c
··· 146 146 account_idle_time_irq(); 147 147 148 148 do { 149 - memcpy(&regs->int_code, &S390_lowcore.subchannel_id, 12); 150 - if (S390_lowcore.io_int_word & BIT(31)) 149 + regs->tpi_info = S390_lowcore.tpi_info; 150 + if (S390_lowcore.tpi_info.adapter_IO) 151 151 do_irq_async(regs, THIN_INTERRUPT); 152 152 else 153 153 do_irq_async(regs, IO_INTERRUPT); ··· 172 172 if (user_mode(regs)) 173 173 update_timer_sys(); 174 174 175 - memcpy(&regs->int_code, &S390_lowcore.ext_cpu_addr, 4); 175 + regs->int_code = S390_lowcore.ext_int_code_addr; 176 176 regs->int_parm = S390_lowcore.ext_params; 177 177 regs->int_parm_long = S390_lowcore.ext_params2; 178 178
+9 -8
arch/s390/kernel/nospec-branch.c
··· 17 17 * The user explicitely requested nobp=1, enable it and 18 18 * disable the expoline support. 19 19 */ 20 - __set_facility(82, S390_lowcore.alt_stfle_fac_list); 20 + __set_facility(82, alt_stfle_fac_list); 21 21 if (IS_ENABLED(CONFIG_EXPOLINE)) 22 22 nospec_disable = 1; 23 23 } else { 24 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 24 + __clear_facility(82, alt_stfle_fac_list); 25 25 } 26 26 return 0; 27 27 } ··· 29 29 30 30 static int __init nospec_setup_early(char *str) 31 31 { 32 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 32 + __clear_facility(82, alt_stfle_fac_list); 33 33 return 0; 34 34 } 35 35 early_param("nospec", nospec_setup_early); ··· 40 40 pr_info("Spectre V2 mitigation: etokens\n"); 41 41 if (__is_defined(CC_USING_EXPOLINE) && !nospec_disable) 42 42 pr_info("Spectre V2 mitigation: execute trampolines\n"); 43 - if (__test_facility(82, S390_lowcore.alt_stfle_fac_list)) 43 + if (__test_facility(82, alt_stfle_fac_list)) 44 44 pr_info("Spectre V2 mitigation: limited branch prediction\n"); 45 45 return 0; 46 46 } ··· 66 66 */ 67 67 if (__is_defined(CC_USING_EXPOLINE)) 68 68 nospec_disable = 1; 69 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 69 + __clear_facility(82, alt_stfle_fac_list); 70 70 } else if (__is_defined(CC_USING_EXPOLINE)) { 71 71 /* 72 72 * The kernel has been compiled with expolines. 73 73 * Keep expolines enabled and disable nobp. 74 74 */ 75 75 nospec_disable = 0; 76 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 76 + __clear_facility(82, alt_stfle_fac_list); 77 77 } 78 78 /* 79 79 * If the kernel has not been compiled with expolines the ··· 86 86 { 87 87 if (str && !strncmp(str, "on", 2)) { 88 88 nospec_disable = 0; 89 - __clear_facility(82, S390_lowcore.alt_stfle_fac_list); 89 + __clear_facility(82, alt_stfle_fac_list); 90 90 } 91 91 if (str && !strncmp(str, "off", 3)) 92 92 nospec_disable = 1; ··· 99 99 static void __init_or_module __nospec_revert(s32 *start, s32 *end) 100 100 { 101 101 enum { BRCL_EXPOLINE, BRASL_EXPOLINE } type; 102 + static const u8 branch[] = { 0x47, 0x00, 0x07, 0x00 }; 102 103 u8 *instr, *thunk, *br; 103 104 u8 insnbuf[6]; 104 105 s32 *epo; ··· 129 128 if ((br[0] & 0xbf) != 0x07 || (br[1] & 0xf0) != 0xf0) 130 129 continue; 131 130 132 - memcpy(insnbuf + 2, (char[]) { 0x47, 0x00, 0x07, 0x00 }, 4); 131 + memcpy(insnbuf + 2, branch, sizeof(branch)); 133 132 switch (type) { 134 133 case BRCL_EXPOLINE: 135 134 insnbuf[0] = br[0];
+1 -1
arch/s390/kernel/nospec-sysfs.c
··· 17 17 return sprintf(buf, "Mitigation: etokens\n"); 18 18 if (__is_defined(CC_USING_EXPOLINE) && !nospec_disable) 19 19 return sprintf(buf, "Mitigation: execute trampolines\n"); 20 - if (__test_facility(82, S390_lowcore.alt_stfle_fac_list)) 20 + if (__test_facility(82, alt_stfle_fac_list)) 21 21 return sprintf(buf, "Mitigation: limited branch prediction\n"); 22 22 return sprintf(buf, "Vulnerable\n"); 23 23 }
+1 -91
arch/s390/kernel/perf_cpum_cf.c
··· 362 362 struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 363 363 struct hw_perf_event *hwc = &event->hw; 364 364 365 - if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED))) 365 + if (!(hwc->state & PERF_HES_STOPPED)) 366 366 return; 367 - 368 - if (WARN_ON_ONCE(hwc->config == -1)) 369 - return; 370 - 371 - if (flags & PERF_EF_RELOAD) 372 - WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); 373 367 374 368 hwc->state = 0; 375 369 ··· 407 413 { 408 414 struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 409 415 410 - /* Check authorization for the counter set to which this 411 - * counter belongs. 412 - * For group events transaction, the authorization check is 413 - * done in cpumf_pmu_commit_txn(). 414 - */ 415 - if (!(cpuhw->txn_flags & PERF_PMU_TXN_ADD)) 416 - if (validate_ctr_auth(&event->hw)) 417 - return -ENOENT; 418 - 419 416 ctr_set_enable(&cpuhw->state, event->hw.config_base); 420 417 event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED; 421 418 ··· 434 449 ctr_set_disable(&cpuhw->state, event->hw.config_base); 435 450 } 436 451 437 - /* 438 - * Start group events scheduling transaction. 439 - * Set flags to perform a single test at commit time. 440 - * 441 - * We only support PERF_PMU_TXN_ADD transactions. Save the 442 - * transaction flags but otherwise ignore non-PERF_PMU_TXN_ADD 443 - * transactions. 444 - */ 445 - static void cpumf_pmu_start_txn(struct pmu *pmu, unsigned int txn_flags) 446 - { 447 - struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 448 - 449 - WARN_ON_ONCE(cpuhw->txn_flags); /* txn already in flight */ 450 - 451 - cpuhw->txn_flags = txn_flags; 452 - if (txn_flags & ~PERF_PMU_TXN_ADD) 453 - return; 454 - 455 - perf_pmu_disable(pmu); 456 - cpuhw->tx_state = cpuhw->state; 457 - } 458 - 459 - /* 460 - * Stop and cancel a group events scheduling tranctions. 461 - * Assumes cpumf_pmu_del() is called for each successful added 462 - * cpumf_pmu_add() during the transaction. 463 - */ 464 - static void cpumf_pmu_cancel_txn(struct pmu *pmu) 465 - { 466 - unsigned int txn_flags; 467 - struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 468 - 469 - WARN_ON_ONCE(!cpuhw->txn_flags); /* no txn in flight */ 470 - 471 - txn_flags = cpuhw->txn_flags; 472 - cpuhw->txn_flags = 0; 473 - if (txn_flags & ~PERF_PMU_TXN_ADD) 474 - return; 475 - 476 - WARN_ON(cpuhw->tx_state != cpuhw->state); 477 - 478 - perf_pmu_enable(pmu); 479 - } 480 - 481 - /* 482 - * Commit the group events scheduling transaction. On success, the 483 - * transaction is closed. On error, the transaction is kept open 484 - * until cpumf_pmu_cancel_txn() is called. 485 - */ 486 - static int cpumf_pmu_commit_txn(struct pmu *pmu) 487 - { 488 - struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 489 - u64 state; 490 - 491 - WARN_ON_ONCE(!cpuhw->txn_flags); /* no txn in flight */ 492 - 493 - if (cpuhw->txn_flags & ~PERF_PMU_TXN_ADD) { 494 - cpuhw->txn_flags = 0; 495 - return 0; 496 - } 497 - 498 - /* check if the updated state can be scheduled */ 499 - state = cpuhw->state & ~((1 << CPUMF_LCCTL_ENABLE_SHIFT) - 1); 500 - state >>= CPUMF_LCCTL_ENABLE_SHIFT; 501 - if ((state & cpuhw->info.auth_ctl) != state) 502 - return -ENOENT; 503 - 504 - cpuhw->txn_flags = 0; 505 - perf_pmu_enable(pmu); 506 - return 0; 507 - } 508 - 509 452 /* Performance monitoring unit for s390x */ 510 453 static struct pmu cpumf_pmu = { 511 454 .task_ctx_nr = perf_sw_context, ··· 446 533 .start = cpumf_pmu_start, 447 534 .stop = cpumf_pmu_stop, 448 535 .read = cpumf_pmu_read, 449 - .start_txn = cpumf_pmu_start_txn, 450 - .commit_txn = cpumf_pmu_commit_txn, 451 - .cancel_txn = cpumf_pmu_cancel_txn, 452 536 }; 453 537 454 538 static int __init cpumf_pmu_init(void)
-1
arch/s390/kernel/perf_cpum_cf_common.c
··· 30 30 .alert = ATOMIC64_INIT(0), 31 31 .state = 0, 32 32 .flags = 0, 33 - .txn_flags = 0, 34 33 }; 35 34 /* Indicator whether the CPU-Measurement Counter Facility Support is ready */ 36 35 static bool cpum_cf_initalized;
+1 -3
arch/s390/kernel/processor.c
··· 103 103 static void show_facilities(struct seq_file *m) 104 104 { 105 105 unsigned int bit; 106 - long *facilities; 107 106 108 - facilities = (long *)&S390_lowcore.stfle_fac_list; 109 107 seq_puts(m, "facilities :"); 110 - for_each_set_bit_inv(bit, facilities, MAX_FACILITY_BIT) 108 + for_each_set_bit_inv(bit, (long *)&stfle_fac_list, MAX_FACILITY_BIT) 111 109 seq_printf(m, " %d", bit); 112 110 seq_putc(m, '\n'); 113 111 }
+3 -1
arch/s390/kernel/ptrace.c
··· 975 975 struct membuf to) 976 976 { 977 977 struct pt_regs *regs = task_pt_regs(target); 978 + size_t size; 978 979 979 980 if (!(regs->int_code & 0x200)) 980 981 return -ENODATA; 981 - return membuf_write(&to, target->thread.trap_tdb, 256); 982 + size = sizeof(target->thread.trap_tdb.data); 983 + return membuf_write(&to, target->thread.trap_tdb.data, size); 982 984 } 983 985 984 986 static int s390_tdb_set(struct task_struct *target,
+7 -100
arch/s390/kernel/setup.c
··· 96 96 97 97 int __bootdata(noexec_disabled); 98 98 unsigned long __bootdata(ident_map_size); 99 - unsigned long __bootdata(vmalloc_size); 100 99 struct mem_detect_info __bootdata(mem_detect); 101 100 102 101 struct exception_table_entry *__bootdata_preserved(__start_dma_ex_table); ··· 107 108 unsigned long __bootdata_preserved(__kaslr_offset); 108 109 unsigned int __bootdata_preserved(zlib_dfltcc_support); 109 110 EXPORT_SYMBOL(zlib_dfltcc_support); 111 + u64 __bootdata_preserved(stfle_fac_list[16]); 112 + EXPORT_SYMBOL(stfle_fac_list); 113 + u64 __bootdata_preserved(alt_stfle_fac_list[16]); 110 114 111 115 unsigned long VMALLOC_START; 112 116 EXPORT_SYMBOL(VMALLOC_START); ··· 167 165 else if (CONSOLE_IS_3270) 168 166 add_preferred_console("tty3270", 0, NULL); 169 167 else if (CONSOLE_IS_VT220) 170 - add_preferred_console("ttyS", 1, NULL); 168 + add_preferred_console("ttysclp", 0, NULL); 171 169 else if (CONSOLE_IS_HVC) 172 170 add_preferred_console("hvc", 0, NULL); 173 171 } ··· 340 338 return 0; 341 339 } 342 340 343 - static int __init stack_realloc(void) 344 - { 345 - unsigned long old, new; 346 - 347 - old = S390_lowcore.async_stack - STACK_INIT_OFFSET; 348 - new = stack_alloc(); 349 - if (!new) 350 - panic("Couldn't allocate async stack"); 351 - WRITE_ONCE(S390_lowcore.async_stack, new + STACK_INIT_OFFSET); 352 - free_pages(old, THREAD_SIZE_ORDER); 353 - 354 - old = S390_lowcore.mcck_stack - STACK_INIT_OFFSET; 355 - new = stack_alloc(); 356 - if (!new) 357 - panic("Couldn't allocate machine check stack"); 358 - WRITE_ONCE(S390_lowcore.mcck_stack, new + STACK_INIT_OFFSET); 359 - memblock_free_late(old, THREAD_SIZE); 360 - return 0; 361 - } 362 - early_initcall(stack_realloc); 363 - 364 341 void __init arch_call_rest_init(void) 365 342 { 366 343 unsigned long stack; ··· 394 413 lc->lpp = LPP_MAGIC; 395 414 lc->machine_flags = S390_lowcore.machine_flags; 396 415 lc->preempt_count = S390_lowcore.preempt_count; 397 - lc->stfl_fac_list = S390_lowcore.stfl_fac_list; 398 - memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list, 399 - sizeof(lc->stfle_fac_list)); 400 - memcpy(lc->alt_stfle_fac_list, S390_lowcore.alt_stfle_fac_list, 401 - sizeof(lc->alt_stfle_fac_list)); 402 416 nmi_alloc_boot_cpu(lc); 403 417 lc->sys_enter_timer = S390_lowcore.sys_enter_timer; 404 418 lc->exit_timer = S390_lowcore.exit_timer; ··· 544 568 #endif 545 569 } 546 570 547 - static void __init setup_ident_map_size(void) 571 + static void __init setup_memory_end(void) 548 572 { 549 - unsigned long vmax, tmp; 550 - 551 - /* Choose kernel address space layout: 3 or 4 levels. */ 552 - tmp = ident_map_size / PAGE_SIZE; 553 - tmp = tmp * (sizeof(struct page) + PAGE_SIZE); 554 - if (tmp + vmalloc_size + MODULES_LEN <= _REGION2_SIZE) 555 - vmax = _REGION2_SIZE; /* 3-level kernel page table */ 556 - else 557 - vmax = _REGION1_SIZE; /* 4-level kernel page table */ 558 - /* module area is at the end of the kernel address space. */ 559 - MODULES_END = vmax; 560 - if (is_prot_virt_host()) 561 - adjust_to_uv_max(&MODULES_END); 562 - #ifdef CONFIG_KASAN 563 - vmax = _REGION1_SIZE; 564 - MODULES_END = kasan_vmax; 565 - #endif 566 - MODULES_VADDR = MODULES_END - MODULES_LEN; 567 - VMALLOC_END = MODULES_VADDR; 568 - VMALLOC_START = VMALLOC_END - vmalloc_size; 569 - 570 - /* Split remaining virtual space between 1:1 mapping & vmemmap array */ 571 - tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page)); 572 - /* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */ 573 - tmp = SECTION_ALIGN_UP(tmp); 574 - tmp = VMALLOC_START - tmp * sizeof(struct page); 575 - tmp &= ~((vmax >> 11) - 1); /* align to page table level */ 576 - tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS); 577 - vmemmap = (struct page *) tmp; 578 - 579 - /* Take care that ident_map_size <= vmemmap */ 580 - ident_map_size = min(ident_map_size, (unsigned long)vmemmap); 581 - #ifdef CONFIG_KASAN 582 - ident_map_size = min(ident_map_size, KASAN_SHADOW_START); 583 - #endif 584 - vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page); 585 - #ifdef CONFIG_KASAN 586 - /* move vmemmap above kasan shadow only if stands in a way */ 587 - if (KASAN_SHADOW_END > (unsigned long)vmemmap && 588 - (unsigned long)vmemmap + vmemmap_size > KASAN_SHADOW_START) 589 - vmemmap = max(vmemmap, (struct page *)KASAN_SHADOW_END); 590 - #endif 591 - max_pfn = max_low_pfn = PFN_DOWN(ident_map_size); 592 573 memblock_remove(ident_map_size, ULONG_MAX); 593 - 574 + max_pfn = max_low_pfn = PFN_DOWN(ident_map_size); 594 575 pr_notice("The maximum memory size is %luMB\n", ident_map_size >> 20); 595 576 } 596 577 ··· 583 650 static void __init reserve_above_ident_map(void) 584 651 { 585 652 memblock_reserve(ident_map_size, ULONG_MAX); 586 - } 587 - 588 - /* 589 - * Make sure that oldmem, where the dump is stored, is protected 590 - */ 591 - static void __init reserve_oldmem(void) 592 - { 593 - #ifdef CONFIG_CRASH_DUMP 594 - if (OLDMEM_BASE) 595 - /* Forget all memory above the running kdump system */ 596 - memblock_reserve(OLDMEM_SIZE, (phys_addr_t)ULONG_MAX); 597 - #endif 598 - } 599 - 600 - /* 601 - * Make sure that oldmem, where the dump is stored, is protected 602 - */ 603 - static void __init remove_oldmem(void) 604 - { 605 - #ifdef CONFIG_CRASH_DUMP 606 - if (OLDMEM_BASE) 607 - /* Forget all memory above the running kdump system */ 608 - memblock_remove(OLDMEM_SIZE, (phys_addr_t)ULONG_MAX); 609 - #endif 610 653 } 611 654 612 655 /* ··· 1050 1141 1051 1142 /* Do some memory reservations *before* memory is added to memblock */ 1052 1143 reserve_above_ident_map(); 1053 - reserve_oldmem(); 1054 1144 reserve_kernel(); 1055 1145 reserve_initrd(); 1056 1146 reserve_certificate_list(); ··· 1060 1152 memblock_add_mem_detect_info(); 1061 1153 1062 1154 free_mem_detect_info(); 1063 - remove_oldmem(); 1064 1155 1065 1156 setup_uv(); 1066 - setup_ident_map_size(); 1157 + setup_memory_end(); 1067 1158 setup_memory(); 1068 1159 dma_contiguous_reserve(ident_map_size); 1069 1160 vmcp_cma_reserve();
+87 -44
arch/s390/kernel/smp.c
··· 74 74 static DEFINE_PER_CPU(struct cpu *, cpu_device); 75 75 76 76 struct pcpu { 77 - struct lowcore *lowcore; /* lowcore page(s) for the cpu */ 78 77 unsigned long ec_mask; /* bit mask for ec_xxx functions */ 79 78 unsigned long ec_clk; /* sigp timestamp for ec_xxx */ 80 79 signed char state; /* physical cpu state */ ··· 193 194 unsigned long async_stack, nodat_stack, mcck_stack; 194 195 struct lowcore *lc; 195 196 196 - if (pcpu != &pcpu_devices[0]) { 197 - pcpu->lowcore = (struct lowcore *) 198 - __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); 199 - nodat_stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); 200 - if (!pcpu->lowcore || !nodat_stack) 201 - goto out; 202 - } else { 203 - nodat_stack = pcpu->lowcore->nodat_stack - STACK_INIT_OFFSET; 204 - } 197 + lc = (struct lowcore *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); 198 + nodat_stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); 205 199 async_stack = stack_alloc(); 206 200 mcck_stack = stack_alloc(); 207 - if (!async_stack || !mcck_stack) 208 - goto out_stack; 209 - lc = pcpu->lowcore; 201 + if (!lc || !nodat_stack || !async_stack || !mcck_stack) 202 + goto out; 210 203 memcpy(lc, &S390_lowcore, 512); 211 204 memset((char *) lc + 512, 0, sizeof(*lc) - 512); 212 205 lc->async_stack = async_stack + STACK_INIT_OFFSET; ··· 211 220 lc->return_lpswe = gen_lpswe(__LC_RETURN_PSW); 212 221 lc->return_mcck_lpswe = gen_lpswe(__LC_RETURN_MCCK_PSW); 213 222 if (nmi_alloc_per_cpu(lc)) 214 - goto out_stack; 223 + goto out; 215 224 lowcore_ptr[cpu] = lc; 216 225 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, (u32)(unsigned long) lc); 217 226 return 0; 218 227 219 - out_stack: 228 + out: 220 229 stack_free(mcck_stack); 221 230 stack_free(async_stack); 222 - out: 223 - if (pcpu != &pcpu_devices[0]) { 224 - free_pages(nodat_stack, THREAD_SIZE_ORDER); 225 - free_pages((unsigned long) pcpu->lowcore, LC_ORDER); 226 - } 231 + free_pages(nodat_stack, THREAD_SIZE_ORDER); 232 + free_pages((unsigned long) lc, LC_ORDER); 227 233 return -ENOMEM; 228 234 } 229 235 230 236 static void pcpu_free_lowcore(struct pcpu *pcpu) 231 237 { 232 - unsigned long async_stack, nodat_stack, mcck_stack, lowcore; 238 + unsigned long async_stack, nodat_stack, mcck_stack; 239 + struct lowcore *lc; 240 + int cpu; 233 241 234 - nodat_stack = pcpu->lowcore->nodat_stack - STACK_INIT_OFFSET; 235 - async_stack = pcpu->lowcore->async_stack - STACK_INIT_OFFSET; 236 - mcck_stack = pcpu->lowcore->mcck_stack - STACK_INIT_OFFSET; 237 - lowcore = (unsigned long) pcpu->lowcore; 238 - 242 + cpu = pcpu - pcpu_devices; 243 + lc = lowcore_ptr[cpu]; 244 + nodat_stack = lc->nodat_stack - STACK_INIT_OFFSET; 245 + async_stack = lc->async_stack - STACK_INIT_OFFSET; 246 + mcck_stack = lc->mcck_stack - STACK_INIT_OFFSET; 239 247 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, 0); 240 - lowcore_ptr[pcpu - pcpu_devices] = NULL; 241 - nmi_free_per_cpu(pcpu->lowcore); 248 + lowcore_ptr[cpu] = NULL; 249 + nmi_free_per_cpu(lc); 242 250 stack_free(async_stack); 243 251 stack_free(mcck_stack); 244 - if (pcpu == &pcpu_devices[0]) 245 - return; 246 252 free_pages(nodat_stack, THREAD_SIZE_ORDER); 247 - free_pages(lowcore, LC_ORDER); 253 + free_pages((unsigned long) lc, LC_ORDER); 248 254 } 249 255 250 256 static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu) 251 257 { 252 - struct lowcore *lc = pcpu->lowcore; 258 + struct lowcore *lc = lowcore_ptr[cpu]; 253 259 254 260 cpumask_set_cpu(cpu, &init_mm.context.cpu_attach_mask); 255 261 cpumask_set_cpu(cpu, mm_cpumask(&init_mm)); ··· 263 275 lc->cregs_save_area[1] = lc->kernel_asce; 264 276 lc->cregs_save_area[7] = lc->user_asce; 265 277 save_access_regs((unsigned int *) lc->access_regs_save_area); 266 - memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list, 267 - sizeof(lc->stfle_fac_list)); 268 - memcpy(lc->alt_stfle_fac_list, S390_lowcore.alt_stfle_fac_list, 269 - sizeof(lc->alt_stfle_fac_list)); 270 278 arch_spin_lock_setup(cpu); 271 279 } 272 280 273 281 static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk) 274 282 { 275 - struct lowcore *lc = pcpu->lowcore; 283 + struct lowcore *lc; 284 + int cpu; 276 285 286 + cpu = pcpu - pcpu_devices; 287 + lc = lowcore_ptr[cpu]; 277 288 lc->kernel_stack = (unsigned long) task_stack_page(tsk) 278 289 + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); 279 290 lc->current_task = (unsigned long) tsk; ··· 288 301 289 302 static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data) 290 303 { 291 - struct lowcore *lc = pcpu->lowcore; 304 + struct lowcore *lc; 305 + int cpu; 292 306 307 + cpu = pcpu - pcpu_devices; 308 + lc = lowcore_ptr[cpu]; 293 309 lc->restart_stack = lc->nodat_stack; 294 310 lc->restart_fn = (unsigned long) func; 295 311 lc->restart_data = (unsigned long) data; ··· 377 387 */ 378 388 void smp_call_ipl_cpu(void (*func)(void *), void *data) 379 389 { 380 - struct lowcore *lc = pcpu_devices->lowcore; 390 + struct lowcore *lc = lowcore_ptr[0]; 381 391 382 392 if (pcpu_devices[0].address == stap()) 383 393 lc = &S390_lowcore; ··· 590 600 591 601 int smp_store_status(int cpu) 592 602 { 593 - struct pcpu *pcpu = pcpu_devices + cpu; 603 + struct lowcore *lc; 604 + struct pcpu *pcpu; 594 605 unsigned long pa; 595 606 596 - pa = __pa(&pcpu->lowcore->floating_pt_save_area); 607 + pcpu = pcpu_devices + cpu; 608 + lc = lowcore_ptr[cpu]; 609 + pa = __pa(&lc->floating_pt_save_area); 597 610 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_STATUS_AT_ADDRESS, 598 611 pa) != SIGP_CC_ORDER_CODE_ACCEPTED) 599 612 return -EIO; 600 613 if (!MACHINE_HAS_VX && !MACHINE_HAS_GS) 601 614 return 0; 602 - pa = __pa(pcpu->lowcore->mcesad & MCESA_ORIGIN_MASK); 615 + pa = __pa(lc->mcesad & MCESA_ORIGIN_MASK); 603 616 if (MACHINE_HAS_GS) 604 - pa |= pcpu->lowcore->mcesad & MCESA_LC_MASK; 617 + pa |= lc->mcesad & MCESA_LC_MASK; 605 618 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_ADDITIONAL_STATUS, 606 619 pa) != SIGP_CC_ORDER_CODE_ACCEPTED) 607 620 return -EIO; ··· 1004 1011 1005 1012 WARN_ON(!cpu_present(0) || !cpu_online(0)); 1006 1013 pcpu->state = CPU_STATE_CONFIGURED; 1007 - pcpu->lowcore = (struct lowcore *)(unsigned long) store_prefix(); 1008 1014 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 1009 1015 smp_cpu_set_polarization(0, POLARIZATION_UNKNOWN); 1010 1016 } ··· 1229 1237 return rc; 1230 1238 } 1231 1239 subsys_initcall(s390_smp_init); 1240 + 1241 + static __always_inline void set_new_lowcore(struct lowcore *lc) 1242 + { 1243 + union register_pair dst, src; 1244 + u32 pfx; 1245 + 1246 + src.even = (unsigned long) &S390_lowcore; 1247 + src.odd = sizeof(S390_lowcore); 1248 + dst.even = (unsigned long) lc; 1249 + dst.odd = sizeof(*lc); 1250 + pfx = (unsigned long) lc; 1251 + 1252 + asm volatile( 1253 + " mvcl %[dst],%[src]\n" 1254 + " spx %[pfx]\n" 1255 + : [dst] "+&d" (dst.pair), [src] "+&d" (src.pair) 1256 + : [pfx] "Q" (pfx) 1257 + : "memory", "cc"); 1258 + } 1259 + 1260 + static int __init smp_reinit_ipl_cpu(void) 1261 + { 1262 + unsigned long async_stack, nodat_stack, mcck_stack; 1263 + struct lowcore *lc, *lc_ipl; 1264 + unsigned long flags; 1265 + 1266 + lc_ipl = lowcore_ptr[0]; 1267 + lc = (struct lowcore *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); 1268 + nodat_stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); 1269 + async_stack = stack_alloc(); 1270 + mcck_stack = stack_alloc(); 1271 + if (!lc || !nodat_stack || !async_stack || !mcck_stack) 1272 + panic("Couldn't allocate memory"); 1273 + 1274 + local_irq_save(flags); 1275 + local_mcck_disable(); 1276 + set_new_lowcore(lc); 1277 + S390_lowcore.nodat_stack = nodat_stack + STACK_INIT_OFFSET; 1278 + S390_lowcore.async_stack = async_stack + STACK_INIT_OFFSET; 1279 + S390_lowcore.mcck_stack = mcck_stack + STACK_INIT_OFFSET; 1280 + lowcore_ptr[0] = lc; 1281 + local_mcck_enable(); 1282 + local_irq_restore(flags); 1283 + 1284 + free_pages(lc_ipl->async_stack - STACK_INIT_OFFSET, THREAD_SIZE_ORDER); 1285 + memblock_free_late(lc_ipl->mcck_stack - STACK_INIT_OFFSET, THREAD_SIZE); 1286 + memblock_free_late((unsigned long) lc_ipl, sizeof(*lc_ipl)); 1287 + 1288 + return 0; 1289 + } 1290 + early_initcall(smp_reinit_ipl_cpu);
+6 -7
arch/s390/kernel/sthyi.c
··· 395 395 396 396 static int sthyi(u64 vaddr, u64 *rc) 397 397 { 398 - register u64 code asm("0") = 0; 399 - register u64 addr asm("2") = vaddr; 400 - register u64 rcode asm("3"); 398 + union register_pair r1 = { .even = 0, }; /* subcode */ 399 + union register_pair r2 = { .even = vaddr, }; 401 400 int cc; 402 401 403 402 asm volatile( 404 - ".insn rre,0xB2560000,%[code],%[addr]\n" 403 + ".insn rre,0xB2560000,%[r1],%[r2]\n" 405 404 "ipm %[cc]\n" 406 405 "srl %[cc],28\n" 407 - : [cc] "=d" (cc), "=d" (rcode) 408 - : [code] "d" (code), [addr] "a" (addr) 406 + : [cc] "=&d" (cc), [r2] "+&d" (r2.pair) 407 + : [r1] "d" (r1.pair) 409 408 : "memory", "cc"); 410 - *rc = rcode; 409 + *rc = r2.odd; 411 410 return cc; 412 411 } 413 412
+1 -4
arch/s390/kernel/syscall.c
··· 144 144 { 145 145 add_random_kstack_offset(); 146 146 enter_from_user_mode(regs); 147 - 148 - memcpy(&regs->gprs[8], S390_lowcore.save_area_sync, 8 * sizeof(unsigned long)); 149 - memcpy(&regs->int_code, &S390_lowcore.svc_ilc, sizeof(regs->int_code)); 150 147 regs->psw = S390_lowcore.svc_old_psw; 151 - 148 + regs->int_code = S390_lowcore.svc_int_code; 152 149 update_timer_sys(); 153 150 154 151 local_irq_enable();
+11 -8
arch/s390/kernel/sysinfo.c
··· 25 25 26 26 static inline int __stsi(void *sysinfo, int fc, int sel1, int sel2, int *lvl) 27 27 { 28 - register int r0 asm("0") = (fc << 28) | sel1; 29 - register int r1 asm("1") = sel2; 28 + int r0 = (fc << 28) | sel1; 30 29 int rc = 0; 31 30 32 31 asm volatile( 33 - " stsi 0(%3)\n" 32 + " lr 0,%[r0]\n" 33 + " lr 1,%[r1]\n" 34 + " stsi 0(%[sysinfo])\n" 34 35 "0: jz 2f\n" 35 - "1: lhi %1,%4\n" 36 - "2:\n" 36 + "1: lhi %[rc],%[retval]\n" 37 + "2: lr %[r0],0\n" 37 38 EX_TABLE(0b, 1b) 38 - : "+d" (r0), "+d" (rc) 39 - : "d" (r1), "a" (sysinfo), "K" (-EOPNOTSUPP) 40 - : "cc", "memory"); 39 + : [r0] "+d" (r0), [rc] "+d" (rc) 40 + : [r1] "d" (sel2), 41 + [sysinfo] "a" (sysinfo), 42 + [retval] "K" (-EOPNOTSUPP) 43 + : "cc", "0", "1", "memory"); 41 44 *lvl = ((unsigned int) r0) >> 28; 42 45 return rc; 43 46 }
+2 -2
arch/s390/kernel/traps.c
··· 36 36 unsigned long address; 37 37 38 38 if (regs->int_code & 0x200) 39 - address = *(unsigned long *)(current->thread.trap_tdb + 24); 39 + address = current->thread.trap_tdb.data[3]; 40 40 else 41 41 address = regs->psw.addr; 42 42 return (void __user *) (address - (regs->int_code >> 16)); ··· 318 318 319 319 if (S390_lowcore.pgm_code & 0x0200) { 320 320 /* transaction abort */ 321 - memcpy(&current->thread.trap_tdb, &S390_lowcore.pgm_tdb, 256); 321 + current->thread.trap_tdb = S390_lowcore.pgm_tdb; 322 322 } 323 323 324 324 if (S390_lowcore.pgm_code & PGM_INT_CODE_PER) {
+1 -7
arch/s390/kernel/uv.c
··· 52 52 unsigned long uv_stor_base; 53 53 54 54 /* 55 - * keep these conditions in line with kasan init code has_uv_sec_stor_limit() 55 + * keep these conditions in line with has_uv_sec_stor_limit() 56 56 */ 57 57 if (!is_prot_virt_host()) 58 58 return; ··· 89 89 fail: 90 90 pr_info("Disabling support for protected virtualization"); 91 91 prot_virt_host = 0; 92 - } 93 - 94 - void adjust_to_uv_max(unsigned long *vmax) 95 - { 96 - if (uv_info.max_sec_stor_addr) 97 - *vmax = min_t(unsigned long, *vmax, uv_info.max_sec_stor_addr); 98 92 } 99 93 100 94 /*
+6 -6
arch/s390/kvm/kvm-s390.c
··· 234 234 BUILD_BUG_ON(SIZE_INTERNAL > S390_ARCH_FAC_MASK_SIZE_U64); 235 235 BUILD_BUG_ON(SIZE_INTERNAL > S390_ARCH_FAC_LIST_SIZE_U64); 236 236 BUILD_BUG_ON(SIZE_INTERNAL * sizeof(unsigned long) > 237 - sizeof(S390_lowcore.stfle_fac_list)); 237 + sizeof(stfle_fac_list)); 238 238 239 239 return SIZE_INTERNAL; 240 240 } ··· 1482 1482 mach->ibc = sclp.ibc; 1483 1483 memcpy(&mach->fac_mask, kvm->arch.model.fac_mask, 1484 1484 S390_ARCH_FAC_LIST_SIZE_BYTE); 1485 - memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list, 1486 - sizeof(S390_lowcore.stfle_fac_list)); 1485 + memcpy((unsigned long *)&mach->fac_list, stfle_fac_list, 1486 + sizeof(stfle_fac_list)); 1487 1487 VM_EVENT(kvm, 3, "GET: host ibc: 0x%4.4x, host cpuid: 0x%16.16llx", 1488 1488 kvm->arch.model.ibc, 1489 1489 kvm->arch.model.cpuid); ··· 2707 2707 kvm->arch.model.fac_list = kvm->arch.sie_page2->fac_list; 2708 2708 2709 2709 for (i = 0; i < kvm_s390_fac_size(); i++) { 2710 - kvm->arch.model.fac_mask[i] = S390_lowcore.stfle_fac_list[i] & 2710 + kvm->arch.model.fac_mask[i] = stfle_fac_list[i] & 2711 2711 (kvm_s390_fac_base[i] | 2712 2712 kvm_s390_fac_ext[i]); 2713 - kvm->arch.model.fac_list[i] = S390_lowcore.stfle_fac_list[i] & 2713 + kvm->arch.model.fac_list[i] = stfle_fac_list[i] & 2714 2714 kvm_s390_fac_base[i]; 2715 2715 } 2716 2716 kvm->arch.model.subfuncs = kvm_s390_available_subfunc; ··· 5079 5079 5080 5080 for (i = 0; i < 16; i++) 5081 5081 kvm_s390_fac_base[i] |= 5082 - S390_lowcore.stfle_fac_list[i] & nonhyp_mask(i); 5082 + stfle_fac_list[i] & nonhyp_mask(i); 5083 5083 5084 5084 return kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); 5085 5085 }
+74 -55
arch/s390/lib/string.c
··· 18 18 */ 19 19 static inline char *__strend(const char *s) 20 20 { 21 - register unsigned long r0 asm("0") = 0; 21 + unsigned long e = 0; 22 22 23 - asm volatile ("0: srst %0,%1\n" 24 - " jo 0b" 25 - : "+d" (r0), "+a" (s) : : "cc", "memory"); 26 - return (char *) r0; 23 + asm volatile( 24 + " lghi 0,0\n" 25 + "0: srst %[e],%[s]\n" 26 + " jo 0b\n" 27 + : [e] "+&a" (e), [s] "+&a" (s) 28 + : 29 + : "cc", "memory", "0"); 30 + return (char *)e; 27 31 } 28 32 29 33 static inline char *__strnend(const char *s, size_t n) 30 34 { 31 - register unsigned long r0 asm("0") = 0; 32 35 const char *p = s + n; 33 36 34 - asm volatile ("0: srst %0,%1\n" 35 - " jo 0b" 36 - : "+d" (p), "+a" (s) : "d" (r0) : "cc", "memory"); 37 - return (char *) p; 37 + asm volatile( 38 + " lghi 0,0\n" 39 + "0: srst %[p],%[s]\n" 40 + " jo 0b\n" 41 + : [p] "+&d" (p), [s] "+&a" (s) 42 + : 43 + : "cc", "memory", "0"); 44 + return (char *)p; 38 45 } 39 46 40 47 /** ··· 83 76 #ifdef __HAVE_ARCH_STRCPY 84 77 char *strcpy(char *dest, const char *src) 85 78 { 86 - register int r0 asm("0") = 0; 87 79 char *ret = dest; 88 80 89 - asm volatile ("0: mvst %0,%1\n" 90 - " jo 0b" 91 - : "+&a" (dest), "+&a" (src) : "d" (r0) 92 - : "cc", "memory" ); 81 + asm volatile( 82 + " lghi 0,0\n" 83 + "0: mvst %[dest],%[src]\n" 84 + " jo 0b\n" 85 + : [dest] "+&a" (dest), [src] "+&a" (src) 86 + : 87 + : "cc", "memory", "0"); 93 88 return ret; 94 89 } 95 90 EXPORT_SYMBOL(strcpy); ··· 153 144 #ifdef __HAVE_ARCH_STRCAT 154 145 char *strcat(char *dest, const char *src) 155 146 { 156 - register int r0 asm("0") = 0; 157 - unsigned long dummy; 147 + unsigned long dummy = 0; 158 148 char *ret = dest; 159 149 160 - asm volatile ("0: srst %0,%1\n" 161 - " jo 0b\n" 162 - "1: mvst %0,%2\n" 163 - " jo 1b" 164 - : "=&a" (dummy), "+a" (dest), "+a" (src) 165 - : "d" (r0), "0" (0UL) : "cc", "memory" ); 150 + asm volatile( 151 + " lghi 0,0\n" 152 + "0: srst %[dummy],%[dest]\n" 153 + " jo 0b\n" 154 + "1: mvst %[dummy],%[src]\n" 155 + " jo 1b\n" 156 + : [dummy] "=&a" (dummy), [dest] "+&a" (dest), [src] "+&a" (src) 157 + : 158 + : "cc", "memory", "0"); 166 159 return ret; 167 160 } 168 161 EXPORT_SYMBOL(strcat); ··· 232 221 #ifdef __HAVE_ARCH_STRCMP 233 222 int strcmp(const char *s1, const char *s2) 234 223 { 235 - register int r0 asm("0") = 0; 236 224 int ret = 0; 237 225 238 - asm volatile ("0: clst %2,%3\n" 239 - " jo 0b\n" 240 - " je 1f\n" 241 - " ic %0,0(%2)\n" 242 - " ic %1,0(%3)\n" 243 - " sr %0,%1\n" 244 - "1:" 245 - : "+d" (ret), "+d" (r0), "+a" (s1), "+a" (s2) 246 - : : "cc", "memory"); 226 + asm volatile( 227 + " lghi 0,0\n" 228 + "0: clst %[s1],%[s2]\n" 229 + " jo 0b\n" 230 + " je 1f\n" 231 + " ic %[ret],0(%[s1])\n" 232 + " ic 0,0(%[s2])\n" 233 + " sr %[ret],0\n" 234 + "1:" 235 + : [ret] "+&d" (ret), [s1] "+&a" (s1), [s2] "+&a" (s2) 236 + : 237 + : "cc", "memory", "0"); 247 238 return ret; 248 239 } 249 240 EXPORT_SYMBOL(strcmp); ··· 274 261 static inline int clcle(const char *s1, unsigned long l1, 275 262 const char *s2, unsigned long l2) 276 263 { 277 - register unsigned long r2 asm("2") = (unsigned long) s1; 278 - register unsigned long r3 asm("3") = (unsigned long) l1; 279 - register unsigned long r4 asm("4") = (unsigned long) s2; 280 - register unsigned long r5 asm("5") = (unsigned long) l2; 264 + union register_pair r1 = { .even = (unsigned long)s1, .odd = l1, }; 265 + union register_pair r3 = { .even = (unsigned long)s2, .odd = l2, }; 281 266 int cc; 282 267 283 - asm volatile ("0: clcle %1,%3,0\n" 284 - " jo 0b\n" 285 - " ipm %0\n" 286 - " srl %0,28" 287 - : "=&d" (cc), "+a" (r2), "+a" (r3), 288 - "+a" (r4), "+a" (r5) : : "cc", "memory"); 268 + asm volatile( 269 + "0: clcle %[r1],%[r3],0\n" 270 + " jo 0b\n" 271 + " ipm %[cc]\n" 272 + " srl %[cc],28\n" 273 + : [cc] "=&d" (cc), [r1] "+&d" (r1.pair), [r3] "+&d" (r3.pair) 274 + : 275 + : "cc", "memory"); 289 276 return cc; 290 277 } 291 278 ··· 328 315 #ifdef __HAVE_ARCH_MEMCHR 329 316 void *memchr(const void *s, int c, size_t n) 330 317 { 331 - register int r0 asm("0") = (char) c; 332 318 const void *ret = s + n; 333 319 334 - asm volatile ("0: srst %0,%1\n" 335 - " jo 0b\n" 336 - " jl 1f\n" 337 - " la %0,0\n" 338 - "1:" 339 - : "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory"); 320 + asm volatile( 321 + " lgr 0,%[c]\n" 322 + "0: srst %[ret],%[s]\n" 323 + " jo 0b\n" 324 + " jl 1f\n" 325 + " la %[ret],0\n" 326 + "1:" 327 + : [ret] "+&a" (ret), [s] "+&a" (s) 328 + : [c] "d" (c) 329 + : "cc", "memory", "0"); 340 330 return (void *) ret; 341 331 } 342 332 EXPORT_SYMBOL(memchr); ··· 376 360 #ifdef __HAVE_ARCH_MEMSCAN 377 361 void *memscan(void *s, int c, size_t n) 378 362 { 379 - register int r0 asm("0") = (char) c; 380 363 const void *ret = s + n; 381 364 382 - asm volatile ("0: srst %0,%1\n" 383 - " jo 0b\n" 384 - : "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory"); 385 - return (void *) ret; 365 + asm volatile( 366 + " lgr 0,%[c]\n" 367 + "0: srst %[ret],%[s]\n" 368 + " jo 0b\n" 369 + : [ret] "+&a" (ret), [s] "+&a" (s) 370 + : [c] "d" (c) 371 + : "cc", "memory", "0"); 372 + return (void *)ret; 386 373 } 387 374 EXPORT_SYMBOL(memscan); 388 375 #endif
+15 -10
arch/s390/lib/uaccess.c
··· 61 61 static inline unsigned long copy_from_user_mvcos(void *x, const void __user *ptr, 62 62 unsigned long size) 63 63 { 64 - register unsigned long reg0 asm("0") = 0x81UL; 65 64 unsigned long tmp1, tmp2; 66 65 67 66 tmp1 = -4096UL; 68 67 asm volatile( 68 + " lghi 0,%[spec]\n" 69 69 "0: .insn ss,0xc80000000000,0(%0,%2),0(%1),0\n" 70 70 "6: jz 4f\n" 71 71 "1: algr %0,%3\n" ··· 84 84 "5:\n" 85 85 EX_TABLE(0b,2b) EX_TABLE(3b,5b) EX_TABLE(6b,2b) EX_TABLE(7b,5b) 86 86 : "+a" (size), "+a" (ptr), "+a" (x), "+a" (tmp1), "=a" (tmp2) 87 - : "d" (reg0) : "cc", "memory"); 87 + : [spec] "K" (0x81UL) 88 + : "cc", "memory", "0"); 88 89 return size; 89 90 } 90 91 ··· 134 133 static inline unsigned long copy_to_user_mvcos(void __user *ptr, const void *x, 135 134 unsigned long size) 136 135 { 137 - register unsigned long reg0 asm("0") = 0x810000UL; 138 136 unsigned long tmp1, tmp2; 139 137 140 138 tmp1 = -4096UL; 141 139 asm volatile( 140 + " llilh 0,%[spec]\n" 142 141 "0: .insn ss,0xc80000000000,0(%0,%1),0(%2),0\n" 143 142 "6: jz 4f\n" 144 143 "1: algr %0,%3\n" ··· 157 156 "5:\n" 158 157 EX_TABLE(0b,2b) EX_TABLE(3b,5b) EX_TABLE(6b,2b) EX_TABLE(7b,5b) 159 158 : "+a" (size), "+a" (ptr), "+a" (x), "+a" (tmp1), "=a" (tmp2) 160 - : "d" (reg0) : "cc", "memory"); 159 + : [spec] "K" (0x81UL) 160 + : "cc", "memory", "0"); 161 161 return size; 162 162 } 163 163 ··· 207 205 static inline unsigned long copy_in_user_mvcos(void __user *to, const void __user *from, 208 206 unsigned long size) 209 207 { 210 - register unsigned long reg0 asm("0") = 0x810081UL; 211 208 unsigned long tmp1, tmp2; 212 209 213 210 tmp1 = -4096UL; 214 211 /* FIXME: copy with reduced length. */ 215 212 asm volatile( 213 + " lgr 0,%[spec]\n" 216 214 "0: .insn ss,0xc80000000000,0(%0,%1),0(%2),0\n" 217 215 " jz 2f\n" 218 216 "1: algr %0,%3\n" ··· 223 221 "3: \n" 224 222 EX_TABLE(0b,3b) 225 223 : "+a" (size), "+a" (to), "+a" (from), "+a" (tmp1), "=a" (tmp2) 226 - : "d" (reg0) : "cc", "memory"); 224 + : [spec] "d" (0x810081UL) 225 + : "cc", "memory"); 227 226 return size; 228 227 } 229 228 ··· 269 266 270 267 static inline unsigned long clear_user_mvcos(void __user *to, unsigned long size) 271 268 { 272 - register unsigned long reg0 asm("0") = 0x810000UL; 273 269 unsigned long tmp1, tmp2; 274 270 275 271 tmp1 = -4096UL; 276 272 asm volatile( 273 + " llilh 0,%[spec]\n" 277 274 "0: .insn ss,0xc80000000000,0(%0,%1),0(%4),0\n" 278 275 " jz 4f\n" 279 276 "1: algr %0,%2\n" ··· 291 288 "5:\n" 292 289 EX_TABLE(0b,2b) EX_TABLE(3b,5b) 293 290 : "+a" (size), "+a" (to), "+a" (tmp1), "=a" (tmp2) 294 - : "a" (empty_zero_page), "d" (reg0) : "cc", "memory"); 291 + : "a" (empty_zero_page), [spec] "K" (0x81UL) 292 + : "cc", "memory", "0"); 295 293 return size; 296 294 } 297 295 ··· 342 338 static inline unsigned long strnlen_user_srst(const char __user *src, 343 339 unsigned long size) 344 340 { 345 - register unsigned long reg0 asm("0") = 0; 346 341 unsigned long tmp1, tmp2; 347 342 348 343 asm volatile( 344 + " lghi 0,0\n" 349 345 " la %2,0(%1)\n" 350 346 " la %3,0(%0,%1)\n" 351 347 " slgr %0,%0\n" ··· 357 353 "1: sacf 768\n" 358 354 EX_TABLE(0b,1b) 359 355 : "+a" (size), "+a" (src), "=a" (tmp1), "=a" (tmp2) 360 - : "d" (reg0) : "cc", "memory"); 356 + : 357 + : "cc", "memory", "0"); 361 358 return size; 362 359 } 363 360
+1 -4
arch/s390/lib/xor.c
··· 91 91 static void xor_xc_5(unsigned long bytes, unsigned long *p1, unsigned long *p2, 92 92 unsigned long *p3, unsigned long *p4, unsigned long *p5) 93 93 { 94 - /* Get around a gcc oddity */ 95 - register unsigned long *reg7 asm ("7") = p5; 96 - 97 94 asm volatile( 98 95 " larl 1,2f\n" 99 96 " aghi %0,-1\n" ··· 119 122 " xc 0(1,%1),0(%5)\n" 120 123 "3:\n" 121 124 : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4), 122 - "+a" (reg7) 125 + "+a" (p5) 123 126 : : "0", "1", "cc", "memory"); 124 127 } 125 128
+6 -29
arch/s390/mm/kasan_init.c
··· 13 13 #include <asm/setup.h> 14 14 #include <asm/uv.h> 15 15 16 - unsigned long kasan_vmax; 17 16 static unsigned long segment_pos __initdata; 18 17 static unsigned long segment_low __initdata; 19 18 static unsigned long pgalloc_pos __initdata; ··· 250 251 } 251 252 } 252 253 253 - static bool __init has_uv_sec_stor_limit(void) 254 - { 255 - /* 256 - * keep these conditions in line with setup_uv() 257 - */ 258 - if (!is_prot_virt_host()) 259 - return false; 260 - 261 - if (is_prot_virt_guest()) 262 - return false; 263 - 264 - if (!test_facility(158)) 265 - return false; 266 - 267 - return !!uv_info.max_sec_stor_addr; 268 - } 269 - 270 254 void __init kasan_early_init(void) 271 255 { 272 - unsigned long untracked_mem_end; 273 256 unsigned long shadow_alloc_size; 274 - unsigned long vmax_unlimited; 275 257 unsigned long initrd_end; 276 258 unsigned long memsize; 277 259 unsigned long pgt_prot = pgprot_val(PAGE_KERNEL_RO); ··· 286 306 BUILD_BUG_ON(!IS_ALIGNED(KASAN_SHADOW_START, P4D_SIZE)); 287 307 BUILD_BUG_ON(!IS_ALIGNED(KASAN_SHADOW_END, P4D_SIZE)); 288 308 crst_table_init((unsigned long *)early_pg_dir, _REGION2_ENTRY_EMPTY); 289 - untracked_mem_end = kasan_vmax = vmax_unlimited = _REGION1_SIZE; 290 - if (has_uv_sec_stor_limit()) 291 - kasan_vmax = min(vmax_unlimited, uv_info.max_sec_stor_addr); 292 309 293 310 /* init kasan zero shadow */ 294 311 crst_table_init((unsigned long *)kasan_early_shadow_p4d, ··· 352 375 */ 353 376 /* populate kasan shadow (for identity mapping and zero page mapping) */ 354 377 kasan_early_pgtable_populate(__sha(0), __sha(memsize), POPULATE_MAP); 355 - if (IS_ENABLED(CONFIG_MODULES)) 356 - untracked_mem_end = kasan_vmax - MODULES_LEN; 357 378 if (IS_ENABLED(CONFIG_KASAN_VMALLOC)) { 358 - untracked_mem_end = kasan_vmax - vmalloc_size - MODULES_LEN; 359 379 /* shallowly populate kasan shadow for vmalloc and modules */ 360 - kasan_early_pgtable_populate(__sha(untracked_mem_end), __sha(kasan_vmax), 380 + kasan_early_pgtable_populate(__sha(VMALLOC_START), __sha(MODULES_END), 361 381 POPULATE_SHALLOW); 362 382 } 363 383 /* populate kasan shadow for untracked memory */ 364 - kasan_early_pgtable_populate(__sha(ident_map_size), __sha(untracked_mem_end), 384 + kasan_early_pgtable_populate(__sha(ident_map_size), 385 + IS_ENABLED(CONFIG_KASAN_VMALLOC) ? 386 + __sha(VMALLOC_START) : 387 + __sha(MODULES_VADDR), 365 388 POPULATE_ZERO_SHADOW); 366 - kasan_early_pgtable_populate(__sha(kasan_vmax), __sha(vmax_unlimited), 389 + kasan_early_pgtable_populate(__sha(MODULES_END), __sha(_REGION1_SIZE), 367 390 POPULATE_ZERO_SHADOW); 368 391 /* memory allocated for identity mapping structs will be freed later */ 369 392 pgalloc_freeable = pgalloc_pos;
+9 -10
arch/s390/mm/maccess.c
··· 79 79 80 80 static int __no_sanitize_address __memcpy_real(void *dest, void *src, size_t count) 81 81 { 82 - register unsigned long _dest asm("2") = (unsigned long) dest; 83 - register unsigned long _len1 asm("3") = (unsigned long) count; 84 - register unsigned long _src asm("4") = (unsigned long) src; 85 - register unsigned long _len2 asm("5") = (unsigned long) count; 82 + union register_pair _dst, _src; 86 83 int rc = -EFAULT; 87 84 85 + _dst.even = (unsigned long) dest; 86 + _dst.odd = (unsigned long) count; 87 + _src.even = (unsigned long) src; 88 + _src.odd = (unsigned long) count; 88 89 asm volatile ( 89 - "0: mvcle %1,%2,0x0\n" 90 + "0: mvcle %[dst],%[src],0\n" 90 91 "1: jo 0b\n" 91 - " lhi %0,0x0\n" 92 + " lhi %[rc],0\n" 92 93 "2:\n" 93 94 EX_TABLE(1b,2b) 94 - : "+d" (rc), "+d" (_dest), "+d" (_src), "+d" (_len1), 95 - "+d" (_len2), "=m" (*((long *) dest)) 96 - : "m" (*((long *) src)) 97 - : "cc", "memory"); 95 + : [rc] "+&d" (rc), [dst] "+&d" (_dst.pair), [src] "+&d" (_src.pair) 96 + : : "cc", "memory"); 98 97 return rc; 99 98 } 100 99
+6 -6
arch/s390/mm/page-states.c
··· 31 31 32 32 static inline int cmma_test_essa(void) 33 33 { 34 - register unsigned long tmp asm("0") = 0; 35 - register int rc asm("1"); 34 + unsigned long tmp = 0; 35 + int rc = -EOPNOTSUPP; 36 36 37 37 /* test ESSA_GET_STATE */ 38 38 asm volatile( 39 - " .insn rrf,0xb9ab0000,%1,%1,%2,0\n" 40 - "0: la %0,0\n" 39 + " .insn rrf,0xb9ab0000,%[tmp],%[tmp],%[cmd],0\n" 40 + "0: la %[rc],0\n" 41 41 "1:\n" 42 42 EX_TABLE(0b,1b) 43 - : "=&d" (rc), "+&d" (tmp) 44 - : "i" (ESSA_GET_STATE), "0" (-EOPNOTSUPP)); 43 + : [rc] "+&d" (rc), [tmp] "+&d" (tmp) 44 + : [cmd] "i" (ESSA_GET_STATE)); 45 45 return rc; 46 46 } 47 47
+24 -31
arch/s390/pci/pci_insn.c
··· 63 63 /* Refresh PCI Translations */ 64 64 static inline u8 __rpcit(u64 fn, u64 addr, u64 range, u8 *status) 65 65 { 66 - register u64 __addr asm("2") = addr; 67 - register u64 __range asm("3") = range; 66 + union register_pair addr_range = {.even = addr, .odd = range}; 68 67 u8 cc; 69 68 70 69 asm volatile ( 71 - " .insn rre,0xb9d30000,%[fn],%[addr]\n" 70 + " .insn rre,0xb9d30000,%[fn],%[addr_range]\n" 72 71 " ipm %[cc]\n" 73 72 " srl %[cc],28\n" 74 73 : [cc] "=d" (cc), [fn] "+d" (fn) 75 - : [addr] "d" (__addr), "d" (__range) 74 + : [addr_range] "d" (addr_range.pair) 76 75 : "cc"); 77 76 *status = fn >> 24 & 0xff; 78 77 return cc; ··· 112 113 /* PCI Load */ 113 114 static inline int ____pcilg(u64 *data, u64 req, u64 offset, u8 *status) 114 115 { 115 - register u64 __req asm("2") = req; 116 - register u64 __offset asm("3") = offset; 116 + union register_pair req_off = {.even = req, .odd = offset}; 117 117 int cc = -ENXIO; 118 118 u64 __data; 119 119 120 120 asm volatile ( 121 - " .insn rre,0xb9d20000,%[data],%[req]\n" 121 + " .insn rre,0xb9d20000,%[data],%[req_off]\n" 122 122 "0: ipm %[cc]\n" 123 123 " srl %[cc],28\n" 124 124 "1:\n" 125 125 EX_TABLE(0b, 1b) 126 - : [cc] "+d" (cc), [data] "=d" (__data), [req] "+d" (__req) 127 - : "d" (__offset) 128 - : "cc"); 129 - *status = __req >> 24 & 0xff; 126 + : [cc] "+d" (cc), [data] "=d" (__data), 127 + [req_off] "+&d" (req_off.pair) :: "cc"); 128 + *status = req_off.even >> 24 & 0xff; 130 129 *data = __data; 131 130 return cc; 132 131 } ··· 170 173 171 174 static inline int __pcilg_mio(u64 *data, u64 ioaddr, u64 len, u8 *status) 172 175 { 173 - register u64 addr asm("2") = ioaddr; 174 - register u64 r3 asm("3") = len; 176 + union register_pair ioaddr_len = {.even = ioaddr, .odd = len}; 175 177 int cc = -ENXIO; 176 178 u64 __data; 177 179 178 180 asm volatile ( 179 - " .insn rre,0xb9d60000,%[data],%[ioaddr]\n" 181 + " .insn rre,0xb9d60000,%[data],%[ioaddr_len]\n" 180 182 "0: ipm %[cc]\n" 181 183 " srl %[cc],28\n" 182 184 "1:\n" 183 185 EX_TABLE(0b, 1b) 184 - : [cc] "+d" (cc), [data] "=d" (__data), "+d" (r3) 185 - : [ioaddr] "d" (addr) 186 - : "cc"); 187 - *status = r3 >> 24 & 0xff; 186 + : [cc] "+d" (cc), [data] "=d" (__data), 187 + [ioaddr_len] "+&d" (ioaddr_len.pair) :: "cc"); 188 + *status = ioaddr_len.odd >> 24 & 0xff; 188 189 *data = __data; 189 190 return cc; 190 191 } ··· 206 211 /* PCI Store */ 207 212 static inline int __pcistg(u64 data, u64 req, u64 offset, u8 *status) 208 213 { 209 - register u64 __req asm("2") = req; 210 - register u64 __offset asm("3") = offset; 214 + union register_pair req_off = {.even = req, .odd = offset}; 211 215 int cc = -ENXIO; 212 216 213 217 asm volatile ( 214 - " .insn rre,0xb9d00000,%[data],%[req]\n" 218 + " .insn rre,0xb9d00000,%[data],%[req_off]\n" 215 219 "0: ipm %[cc]\n" 216 220 " srl %[cc],28\n" 217 221 "1:\n" 218 222 EX_TABLE(0b, 1b) 219 - : [cc] "+d" (cc), [req] "+d" (__req) 220 - : "d" (__offset), [data] "d" (data) 223 + : [cc] "+d" (cc), [req_off] "+&d" (req_off.pair) 224 + : [data] "d" (data) 221 225 : "cc"); 222 - *status = __req >> 24 & 0xff; 226 + *status = req_off.even >> 24 & 0xff; 223 227 return cc; 224 228 } 225 229 ··· 251 257 252 258 static inline int __pcistg_mio(u64 data, u64 ioaddr, u64 len, u8 *status) 253 259 { 254 - register u64 addr asm("2") = ioaddr; 255 - register u64 r3 asm("3") = len; 260 + union register_pair ioaddr_len = {.even = ioaddr, .odd = len}; 256 261 int cc = -ENXIO; 257 262 258 263 asm volatile ( 259 - " .insn rre,0xb9d40000,%[data],%[ioaddr]\n" 264 + " .insn rre,0xb9d40000,%[data],%[ioaddr_len]\n" 260 265 "0: ipm %[cc]\n" 261 266 " srl %[cc],28\n" 262 267 "1:\n" 263 268 EX_TABLE(0b, 1b) 264 - : [cc] "+d" (cc), "+d" (r3) 265 - : [data] "d" (data), [ioaddr] "d" (addr) 266 - : "cc"); 267 - *status = r3 >> 24 & 0xff; 269 + : [cc] "+d" (cc), [ioaddr_len] "+&d" (ioaddr_len.pair) 270 + : [data] "d" (data) 271 + : "cc", "memory"); 272 + *status = ioaddr_len.odd >> 24 & 0xff; 268 273 return cc; 269 274 } 270 275
+36 -10
arch/s390/pci/pci_irq.c
··· 35 35 */ 36 36 static struct airq_iv **zpci_ibv; 37 37 38 - /* Modify PCI: Register adapter interruptions */ 38 + /* Modify PCI: Register floating adapter interruptions */ 39 39 static int zpci_set_airq(struct zpci_dev *zdev) 40 40 { 41 41 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT); ··· 53 53 return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; 54 54 } 55 55 56 - /* Modify PCI: Unregister adapter interruptions */ 56 + /* Modify PCI: Unregister floating adapter interruptions */ 57 57 static int zpci_clear_airq(struct zpci_dev *zdev) 58 58 { 59 59 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_DEREG_INT); ··· 96 96 cc = 0; 97 97 98 98 return cc ? -EIO : 0; 99 + } 100 + 101 + /* Register adapter interruptions */ 102 + int zpci_set_irq(struct zpci_dev *zdev) 103 + { 104 + int rc; 105 + 106 + if (irq_delivery == DIRECTED) 107 + rc = zpci_set_directed_irq(zdev); 108 + else 109 + rc = zpci_set_airq(zdev); 110 + 111 + if (!rc) 112 + zdev->irqs_registered = 1; 113 + 114 + return rc; 115 + } 116 + 117 + /* Clear adapter interruptions */ 118 + int zpci_clear_irq(struct zpci_dev *zdev) 119 + { 120 + int rc; 121 + 122 + if (irq_delivery == DIRECTED) 123 + rc = zpci_clear_directed_irq(zdev); 124 + else 125 + rc = zpci_clear_airq(zdev); 126 + 127 + if (!rc) 128 + zdev->irqs_registered = 0; 129 + 130 + return rc; 99 131 } 100 132 101 133 static int zpci_set_irq_affinity(struct irq_data *data, const struct cpumask *dest, ··· 343 311 zdev->msi_first_bit = bit; 344 312 zdev->msi_nr_irqs = msi_vecs; 345 313 346 - if (irq_delivery == DIRECTED) 347 - rc = zpci_set_directed_irq(zdev); 348 - else 349 - rc = zpci_set_airq(zdev); 314 + rc = zpci_set_irq(zdev); 350 315 if (rc) 351 316 return rc; 352 317 ··· 357 328 int rc; 358 329 359 330 /* Disable interrupts */ 360 - if (irq_delivery == DIRECTED) 361 - rc = zpci_clear_directed_irq(zdev); 362 - else 363 - rc = zpci_clear_airq(zdev); 331 + rc = zpci_clear_irq(zdev); 364 332 if (rc) 365 333 return; 366 334
+10 -14
arch/s390/pci/pci_mmio.c
··· 49 49 void __iomem *ioaddr, const void __user *src, 50 50 u64 ulen, u8 *status) 51 51 { 52 - register u64 addr asm("2") = (u64 __force) ioaddr; 53 - register u64 len asm("3") = ulen; 52 + union register_pair ioaddr_len = {.even = (u64 __force)ioaddr, .odd = ulen}; 54 53 int cc = -ENXIO; 55 54 u64 val = 0; 56 55 u64 cnt = ulen; ··· 67 68 " aghi %[src],1\n" 68 69 " ogr %[val],%[tmp]\n" 69 70 " brctg %[cnt],0b\n" 70 - "1: .insn rre,0xb9d40000,%[val],%[ioaddr]\n" 71 + "1: .insn rre,0xb9d40000,%[val],%[ioaddr_len]\n" 71 72 "2: ipm %[cc]\n" 72 73 " srl %[cc],28\n" 73 74 "3: sacf 768\n" ··· 75 76 : 76 77 [src] "+a" (src), [cnt] "+d" (cnt), 77 78 [val] "+d" (val), [tmp] "=d" (tmp), 78 - [len] "+d" (len), [cc] "+d" (cc), 79 - [ioaddr] "+a" (addr) 79 + [cc] "+d" (cc), [ioaddr_len] "+&d" (ioaddr_len.pair) 80 80 :: "cc", "memory"); 81 - *status = len >> 24 & 0xff; 81 + *status = ioaddr_len.odd >> 24 & 0xff; 82 82 83 83 /* did we read everything from user memory? */ 84 84 if (!cc && cnt != 0) ··· 193 195 void __user *dst, const void __iomem *ioaddr, 194 196 u64 ulen, u8 *status) 195 197 { 196 - register u64 addr asm("2") = (u64 __force) ioaddr; 197 - register u64 len asm("3") = ulen; 198 + union register_pair ioaddr_len = {.even = (u64 __force)ioaddr, .odd = ulen}; 198 199 u64 cnt = ulen; 199 200 int shift = ulen * 8; 200 201 int cc = -ENXIO; ··· 206 209 */ 207 210 asm volatile ( 208 211 " sacf 256\n" 209 - "0: .insn rre,0xb9d60000,%[val],%[ioaddr]\n" 212 + "0: .insn rre,0xb9d60000,%[val],%[ioaddr_len]\n" 210 213 "1: ipm %[cc]\n" 211 214 " srl %[cc],28\n" 212 215 " ltr %[cc],%[cc]\n" ··· 219 222 "4: sacf 768\n" 220 223 EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b) 221 224 : 222 - [cc] "+d" (cc), [val] "=d" (val), [len] "+d" (len), 225 + [ioaddr_len] "+&d" (ioaddr_len.pair), 226 + [cc] "+d" (cc), [val] "=d" (val), 223 227 [dst] "+a" (dst), [cnt] "+d" (cnt), [tmp] "=d" (tmp), 224 228 [shift] "+d" (shift) 225 - : 226 - [ioaddr] "a" (addr) 227 - : "cc", "memory"); 229 + :: "cc", "memory"); 228 230 229 231 /* did we write everything to the user space buffer? */ 230 232 if (!cc && cnt != 0) 231 233 cc = -EFAULT; 232 234 233 - *status = len >> 24 & 0xff; 235 + *status = ioaddr_len.odd >> 24 & 0xff; 234 236 return cc; 235 237 } 236 238
+1
arch/s390/purgatory/Makefile
··· 24 24 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare 25 25 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding 26 26 KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common 27 + KBUILD_CFLAGS += -fno-stack-protector 27 28 KBUILD_CFLAGS += $(CLANG_FLAGS) 28 29 KBUILD_CFLAGS += $(call cc-option,-fno-PIE) 29 30 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
+10 -11
drivers/s390/block/dasd_diag.c
··· 69 69 * resulting condition code and DIAG return code. */ 70 70 static inline int __dia250(void *iob, int cmd) 71 71 { 72 - register unsigned long reg2 asm ("2") = (unsigned long) iob; 72 + union register_pair rx = { .even = (unsigned long)iob, }; 73 73 typedef union { 74 74 struct dasd_diag_init_io init_io; 75 75 struct dasd_diag_rw_io rw_io; 76 76 } addr_type; 77 - int rc; 77 + int cc; 78 78 79 - rc = 3; 79 + cc = 3; 80 80 asm volatile( 81 - " diag 2,%2,0x250\n" 82 - "0: ipm %0\n" 83 - " srl %0,28\n" 84 - " or %0,3\n" 81 + " diag %[rx],%[cmd],0x250\n" 82 + "0: ipm %[cc]\n" 83 + " srl %[cc],28\n" 85 84 "1:\n" 86 85 EX_TABLE(0b,1b) 87 - : "+d" (rc), "=m" (*(addr_type *) iob) 88 - : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob) 89 - : "3", "cc"); 90 - return rc; 86 + : [cc] "+&d" (cc), [rx] "+&d" (rx.pair), "+m" (*(addr_type *)iob) 87 + : [cmd] "d" (cmd) 88 + : "cc"); 89 + return cc | rx.odd; 91 90 } 92 91 93 92 static inline int dia250(void *iob, int cmd)
+3 -103
drivers/s390/block/dcssblk.c
··· 17 17 #include <linux/blkdev.h> 18 18 #include <linux/completion.h> 19 19 #include <linux/interrupt.h> 20 - #include <linux/platform_device.h> 21 20 #include <linux/pfn_t.h> 22 21 #include <linux/uio.h> 23 22 #include <linux/dax.h> ··· 983 984 } 984 985 985 986 /* 986 - * Suspend / Resume 987 - */ 988 - static int dcssblk_freeze(struct device *dev) 989 - { 990 - struct dcssblk_dev_info *dev_info; 991 - int rc = 0; 992 - 993 - list_for_each_entry(dev_info, &dcssblk_devices, lh) { 994 - switch (dev_info->segment_type) { 995 - case SEG_TYPE_SR: 996 - case SEG_TYPE_ER: 997 - case SEG_TYPE_SC: 998 - if (!dev_info->is_shared) 999 - rc = -EINVAL; 1000 - break; 1001 - default: 1002 - rc = -EINVAL; 1003 - break; 1004 - } 1005 - if (rc) 1006 - break; 1007 - } 1008 - if (rc) 1009 - pr_err("Suspending the system failed because DCSS device %s " 1010 - "is writable\n", 1011 - dev_info->segment_name); 1012 - return rc; 1013 - } 1014 - 1015 - static int dcssblk_restore(struct device *dev) 1016 - { 1017 - struct dcssblk_dev_info *dev_info; 1018 - struct segment_info *entry; 1019 - unsigned long start, end; 1020 - int rc = 0; 1021 - 1022 - list_for_each_entry(dev_info, &dcssblk_devices, lh) { 1023 - list_for_each_entry(entry, &dev_info->seg_list, lh) { 1024 - segment_unload(entry->segment_name); 1025 - rc = segment_load(entry->segment_name, SEGMENT_SHARED, 1026 - &start, &end); 1027 - if (rc < 0) { 1028 - // TODO in_use check ? 1029 - segment_warning(rc, entry->segment_name); 1030 - goto out_panic; 1031 - } 1032 - if (start != entry->start || end != entry->end) { 1033 - pr_err("The address range of DCSS %s changed " 1034 - "while the system was suspended\n", 1035 - entry->segment_name); 1036 - goto out_panic; 1037 - } 1038 - } 1039 - } 1040 - return 0; 1041 - out_panic: 1042 - panic("fatal dcssblk resume error\n"); 1043 - } 1044 - 1045 - static int dcssblk_thaw(struct device *dev) 1046 - { 1047 - return 0; 1048 - } 1049 - 1050 - static const struct dev_pm_ops dcssblk_pm_ops = { 1051 - .freeze = dcssblk_freeze, 1052 - .thaw = dcssblk_thaw, 1053 - .restore = dcssblk_restore, 1054 - }; 1055 - 1056 - static struct platform_driver dcssblk_pdrv = { 1057 - .driver = { 1058 - .name = "dcssblk", 1059 - .pm = &dcssblk_pm_ops, 1060 - }, 1061 - }; 1062 - 1063 - static struct platform_device *dcssblk_pdev; 1064 - 1065 - 1066 - /* 1067 987 * The init/exit functions. 1068 988 */ 1069 989 static void __exit 1070 990 dcssblk_exit(void) 1071 991 { 1072 - platform_device_unregister(dcssblk_pdev); 1073 - platform_driver_unregister(&dcssblk_pdrv); 1074 992 root_device_unregister(dcssblk_root_dev); 1075 993 unregister_blkdev(dcssblk_major, DCSSBLK_NAME); 1076 994 } ··· 997 1081 { 998 1082 int rc; 999 1083 1000 - rc = platform_driver_register(&dcssblk_pdrv); 1001 - if (rc) 1002 - return rc; 1003 - 1004 - dcssblk_pdev = platform_device_register_simple("dcssblk", -1, NULL, 1005 - 0); 1006 - if (IS_ERR(dcssblk_pdev)) { 1007 - rc = PTR_ERR(dcssblk_pdev); 1008 - goto out_pdrv; 1009 - } 1010 - 1011 1084 dcssblk_root_dev = root_device_register("dcssblk"); 1012 - if (IS_ERR(dcssblk_root_dev)) { 1013 - rc = PTR_ERR(dcssblk_root_dev); 1014 - goto out_pdev; 1015 - } 1085 + if (IS_ERR(dcssblk_root_dev)) 1086 + return PTR_ERR(dcssblk_root_dev); 1016 1087 rc = device_create_file(dcssblk_root_dev, &dev_attr_add); 1017 1088 if (rc) 1018 1089 goto out_root; ··· 1017 1114 1018 1115 out_root: 1019 1116 root_device_unregister(dcssblk_root_dev); 1020 - out_pdev: 1021 - platform_device_unregister(dcssblk_pdev); 1022 - out_pdrv: 1023 - platform_driver_unregister(&dcssblk_pdrv); 1117 + 1024 1118 return rc; 1025 1119 } 1026 1120
+3 -60
drivers/s390/block/xpram.c
··· 39 39 #include <linux/hdreg.h> /* HDIO_GETGEO */ 40 40 #include <linux/device.h> 41 41 #include <linux/bio.h> 42 - #include <linux/suspend.h> 43 - #include <linux/platform_device.h> 44 42 #include <linux/gfp.h> 45 43 #include <linux/uaccess.h> 46 44 ··· 138 140 /* 139 141 * Check if xpram is available. 140 142 */ 141 - static int xpram_present(void) 143 + static int __init xpram_present(void) 142 144 { 143 145 unsigned long mem_page; 144 146 int rc; ··· 154 156 /* 155 157 * Return index of the last available xpram page. 156 158 */ 157 - static unsigned long xpram_highest_page_index(void) 159 + static unsigned long __init xpram_highest_page_index(void) 158 160 { 159 161 unsigned int page_index, add_bit; 160 162 unsigned long mem_page; ··· 382 384 } 383 385 384 386 /* 385 - * Resume failed: Print error message and call panic. 386 - */ 387 - static void xpram_resume_error(const char *message) 388 - { 389 - pr_err("Resuming the system failed: %s\n", message); 390 - panic("xpram resume error\n"); 391 - } 392 - 393 - /* 394 - * Check if xpram setup changed between suspend and resume. 395 - */ 396 - static int xpram_restore(struct device *dev) 397 - { 398 - if (!xpram_pages) 399 - return 0; 400 - if (xpram_present() != 0) 401 - xpram_resume_error("xpram disappeared"); 402 - if (xpram_pages != xpram_highest_page_index() + 1) 403 - xpram_resume_error("Size of xpram changed"); 404 - return 0; 405 - } 406 - 407 - static const struct dev_pm_ops xpram_pm_ops = { 408 - .restore = xpram_restore, 409 - }; 410 - 411 - static struct platform_driver xpram_pdrv = { 412 - .driver = { 413 - .name = XPRAM_NAME, 414 - .pm = &xpram_pm_ops, 415 - }, 416 - }; 417 - 418 - static struct platform_device *xpram_pdev; 419 - 420 - /* 421 387 * Finally, the init/exit functions. 422 388 */ 423 389 static void __exit xpram_exit(void) ··· 392 430 blk_cleanup_disk(xpram_disks[i]); 393 431 } 394 432 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 395 - platform_device_unregister(xpram_pdev); 396 - platform_driver_unregister(&xpram_pdrv); 397 433 } 398 434 399 435 static int __init xpram_init(void) ··· 409 449 rc = xpram_setup_sizes(xpram_pages); 410 450 if (rc) 411 451 return rc; 412 - rc = platform_driver_register(&xpram_pdrv); 413 - if (rc) 414 - return rc; 415 - xpram_pdev = platform_device_register_simple(XPRAM_NAME, -1, NULL, 0); 416 - if (IS_ERR(xpram_pdev)) { 417 - rc = PTR_ERR(xpram_pdev); 418 - goto fail_platform_driver_unregister; 419 - } 420 - rc = xpram_setup_blkdev(); 421 - if (rc) 422 - goto fail_platform_device_unregister; 423 - return 0; 424 - 425 - fail_platform_device_unregister: 426 - platform_device_unregister(xpram_pdev); 427 - fail_platform_driver_unregister: 428 - platform_driver_unregister(&xpram_pdrv); 429 - return rc; 452 + return xpram_setup_blkdev(); 430 453 } 431 454 432 455 module_init(xpram_init);
+3 -122
drivers/s390/char/monreader.c
··· 21 21 #include <linux/spinlock.h> 22 22 #include <linux/interrupt.h> 23 23 #include <linux/poll.h> 24 - #include <linux/device.h> 25 24 #include <linux/slab.h> 26 25 #include <net/iucv/iucv.h> 27 26 #include <linux/uaccess.h> ··· 77 78 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 78 79 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 79 80 }; 80 - 81 - static struct device *monreader_device; 82 81 83 82 /****************************************************************************** 84 83 * helper functions * ··· 316 319 goto out_path; 317 320 } 318 321 filp->private_data = monpriv; 319 - dev_set_drvdata(monreader_device, monpriv); 320 322 return nonseekable_open(inode, filp); 321 323 322 324 out_path: ··· 350 354 atomic_set(&monpriv->msglim_count, 0); 351 355 monpriv->write_index = 0; 352 356 monpriv->read_index = 0; 353 - dev_set_drvdata(monreader_device, NULL); 354 357 355 358 for (i = 0; i < MON_MSGLIM; i++) 356 359 kfree(monpriv->msg_array[i]); ··· 451 456 .minor = MISC_DYNAMIC_MINOR, 452 457 }; 453 458 454 - 455 - /****************************************************************************** 456 - * suspend / resume * 457 - *****************************************************************************/ 458 - static int monreader_freeze(struct device *dev) 459 - { 460 - struct mon_private *monpriv = dev_get_drvdata(dev); 461 - int rc; 462 - 463 - if (!monpriv) 464 - return 0; 465 - if (monpriv->path) { 466 - rc = iucv_path_sever(monpriv->path, user_data_sever); 467 - if (rc) 468 - pr_warn("Disconnecting the z/VM *MONITOR system service failed with rc=%i\n", 469 - rc); 470 - iucv_path_free(monpriv->path); 471 - } 472 - atomic_set(&monpriv->iucv_severed, 0); 473 - atomic_set(&monpriv->iucv_connected, 0); 474 - atomic_set(&monpriv->read_ready, 0); 475 - atomic_set(&monpriv->msglim_count, 0); 476 - monpriv->write_index = 0; 477 - monpriv->read_index = 0; 478 - monpriv->path = NULL; 479 - return 0; 480 - } 481 - 482 - static int monreader_thaw(struct device *dev) 483 - { 484 - struct mon_private *monpriv = dev_get_drvdata(dev); 485 - int rc; 486 - 487 - if (!monpriv) 488 - return 0; 489 - rc = -ENOMEM; 490 - monpriv->path = iucv_path_alloc(MON_MSGLIM, IUCV_IPRMDATA, GFP_KERNEL); 491 - if (!monpriv->path) 492 - goto out; 493 - rc = iucv_path_connect(monpriv->path, &monreader_iucv_handler, 494 - MON_SERVICE, NULL, user_data_connect, monpriv); 495 - if (rc) { 496 - pr_err("Connecting to the z/VM *MONITOR system service " 497 - "failed with rc=%i\n", rc); 498 - goto out_path; 499 - } 500 - wait_event(mon_conn_wait_queue, 501 - atomic_read(&monpriv->iucv_connected) || 502 - atomic_read(&monpriv->iucv_severed)); 503 - if (atomic_read(&monpriv->iucv_severed)) 504 - goto out_path; 505 - return 0; 506 - out_path: 507 - rc = -EIO; 508 - iucv_path_free(monpriv->path); 509 - monpriv->path = NULL; 510 - out: 511 - atomic_set(&monpriv->iucv_severed, 1); 512 - return rc; 513 - } 514 - 515 - static int monreader_restore(struct device *dev) 516 - { 517 - int rc; 518 - 519 - segment_unload(mon_dcss_name); 520 - rc = segment_load(mon_dcss_name, SEGMENT_SHARED, 521 - &mon_dcss_start, &mon_dcss_end); 522 - if (rc < 0) { 523 - segment_warning(rc, mon_dcss_name); 524 - panic("fatal monreader resume error: no monitor dcss\n"); 525 - } 526 - return monreader_thaw(dev); 527 - } 528 - 529 - static const struct dev_pm_ops monreader_pm_ops = { 530 - .freeze = monreader_freeze, 531 - .thaw = monreader_thaw, 532 - .restore = monreader_restore, 533 - }; 534 - 535 - static struct device_driver monreader_driver = { 536 - .name = "monreader", 537 - .bus = &iucv_bus, 538 - .pm = &monreader_pm_ops, 539 - }; 540 - 541 - 542 459 /****************************************************************************** 543 460 * module init/exit * 544 461 *****************************************************************************/ ··· 474 567 return rc; 475 568 } 476 569 477 - rc = driver_register(&monreader_driver); 478 - if (rc) 479 - goto out_iucv; 480 - monreader_device = kzalloc(sizeof(struct device), GFP_KERNEL); 481 - if (!monreader_device) { 482 - rc = -ENOMEM; 483 - goto out_driver; 484 - } 485 - 486 - dev_set_name(monreader_device, "monreader-dev"); 487 - monreader_device->bus = &iucv_bus; 488 - monreader_device->parent = iucv_root; 489 - monreader_device->driver = &monreader_driver; 490 - monreader_device->release = (void (*)(struct device *))kfree; 491 - rc = device_register(monreader_device); 492 - if (rc) { 493 - put_device(monreader_device); 494 - goto out_driver; 495 - } 496 - 497 570 rc = segment_type(mon_dcss_name); 498 571 if (rc < 0) { 499 572 segment_warning(rc, mon_dcss_name); 500 - goto out_device; 573 + goto out_iucv; 501 574 } 502 575 if (rc != SEG_TYPE_SC) { 503 576 pr_err("The specified *MONITOR DCSS %s does not have the " 504 577 "required type SC\n", mon_dcss_name); 505 578 rc = -EINVAL; 506 - goto out_device; 579 + goto out_iucv; 507 580 } 508 581 509 582 rc = segment_load(mon_dcss_name, SEGMENT_SHARED, ··· 491 604 if (rc < 0) { 492 605 segment_warning(rc, mon_dcss_name); 493 606 rc = -EINVAL; 494 - goto out_device; 607 + goto out_iucv; 495 608 } 496 609 dcss_mkname(mon_dcss_name, &user_data_connect[8]); 497 610 ··· 506 619 507 620 out: 508 621 segment_unload(mon_dcss_name); 509 - out_device: 510 - device_unregister(monreader_device); 511 - out_driver: 512 - driver_unregister(&monreader_driver); 513 622 out_iucv: 514 623 iucv_unregister(&monreader_iucv_handler, 1); 515 624 return rc; ··· 515 632 { 516 633 segment_unload(mon_dcss_name); 517 634 misc_deregister(&mon_dev); 518 - device_unregister(monreader_device); 519 - driver_unregister(&monreader_driver); 520 635 iucv_unregister(&monreader_iucv_handler, 1); 521 636 return; 522 637 }
+1 -89
drivers/s390/char/monwriter.c
··· 20 20 #include <linux/ctype.h> 21 21 #include <linux/poll.h> 22 22 #include <linux/mutex.h> 23 - #include <linux/platform_device.h> 24 23 #include <linux/slab.h> 25 24 #include <linux/uaccess.h> 26 25 #include <asm/ebcdic.h> ··· 39 40 char *data; 40 41 }; 41 42 42 - static LIST_HEAD(mon_priv_list); 43 - 44 43 struct mon_private { 45 - struct list_head priv_list; 46 44 struct list_head list; 47 45 struct monwrite_hdr hdr; 48 46 size_t hdr_to_read; ··· 195 199 monpriv->hdr_to_read = sizeof(monpriv->hdr); 196 200 mutex_init(&monpriv->thread_mutex); 197 201 filp->private_data = monpriv; 198 - list_add_tail(&monpriv->priv_list, &mon_priv_list); 199 202 return nonseekable_open(inode, filp); 200 203 } 201 204 ··· 212 217 kfree(entry->data); 213 218 kfree(entry); 214 219 } 215 - list_del(&monpriv->priv_list); 216 220 kfree(monpriv); 217 221 return 0; 218 222 } ··· 288 294 }; 289 295 290 296 /* 291 - * suspend/resume 292 - */ 293 - 294 - static int monwriter_freeze(struct device *dev) 295 - { 296 - struct mon_private *monpriv; 297 - struct mon_buf *monbuf; 298 - 299 - list_for_each_entry(monpriv, &mon_priv_list, priv_list) { 300 - list_for_each_entry(monbuf, &monpriv->list, list) { 301 - if (monbuf->hdr.mon_function != MONWRITE_GEN_EVENT) 302 - monwrite_diag(&monbuf->hdr, monbuf->data, 303 - APPLDATA_STOP_REC); 304 - } 305 - } 306 - return 0; 307 - } 308 - 309 - static int monwriter_restore(struct device *dev) 310 - { 311 - struct mon_private *monpriv; 312 - struct mon_buf *monbuf; 313 - 314 - list_for_each_entry(monpriv, &mon_priv_list, priv_list) { 315 - list_for_each_entry(monbuf, &monpriv->list, list) { 316 - if (monbuf->hdr.mon_function == MONWRITE_START_INTERVAL) 317 - monwrite_diag(&monbuf->hdr, monbuf->data, 318 - APPLDATA_START_INTERVAL_REC); 319 - if (monbuf->hdr.mon_function == MONWRITE_START_CONFIG) 320 - monwrite_diag(&monbuf->hdr, monbuf->data, 321 - APPLDATA_START_CONFIG_REC); 322 - } 323 - } 324 - return 0; 325 - } 326 - 327 - static int monwriter_thaw(struct device *dev) 328 - { 329 - return monwriter_restore(dev); 330 - } 331 - 332 - static const struct dev_pm_ops monwriter_pm_ops = { 333 - .freeze = monwriter_freeze, 334 - .thaw = monwriter_thaw, 335 - .restore = monwriter_restore, 336 - }; 337 - 338 - static struct platform_driver monwriter_pdrv = { 339 - .driver = { 340 - .name = "monwriter", 341 - .pm = &monwriter_pm_ops, 342 - }, 343 - }; 344 - 345 - static struct platform_device *monwriter_pdev; 346 - 347 - /* 348 297 * module init/exit 349 298 */ 350 299 351 300 static int __init mon_init(void) 352 301 { 353 - int rc; 354 - 355 302 if (!MACHINE_IS_VM) 356 303 return -ENODEV; 357 - 358 - rc = platform_driver_register(&monwriter_pdrv); 359 - if (rc) 360 - return rc; 361 - 362 - monwriter_pdev = platform_device_register_simple("monwriter", -1, NULL, 363 - 0); 364 - if (IS_ERR(monwriter_pdev)) { 365 - rc = PTR_ERR(monwriter_pdev); 366 - goto out_driver; 367 - } 368 - 369 304 /* 370 305 * misc_register() has to be the last action in module_init(), because 371 306 * file operations will be available right after this. 372 307 */ 373 - rc = misc_register(&mon_dev); 374 - if (rc) 375 - goto out_device; 376 - return 0; 377 - 378 - out_device: 379 - platform_device_unregister(monwriter_pdev); 380 - out_driver: 381 - platform_driver_unregister(&monwriter_pdrv); 382 - return rc; 308 + return misc_register(&mon_dev); 383 309 } 384 310 385 311 static void __exit mon_exit(void) 386 312 { 387 313 misc_deregister(&mon_dev); 388 - platform_device_unregister(monwriter_pdev); 389 - platform_driver_unregister(&monwriter_pdrv); 390 314 } 391 315 392 316 module_init(mon_init);
+1 -173
drivers/s390/char/sclp.c
··· 18 18 #include <linux/reboot.h> 19 19 #include <linux/jiffies.h> 20 20 #include <linux/init.h> 21 - #include <linux/suspend.h> 22 - #include <linux/completion.h> 23 21 #include <linux/platform_device.h> 24 22 #include <asm/types.h> 25 23 #include <asm/irq.h> ··· 47 49 static void *sclp_read_sccb; 48 50 static struct init_sccb *sclp_init_sccb; 49 51 50 - /* Suspend request */ 51 - static DECLARE_COMPLETION(sclp_request_queue_flushed); 52 - 53 52 /* Number of console pages to allocate, used by sclp_con.c and sclp_vt220.c */ 54 53 int sclp_console_pages = SCLP_CONSOLE_PAGES; 55 54 /* Flag to indicate if buffer pages are dropped on buffer full condition */ 56 55 int sclp_console_drop = 1; 57 56 /* Number of times the console dropped buffer pages */ 58 57 unsigned long sclp_console_full; 59 - 60 - static void sclp_suspend_req_cb(struct sclp_req *req, void *data) 61 - { 62 - complete(&sclp_request_queue_flushed); 63 - } 64 58 65 59 static int __init sclp_setup_console_pages(char *str) 66 60 { ··· 77 87 } 78 88 79 89 __setup("sclp_con_drop=", sclp_setup_console_drop); 80 - 81 - static struct sclp_req sclp_suspend_req; 82 90 83 91 /* Timer for request retries. */ 84 92 static struct timer_list sclp_request_timer; ··· 110 122 sclp_mask_state_idle, 111 123 sclp_mask_state_initializing 112 124 } sclp_mask_state = sclp_mask_state_idle; 113 - 114 - /* Internal state: is the driver suspended? */ 115 - static enum sclp_suspend_state_t { 116 - sclp_suspend_state_running, 117 - sclp_suspend_state_suspended, 118 - } sclp_suspend_state = sclp_suspend_state_running; 119 125 120 126 /* Maximum retry counts */ 121 127 #define SCLP_INIT_RETRY 3 ··· 296 314 del_timer(&sclp_request_timer); 297 315 while (!list_empty(&sclp_req_queue)) { 298 316 req = list_entry(sclp_req_queue.next, struct sclp_req, list); 299 - if (!req->sccb) 300 - goto do_post; 301 317 rc = __sclp_start_request(req); 302 318 if (rc == 0) 303 319 break; ··· 307 327 sclp_request_timeout_normal); 308 328 break; 309 329 } 310 - do_post: 311 330 /* Post-processing for aborted request */ 312 331 list_del(&req->list); 313 332 if (req->callback) { ··· 320 341 321 342 static int __sclp_can_add_request(struct sclp_req *req) 322 343 { 323 - if (req == &sclp_suspend_req || req == &sclp_init_req) 344 + if (req == &sclp_init_req) 324 345 return 1; 325 - if (sclp_suspend_state != sclp_suspend_state_running) 326 - return 0; 327 346 if (sclp_init_state != sclp_init_state_initialized) 328 347 return 0; 329 348 if (sclp_activation_state != sclp_activation_state_active) ··· 355 378 /* Start if request is first in list */ 356 379 if (sclp_running_state == sclp_running_state_idle && 357 380 req->list.prev == &sclp_req_queue) { 358 - if (!req->sccb) { 359 - list_del(&req->list); 360 - rc = -ENODATA; 361 - goto out; 362 - } 363 381 rc = __sclp_start_request(req); 364 382 if (rc) 365 383 list_del(&req->list); 366 384 } 367 - out: 368 385 spin_unlock_irqrestore(&sclp_lock, flags); 369 386 return rc; 370 387 } ··· 664 693 /* Trigger initial state change callback */ 665 694 reg->sclp_receive_mask = 0; 666 695 reg->sclp_send_mask = 0; 667 - reg->pm_event_posted = 0; 668 696 list_add(&reg->list, &sclp_reg_list); 669 697 spin_unlock_irqrestore(&sclp_lock, flags); 670 698 rc = sclp_init_mask(1); ··· 981 1011 .notifier_call = sclp_reboot_event 982 1012 }; 983 1013 984 - /* 985 - * Suspend/resume SCLP notifier implementation 986 - */ 987 - 988 - static void sclp_pm_event(enum sclp_pm_event sclp_pm_event, int rollback) 989 - { 990 - struct sclp_register *reg; 991 - unsigned long flags; 992 - 993 - if (!rollback) { 994 - spin_lock_irqsave(&sclp_lock, flags); 995 - list_for_each_entry(reg, &sclp_reg_list, list) 996 - reg->pm_event_posted = 0; 997 - spin_unlock_irqrestore(&sclp_lock, flags); 998 - } 999 - do { 1000 - spin_lock_irqsave(&sclp_lock, flags); 1001 - list_for_each_entry(reg, &sclp_reg_list, list) { 1002 - if (rollback && reg->pm_event_posted) 1003 - goto found; 1004 - if (!rollback && !reg->pm_event_posted) 1005 - goto found; 1006 - } 1007 - spin_unlock_irqrestore(&sclp_lock, flags); 1008 - return; 1009 - found: 1010 - spin_unlock_irqrestore(&sclp_lock, flags); 1011 - if (reg->pm_event_fn) 1012 - reg->pm_event_fn(reg, sclp_pm_event); 1013 - reg->pm_event_posted = rollback ? 0 : 1; 1014 - } while (1); 1015 - } 1016 - 1017 - /* 1018 - * Susend/resume callbacks for platform device 1019 - */ 1020 - 1021 - static int sclp_freeze(struct device *dev) 1022 - { 1023 - unsigned long flags; 1024 - int rc; 1025 - 1026 - sclp_pm_event(SCLP_PM_EVENT_FREEZE, 0); 1027 - 1028 - spin_lock_irqsave(&sclp_lock, flags); 1029 - sclp_suspend_state = sclp_suspend_state_suspended; 1030 - spin_unlock_irqrestore(&sclp_lock, flags); 1031 - 1032 - /* Init supend data */ 1033 - memset(&sclp_suspend_req, 0, sizeof(sclp_suspend_req)); 1034 - sclp_suspend_req.callback = sclp_suspend_req_cb; 1035 - sclp_suspend_req.status = SCLP_REQ_FILLED; 1036 - init_completion(&sclp_request_queue_flushed); 1037 - 1038 - rc = sclp_add_request(&sclp_suspend_req); 1039 - if (rc == 0) 1040 - wait_for_completion(&sclp_request_queue_flushed); 1041 - else if (rc != -ENODATA) 1042 - goto fail_thaw; 1043 - 1044 - rc = sclp_deactivate(); 1045 - if (rc) 1046 - goto fail_thaw; 1047 - return 0; 1048 - 1049 - fail_thaw: 1050 - spin_lock_irqsave(&sclp_lock, flags); 1051 - sclp_suspend_state = sclp_suspend_state_running; 1052 - spin_unlock_irqrestore(&sclp_lock, flags); 1053 - sclp_pm_event(SCLP_PM_EVENT_THAW, 1); 1054 - return rc; 1055 - } 1056 - 1057 - static int sclp_undo_suspend(enum sclp_pm_event event) 1058 - { 1059 - unsigned long flags; 1060 - int rc; 1061 - 1062 - rc = sclp_reactivate(); 1063 - if (rc) 1064 - return rc; 1065 - 1066 - spin_lock_irqsave(&sclp_lock, flags); 1067 - sclp_suspend_state = sclp_suspend_state_running; 1068 - spin_unlock_irqrestore(&sclp_lock, flags); 1069 - 1070 - sclp_pm_event(event, 0); 1071 - return 0; 1072 - } 1073 - 1074 - static int sclp_thaw(struct device *dev) 1075 - { 1076 - return sclp_undo_suspend(SCLP_PM_EVENT_THAW); 1077 - } 1078 - 1079 - static int sclp_restore(struct device *dev) 1080 - { 1081 - return sclp_undo_suspend(SCLP_PM_EVENT_RESTORE); 1082 - } 1083 - 1084 - static const struct dev_pm_ops sclp_pm_ops = { 1085 - .freeze = sclp_freeze, 1086 - .thaw = sclp_thaw, 1087 - .restore = sclp_restore, 1088 - }; 1089 - 1090 1014 static ssize_t con_pages_show(struct device_driver *dev, char *buf) 1091 1015 { 1092 1016 return sprintf(buf, "%i\n", sclp_console_pages); ··· 1019 1155 static struct platform_driver sclp_pdrv = { 1020 1156 .driver = { 1021 1157 .name = "sclp", 1022 - .pm = &sclp_pm_ops, 1023 1158 .groups = sclp_drv_attr_groups, 1024 1159 }, 1025 1160 }; 1026 - 1027 - static struct platform_device *sclp_pdev; 1028 1161 1029 1162 /* Initialize SCLP driver. Return zero if driver is operational, non-zero 1030 1163 * otherwise. */ ··· 1076 1215 return rc; 1077 1216 } 1078 1217 1079 - /* 1080 - * SCLP panic notifier: If we are suspended, we thaw SCLP in order to be able 1081 - * to print the panic message. 1082 - */ 1083 - static int sclp_panic_notify(struct notifier_block *self, 1084 - unsigned long event, void *data) 1085 - { 1086 - if (sclp_suspend_state == sclp_suspend_state_suspended) 1087 - sclp_undo_suspend(SCLP_PM_EVENT_THAW); 1088 - return NOTIFY_OK; 1089 - } 1090 - 1091 - static struct notifier_block sclp_on_panic_nb = { 1092 - .notifier_call = sclp_panic_notify, 1093 - .priority = SCLP_PANIC_PRIO, 1094 - }; 1095 - 1096 1218 static __init int sclp_initcall(void) 1097 1219 { 1098 1220 int rc; ··· 1084 1240 if (rc) 1085 1241 return rc; 1086 1242 1087 - sclp_pdev = platform_device_register_simple("sclp", -1, NULL, 0); 1088 - rc = PTR_ERR_OR_ZERO(sclp_pdev); 1089 - if (rc) 1090 - goto fail_platform_driver_unregister; 1091 - 1092 - rc = atomic_notifier_chain_register(&panic_notifier_list, 1093 - &sclp_on_panic_nb); 1094 - if (rc) 1095 - goto fail_platform_device_unregister; 1096 - 1097 1243 return sclp_init(); 1098 - 1099 - fail_platform_device_unregister: 1100 - platform_device_unregister(sclp_pdev); 1101 - fail_platform_driver_unregister: 1102 - platform_driver_unregister(&sclp_pdrv); 1103 - return rc; 1104 1244 } 1105 1245 1106 1246 arch_initcall(sclp_initcall);
-13
drivers/s390/char/sclp.h
··· 81 81 82 82 #define GDS_KEY_SELFDEFTEXTMSG 0x31 83 83 84 - enum sclp_pm_event { 85 - SCLP_PM_EVENT_FREEZE, 86 - SCLP_PM_EVENT_THAW, 87 - SCLP_PM_EVENT_RESTORE, 88 - }; 89 - 90 - #define SCLP_PANIC_PRIO 1 91 - #define SCLP_PANIC_PRIO_CLIENT 0 92 - 93 84 typedef u64 sccb_mask_t; 94 85 95 86 struct sccb_header { ··· 284 293 void (*state_change_fn)(struct sclp_register *); 285 294 /* called for events in cp_receive_mask/sclp_receive_mask */ 286 295 void (*receiver_fn)(struct evbuf_header *); 287 - /* called for power management events */ 288 - void (*pm_event_fn)(struct sclp_register *, enum sclp_pm_event); 289 - /* pm event posted flag */ 290 - int pm_event_posted; 291 296 }; 292 297 293 298 /* externals from sclp.c */
-34
drivers/s390/char/sclp_cmd.c
··· 20 20 #include <linux/mmzone.h> 21 21 #include <linux/memory.h> 22 22 #include <linux/module.h> 23 - #include <linux/platform_device.h> 24 23 #include <asm/ctl_reg.h> 25 24 #include <asm/chpid.h> 26 25 #include <asm/setup.h> ··· 167 168 static LIST_HEAD(sclp_mem_list); 168 169 static u8 sclp_max_storage_id; 169 170 static DECLARE_BITMAP(sclp_storage_ids, 256); 170 - static int sclp_mem_state_changed; 171 171 172 172 struct memory_increment { 173 173 struct list_head list; ··· 357 359 rc = -EINVAL; 358 360 break; 359 361 } 360 - if (!rc) 361 - sclp_mem_state_changed = 1; 362 362 mutex_unlock(&sclp_mem_mutex); 363 363 return rc ? NOTIFY_BAD : NOTIFY_OK; 364 364 } ··· 452 456 list_add(&new_incr->list, prev); 453 457 } 454 458 455 - static int sclp_mem_freeze(struct device *dev) 456 - { 457 - if (!sclp_mem_state_changed) 458 - return 0; 459 - pr_err("Memory hotplug state changed, suspend refused.\n"); 460 - return -EPERM; 461 - } 462 - 463 - static const struct dev_pm_ops sclp_mem_pm_ops = { 464 - .freeze = sclp_mem_freeze, 465 - }; 466 - 467 - static struct platform_driver sclp_mem_pdrv = { 468 - .driver = { 469 - .name = "sclp_mem", 470 - .pm = &sclp_mem_pm_ops, 471 - }, 472 - }; 473 - 474 459 static int __init sclp_detect_standby_memory(void) 475 460 { 476 - struct platform_device *sclp_pdev; 477 461 struct read_storage_sccb *sccb; 478 462 int i, id, assigned, rc; 479 463 ··· 506 530 rc = register_memory_notifier(&sclp_mem_nb); 507 531 if (rc) 508 532 goto out; 509 - rc = platform_driver_register(&sclp_mem_pdrv); 510 - if (rc) 511 - goto out; 512 - sclp_pdev = platform_device_register_simple("sclp_mem", -1, NULL, 0); 513 - rc = PTR_ERR_OR_ZERO(sclp_pdev); 514 - if (rc) 515 - goto out_driver; 516 533 sclp_add_standby_memory(); 517 - goto out; 518 - out_driver: 519 - platform_driver_unregister(&sclp_mem_pdrv); 520 534 out: 521 535 free_page((unsigned long) sccb); 522 536 return rc;
+3 -50
drivers/s390/char/sclp_con.c
··· 36 36 static struct sclp_buffer *sclp_conbuf; 37 37 /* Timer for delayed output of console messages */ 38 38 static struct timer_list sclp_con_timer; 39 - /* Suspend mode flag */ 40 - static int sclp_con_suspended; 41 39 /* Flag that output queue is currently running */ 42 40 static int sclp_con_queue_running; 43 41 ··· 62 64 if (!list_empty(&sclp_con_outqueue)) 63 65 buffer = list_first_entry(&sclp_con_outqueue, 64 66 struct sclp_buffer, list); 65 - if (!buffer || sclp_con_suspended) { 67 + if (!buffer) { 66 68 sclp_con_queue_running = 0; 67 69 spin_unlock_irqrestore(&sclp_con_lock, flags); 68 70 break; ··· 84 86 if (sclp_conbuf) 85 87 list_add_tail(&sclp_conbuf->list, &sclp_con_outqueue); 86 88 sclp_conbuf = NULL; 87 - if (sclp_con_queue_running || sclp_con_suspended) 89 + if (sclp_con_queue_running) 88 90 goto out_unlock; 89 91 if (list_empty(&sclp_con_outqueue)) 90 92 goto out_unlock; ··· 178 180 if (list_empty(&sclp_con_pages)) 179 181 sclp_console_full++; 180 182 while (list_empty(&sclp_con_pages)) { 181 - if (sclp_con_suspended) 182 - goto out; 183 183 if (sclp_console_drop_buffer()) 184 184 break; 185 185 spin_unlock_irqrestore(&sclp_con_lock, flags); ··· 210 214 !timer_pending(&sclp_con_timer)) { 211 215 mod_timer(&sclp_con_timer, jiffies + HZ / 10); 212 216 } 213 - out: 214 217 spin_unlock_irqrestore(&sclp_con_lock, flags); 215 218 } 216 219 ··· 230 235 sclp_console_sync_queue(); 231 236 } 232 237 233 - /* 234 - * Resume console: If there are cached messages, emit them. 235 - */ 236 - static void sclp_console_resume(void) 237 - { 238 - unsigned long flags; 239 - 240 - spin_lock_irqsave(&sclp_con_lock, flags); 241 - sclp_con_suspended = 0; 242 - spin_unlock_irqrestore(&sclp_con_lock, flags); 243 - sclp_conbuf_emit(); 244 - } 245 - 246 - /* 247 - * Suspend console: Set suspend flag and flush console 248 - */ 249 - static void sclp_console_suspend(void) 250 - { 251 - unsigned long flags; 252 - 253 - spin_lock_irqsave(&sclp_con_lock, flags); 254 - sclp_con_suspended = 1; 255 - spin_unlock_irqrestore(&sclp_con_lock, flags); 256 - sclp_console_flush(); 257 - } 258 - 259 238 static int sclp_console_notify(struct notifier_block *self, 260 239 unsigned long event, void *data) 261 240 { ··· 239 270 240 271 static struct notifier_block on_panic_nb = { 241 272 .notifier_call = sclp_console_notify, 242 - .priority = SCLP_PANIC_PRIO_CLIENT, 273 + .priority = 1, 243 274 }; 244 275 245 276 static struct notifier_block on_reboot_nb = { ··· 259 290 .flags = CON_PRINTBUFFER, 260 291 .index = 0 /* ttyS0 */ 261 292 }; 262 - 263 - /* 264 - * This function is called for SCLP suspend and resume events. 265 - */ 266 - void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) 267 - { 268 - switch (sclp_pm_event) { 269 - case SCLP_PM_EVENT_FREEZE: 270 - sclp_console_suspend(); 271 - break; 272 - case SCLP_PM_EVENT_RESTORE: 273 - case SCLP_PM_EVENT_THAW: 274 - sclp_console_resume(); 275 - break; 276 - } 277 - } 278 293 279 294 /* 280 295 * called by console_init() in drivers/char/tty_io.c at boot-time.
-1
drivers/s390/char/sclp_ftp.c
··· 231 231 .receive_mask = EVTYP_DIAG_TEST_MASK, /* want rx events */ 232 232 .receiver_fn = sclp_ftp_rxcb, /* async callback (rx) */ 233 233 .state_change_fn = NULL, 234 - .pm_event_fn = NULL, 235 234 }; 236 235 237 236 /**
+3 -34
drivers/s390/char/sclp_quiesce.c
··· 18 18 19 19 #include "sclp.h" 20 20 21 - static void (*old_machine_restart)(char *); 22 - static void (*old_machine_halt)(void); 23 - static void (*old_machine_power_off)(void); 24 - 25 21 /* Shutdown handler. Signal completion of shutdown by loading special PSW. */ 26 22 static void do_machine_quiesce(void) 27 23 { ··· 33 37 /* Handler for quiesce event. Start shutdown procedure. */ 34 38 static void sclp_quiesce_handler(struct evbuf_header *evbuf) 35 39 { 36 - if (_machine_restart != (void *) do_machine_quiesce) { 37 - old_machine_restart = _machine_restart; 38 - old_machine_halt = _machine_halt; 39 - old_machine_power_off = _machine_power_off; 40 - _machine_restart = (void *) do_machine_quiesce; 41 - _machine_halt = do_machine_quiesce; 42 - _machine_power_off = do_machine_quiesce; 43 - } 40 + _machine_restart = (void *) do_machine_quiesce; 41 + _machine_halt = do_machine_quiesce; 42 + _machine_power_off = do_machine_quiesce; 44 43 ctrl_alt_del(); 45 - } 46 - 47 - /* Undo machine restart/halt/power_off modification on resume */ 48 - static void sclp_quiesce_pm_event(struct sclp_register *reg, 49 - enum sclp_pm_event sclp_pm_event) 50 - { 51 - switch (sclp_pm_event) { 52 - case SCLP_PM_EVENT_RESTORE: 53 - if (old_machine_restart) { 54 - _machine_restart = old_machine_restart; 55 - _machine_halt = old_machine_halt; 56 - _machine_power_off = old_machine_power_off; 57 - old_machine_restart = NULL; 58 - old_machine_halt = NULL; 59 - old_machine_power_off = NULL; 60 - } 61 - break; 62 - case SCLP_PM_EVENT_FREEZE: 63 - case SCLP_PM_EVENT_THAW: 64 - break; 65 - } 66 44 } 67 45 68 46 static struct sclp_register sclp_quiesce_event = { 69 47 .receive_mask = EVTYP_SIGQUIESCE_MASK, 70 48 .receiver_fn = sclp_quiesce_handler, 71 - .pm_event_fn = sclp_quiesce_pm_event 72 49 }; 73 50 74 51 /* Initialize quiesce driver. */
-7
drivers/s390/char/sclp_rw.c
··· 26 26 */ 27 27 #define MAX_SCCB_ROOM (PAGE_SIZE - sizeof(struct sclp_buffer)) 28 28 29 - static void sclp_rw_pm_event(struct sclp_register *reg, 30 - enum sclp_pm_event sclp_pm_event) 31 - { 32 - sclp_console_pm_event(sclp_pm_event); 33 - } 34 - 35 29 /* Event type structure for write message and write priority message */ 36 30 static struct sclp_register sclp_rw_event = { 37 31 .send_mask = EVTYP_MSG_MASK, 38 - .pm_event_fn = sclp_rw_pm_event, 39 32 }; 40 33 41 34 /*
-6
drivers/s390/char/sclp_rw.h
··· 88 88 int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int)); 89 89 int sclp_chars_in_buffer(struct sclp_buffer *); 90 90 91 - #ifdef CONFIG_SCLP_CONSOLE 92 - void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); 93 - #else 94 - static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } 95 - #endif 96 - 97 91 #endif /* __SCLP_RW_H__ */
+1 -3
drivers/s390/char/sclp_tty.c
··· 284 284 sclp_tty_chars_in_buffer(struct tty_struct *tty) 285 285 { 286 286 unsigned long flags; 287 - struct list_head *l; 288 287 struct sclp_buffer *t; 289 288 int count; 290 289 ··· 291 292 count = 0; 292 293 if (sclp_ttybuf != NULL) 293 294 count = sclp_chars_in_buffer(sclp_ttybuf); 294 - list_for_each(l, &sclp_tty_outqueue) { 295 - t = list_entry(l, struct sclp_buffer, list); 295 + list_for_each_entry(t, &sclp_tty_outqueue, list) { 296 296 count += sclp_chars_in_buffer(t); 297 297 } 298 298 spin_unlock_irqrestore(&sclp_tty_lock, flags);
+5 -51
drivers/s390/char/sclp_vt220.c
··· 36 36 #define SCLP_VT220_MINOR 65 37 37 #define SCLP_VT220_DRIVER_NAME "sclp_vt220" 38 38 #define SCLP_VT220_DEVICE_NAME "ttysclp" 39 - #define SCLP_VT220_CONSOLE_NAME "ttyS" 40 - #define SCLP_VT220_CONSOLE_INDEX 1 /* console=ttyS1 */ 39 + #define SCLP_VT220_CONSOLE_NAME "ttysclp" 40 + #define SCLP_VT220_CONSOLE_INDEX 0 /* console=ttysclp0 */ 41 41 42 42 /* Representation of a single write request */ 43 43 struct sclp_vt220_request { ··· 70 70 /* List of pending requests */ 71 71 static LIST_HEAD(sclp_vt220_outqueue); 72 72 73 - /* Suspend mode flag */ 74 - static int sclp_vt220_suspended; 75 - 76 73 /* Flag that output queue is currently running */ 77 74 static int sclp_vt220_queue_running; 78 75 ··· 93 96 static int sclp_vt220_flush_later; 94 97 95 98 static void sclp_vt220_receiver_fn(struct evbuf_header *evbuf); 96 - static void sclp_vt220_pm_event_fn(struct sclp_register *reg, 97 - enum sclp_pm_event sclp_pm_event); 98 99 static int __sclp_vt220_emit(struct sclp_vt220_request *request); 99 100 static void sclp_vt220_emit_current(void); 100 101 101 102 /* Registration structure for SCLP output event buffers */ 102 103 static struct sclp_register sclp_vt220_register = { 103 104 .send_mask = EVTYP_VT220MSG_MASK, 104 - .pm_event_fn = sclp_vt220_pm_event_fn, 105 105 }; 106 106 107 107 /* Registration structure for SCLP input event buffers */ ··· 130 136 if (!list_empty(&sclp_vt220_outqueue)) 131 137 request = list_entry(sclp_vt220_outqueue.next, 132 138 struct sclp_vt220_request, list); 133 - if (!request || sclp_vt220_suspended) { 139 + if (!request) { 134 140 sclp_vt220_queue_running = 0; 135 141 spin_unlock_irqrestore(&sclp_vt220_lock, flags); 136 142 break; ··· 236 242 } 237 243 sclp_vt220_flush_later = 0; 238 244 } 239 - if (sclp_vt220_queue_running || sclp_vt220_suspended) 245 + if (sclp_vt220_queue_running) 240 246 goto out_unlock; 241 247 if (list_empty(&sclp_vt220_outqueue)) 242 248 goto out_unlock; ··· 415 421 if (list_empty(&sclp_vt220_empty)) 416 422 sclp_console_full++; 417 423 while (list_empty(&sclp_vt220_empty)) { 418 - if (may_fail || sclp_vt220_suspended) 424 + if (may_fail) 419 425 goto out; 420 426 if (sclp_vt220_drop_buffer()) 421 427 break; ··· 784 790 spin_lock_irqsave(&sclp_vt220_lock, flags); 785 791 } 786 792 spin_unlock_irqrestore(&sclp_vt220_lock, flags); 787 - } 788 - 789 - /* 790 - * Resume console: If there are cached messages, emit them. 791 - */ 792 - static void sclp_vt220_resume(void) 793 - { 794 - unsigned long flags; 795 - 796 - spin_lock_irqsave(&sclp_vt220_lock, flags); 797 - sclp_vt220_suspended = 0; 798 - spin_unlock_irqrestore(&sclp_vt220_lock, flags); 799 - sclp_vt220_emit_current(); 800 - } 801 - 802 - /* 803 - * Suspend console: Set suspend flag and flush console 804 - */ 805 - static void sclp_vt220_suspend(void) 806 - { 807 - unsigned long flags; 808 - 809 - spin_lock_irqsave(&sclp_vt220_lock, flags); 810 - sclp_vt220_suspended = 1; 811 - spin_unlock_irqrestore(&sclp_vt220_lock, flags); 812 - __sclp_vt220_flush_buffer(); 813 - } 814 - 815 - static void sclp_vt220_pm_event_fn(struct sclp_register *reg, 816 - enum sclp_pm_event sclp_pm_event) 817 - { 818 - switch (sclp_pm_event) { 819 - case SCLP_PM_EVENT_FREEZE: 820 - sclp_vt220_suspend(); 821 - break; 822 - case SCLP_PM_EVENT_RESTORE: 823 - case SCLP_PM_EVENT_THAW: 824 - sclp_vt220_resume(); 825 - break; 826 - } 827 793 } 828 794 829 795 #ifdef CONFIG_SCLP_VT220_CONSOLE
-24
drivers/s390/char/vmlogrdr.c
··· 679 679 NULL, 680 680 }; 681 681 682 - static int vmlogrdr_pm_prepare(struct device *dev) 683 - { 684 - int rc; 685 - struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 686 - 687 - rc = 0; 688 - if (priv) { 689 - spin_lock_bh(&priv->priv_lock); 690 - if (priv->dev_in_use) 691 - rc = -EBUSY; 692 - spin_unlock_bh(&priv->priv_lock); 693 - } 694 - if (rc) 695 - pr_err("vmlogrdr: device %s is busy. Refuse to suspend.\n", 696 - dev_name(dev)); 697 - return rc; 698 - } 699 - 700 - 701 - static const struct dev_pm_ops vmlogrdr_pm_ops = { 702 - .prepare = vmlogrdr_pm_prepare, 703 - }; 704 - 705 682 static struct class *vmlogrdr_class; 706 683 static struct device_driver vmlogrdr_driver = { 707 684 .name = "vmlogrdr", 708 685 .bus = &iucv_bus, 709 - .pm = &vmlogrdr_pm_ops, 710 686 .groups = vmlogrdr_drv_attr_groups, 711 687 }; 712 688
+1 -1
drivers/s390/cio/airq.c
··· 93 93 struct hlist_head *head; 94 94 95 95 set_cpu_flag(CIF_NOHZ_DELAY); 96 - tpi_info = (struct tpi_info *) &get_irq_regs()->int_code; 96 + tpi_info = &get_irq_regs()->tpi_info; 97 97 trace_s390_cio_adapter_int(tpi_info); 98 98 head = &airq_lists[tpi_info->isc]; 99 99 rcu_read_lock();
+18 -42
drivers/s390/cio/ccwgroup.c
··· 45 45 } 46 46 } 47 47 48 - /* 49 - * Remove references from ccw devices to ccw group device and from 50 - * ccw group device to ccw devices. 51 - */ 52 - static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev) 53 - { 54 - struct ccw_device *cdev; 55 - int i; 56 - 57 - for (i = 0; i < gdev->count; i++) { 58 - cdev = gdev->cdev[i]; 59 - if (!cdev) 60 - continue; 61 - spin_lock_irq(cdev->ccwlock); 62 - dev_set_drvdata(&cdev->dev, NULL); 63 - spin_unlock_irq(cdev->ccwlock); 64 - gdev->cdev[i] = NULL; 65 - put_device(&cdev->dev); 66 - } 67 - } 68 - 69 48 /** 70 49 * ccwgroup_set_online() - enable a ccwgroup device 71 50 * @gdev: target ccwgroup device ··· 154 175 if (device_is_registered(&gdev->dev)) { 155 176 __ccwgroup_remove_symlinks(gdev); 156 177 device_unregister(&gdev->dev); 157 - __ccwgroup_remove_cdev_refs(gdev); 158 178 } 159 179 mutex_unlock(&gdev->reg_mutex); 160 180 } ··· 206 228 207 229 static void ccwgroup_release(struct device *dev) 208 230 { 209 - kfree(to_ccwgroupdev(dev)); 231 + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 232 + unsigned int i; 233 + 234 + for (i = 0; i < gdev->count; i++) { 235 + struct ccw_device *cdev = gdev->cdev[i]; 236 + unsigned long flags; 237 + 238 + if (cdev) { 239 + spin_lock_irqsave(cdev->ccwlock, flags); 240 + if (dev_get_drvdata(&cdev->dev) == gdev) 241 + dev_set_drvdata(&cdev->dev, NULL); 242 + spin_unlock_irqrestore(cdev->ccwlock, flags); 243 + put_device(&cdev->dev); 244 + } 245 + } 246 + 247 + kfree(gdev); 210 248 } 211 249 212 250 static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) ··· 390 396 mutex_unlock(&gdev->reg_mutex); 391 397 return 0; 392 398 error: 393 - for (i = 0; i < num_devices; i++) 394 - if (gdev->cdev[i]) { 395 - spin_lock_irq(gdev->cdev[i]->ccwlock); 396 - if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) 397 - dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 398 - spin_unlock_irq(gdev->cdev[i]->ccwlock); 399 - put_device(&gdev->cdev[i]->dev); 400 - gdev->cdev[i] = NULL; 401 - } 402 399 mutex_unlock(&gdev->reg_mutex); 403 400 put_device(&gdev->dev); 404 401 return rc; ··· 401 416 { 402 417 struct ccwgroup_device *gdev = to_ccwgroupdev(data); 403 418 404 - if (action == BUS_NOTIFY_UNBIND_DRIVER) { 419 + if (action == BUS_NOTIFY_UNBOUND_DRIVER) { 405 420 get_device(&gdev->dev); 406 421 schedule_work(&gdev->ungroup_work); 407 422 } ··· 499 514 */ 500 515 void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) 501 516 { 502 - struct device *dev; 503 - 504 - /* We don't want ccwgroup devices to live longer than their driver. */ 505 - while ((dev = driver_find_next_device(&cdriver->driver, NULL))) { 506 - struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 507 - 508 - ccwgroup_ungroup(gdev); 509 - put_device(dev); 510 - } 511 517 driver_unregister(&cdriver->driver); 512 518 } 513 519 EXPORT_SYMBOL(ccwgroup_driver_unregister);
+3
drivers/s390/cio/chp.c
··· 255 255 if (!num_args) 256 256 return count; 257 257 258 + /* Wait until previous actions have settled. */ 259 + css_wait_for_slow_path(); 260 + 258 261 if (!strncasecmp(cmd, "on", 2) || !strcmp(cmd, "1")) { 259 262 mutex_lock(&cp->lock); 260 263 error = s390_vary_chpid(cp->chpid, 1);
-2
drivers/s390/cio/chsc.c
··· 801 801 { 802 802 struct channel_path *chp = chpid_to_chp(chpid); 803 803 804 - /* Wait until previous actions have settled. */ 805 - css_wait_for_slow_path(); 806 804 /* 807 805 * Redo PathVerification on the devices the chpid connects to 808 806 */
+1 -1
drivers/s390/cio/cio.c
··· 536 536 struct irb *irb; 537 537 538 538 set_cpu_flag(CIF_NOHZ_DELAY); 539 - tpi_info = (struct tpi_info *) &get_irq_regs()->int_code; 539 + tpi_info = &get_irq_regs()->tpi_info; 540 540 trace_s390_cio_interrupt(tpi_info); 541 541 irb = this_cpu_ptr(&cio_irb); 542 542 sch = (struct subchannel *)(unsigned long) tpi_info->intparm;
+1 -12
drivers/s390/cio/cio.h
··· 9 9 #include <asm/cio.h> 10 10 #include <asm/fcx.h> 11 11 #include <asm/schid.h> 12 + #include <asm/tpi.h> 12 13 #include "chsc.h" 13 14 14 15 /* ··· 46 45 /* ... is not installed, this results */ 47 46 /* ... in an operand exception. */ 48 47 } __attribute__ ((packed)); 49 - 50 - /* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */ 51 - struct tpi_info { 52 - struct subchannel_id schid; 53 - u32 intparm; 54 - u32 adapter_IO:1; 55 - u32 directed_irq:1; 56 - u32 isc:3; 57 - u32 :27; 58 - u32 type:3; 59 - u32 :12; 60 - } __packed __aligned(4); 61 48 62 49 /* Target SCHIB configuration. */ 63 50 struct schib_config {
+7 -6
drivers/s390/cio/cmf.c
··· 163 163 */ 164 164 static inline void cmf_activate(void *area, unsigned int onoff) 165 165 { 166 - register void * __gpr2 asm("2"); 167 - register long __gpr1 asm("1"); 168 - 169 - __gpr2 = area; 170 - __gpr1 = onoff; 171 166 /* activate channel measurement */ 172 - asm("schm" : : "d" (__gpr2), "d" (__gpr1) ); 167 + asm volatile( 168 + " lgr 1,%[r1]\n" 169 + " lgr 2,%[mbo]\n" 170 + " schm\n" 171 + : 172 + : [r1] "d" ((unsigned long)onoff), [mbo] "d" (area) 173 + : "1", "2"); 173 174 } 174 175 175 176 static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc,
+75 -68
drivers/s390/cio/ioasm.c
··· 16 16 17 17 static inline int __stsch(struct subchannel_id schid, struct schib *addr) 18 18 { 19 - register struct subchannel_id reg1 asm ("1") = schid; 19 + unsigned long r1 = *(unsigned int *)&schid; 20 20 int ccode = -EIO; 21 21 22 22 asm volatile( 23 - " stsch 0(%3)\n" 24 - "0: ipm %0\n" 25 - " srl %0,28\n" 23 + " lgr 1,%[r1]\n" 24 + " stsch %[addr]\n" 25 + "0: ipm %[cc]\n" 26 + " srl %[cc],28\n" 26 27 "1:\n" 27 28 EX_TABLE(0b, 1b) 28 - : "+d" (ccode), "=m" (*addr) 29 - : "d" (reg1), "a" (addr) 30 - : "cc"); 29 + : [cc] "+&d" (ccode), [addr] "=Q" (*addr) 30 + : [r1] "d" (r1) 31 + : "cc", "1"); 31 32 return ccode; 32 33 } 33 34 ··· 45 44 46 45 static inline int __msch(struct subchannel_id schid, struct schib *addr) 47 46 { 48 - register struct subchannel_id reg1 asm ("1") = schid; 47 + unsigned long r1 = *(unsigned int *)&schid; 49 48 int ccode = -EIO; 50 49 51 50 asm volatile( 52 - " msch 0(%2)\n" 53 - "0: ipm %0\n" 54 - " srl %0,28\n" 51 + " lgr 1,%[r1]\n" 52 + " msch %[addr]\n" 53 + "0: ipm %[cc]\n" 54 + " srl %[cc],28\n" 55 55 "1:\n" 56 56 EX_TABLE(0b, 1b) 57 - : "+d" (ccode) 58 - : "d" (reg1), "a" (addr), "m" (*addr) 59 - : "cc"); 57 + : [cc] "+&d" (ccode) 58 + : [r1] "d" (r1), [addr] "Q" (*addr) 59 + : "cc", "1"); 60 60 return ccode; 61 61 } 62 62 ··· 73 71 74 72 static inline int __tsch(struct subchannel_id schid, struct irb *addr) 75 73 { 76 - register struct subchannel_id reg1 asm ("1") = schid; 74 + unsigned long r1 = *(unsigned int *)&schid; 77 75 int ccode; 78 76 79 77 asm volatile( 80 - " tsch 0(%3)\n" 81 - " ipm %0\n" 82 - " srl %0,28" 83 - : "=d" (ccode), "=m" (*addr) 84 - : "d" (reg1), "a" (addr) 85 - : "cc"); 78 + " lgr 1,%[r1]\n" 79 + " tsch %[addr]\n" 80 + " ipm %[cc]\n" 81 + " srl %[cc],28" 82 + : [cc] "=&d" (ccode), [addr] "=Q" (*addr) 83 + : [r1] "d" (r1) 84 + : "cc", "1"); 86 85 return ccode; 87 86 } 88 87 ··· 99 96 100 97 static inline int __ssch(struct subchannel_id schid, union orb *addr) 101 98 { 102 - register struct subchannel_id reg1 asm("1") = schid; 99 + unsigned long r1 = *(unsigned int *)&schid; 103 100 int ccode = -EIO; 104 101 105 102 asm volatile( 106 - " ssch 0(%2)\n" 107 - "0: ipm %0\n" 108 - " srl %0,28\n" 103 + " lgr 1,%[r1]\n" 104 + " ssch %[addr]\n" 105 + "0: ipm %[cc]\n" 106 + " srl %[cc],28\n" 109 107 "1:\n" 110 108 EX_TABLE(0b, 1b) 111 - : "+d" (ccode) 112 - : "d" (reg1), "a" (addr), "m" (*addr) 113 - : "cc", "memory"); 109 + : [cc] "+&d" (ccode) 110 + : [r1] "d" (r1), [addr] "Q" (*addr) 111 + : "cc", "memory", "1"); 114 112 return ccode; 115 113 } 116 114 ··· 128 124 129 125 static inline int __csch(struct subchannel_id schid) 130 126 { 131 - register struct subchannel_id reg1 asm("1") = schid; 127 + unsigned long r1 = *(unsigned int *)&schid; 132 128 int ccode; 133 129 134 130 asm volatile( 131 + " lgr 1,%[r1]\n" 135 132 " csch\n" 136 - " ipm %0\n" 137 - " srl %0,28" 138 - : "=d" (ccode) 139 - : "d" (reg1) 140 - : "cc"); 133 + " ipm %[cc]\n" 134 + " srl %[cc],28\n" 135 + : [cc] "=&d" (ccode) 136 + : [r1] "d" (r1) 137 + : "cc", "1"); 141 138 return ccode; 142 139 } 143 140 ··· 158 153 int ccode; 159 154 160 155 asm volatile( 161 - " tpi 0(%2)\n" 162 - " ipm %0\n" 163 - " srl %0,28" 164 - : "=d" (ccode), "=m" (*addr) 165 - : "a" (addr) 156 + " tpi %[addr]\n" 157 + " ipm %[cc]\n" 158 + " srl %[cc],28" 159 + : [cc] "=&d" (ccode), [addr] "=Q" (*addr) 160 + : 166 161 : "cc"); 167 162 trace_s390_cio_tpi(addr, ccode); 168 163 ··· 175 170 int cc = -EIO; 176 171 177 172 asm volatile( 178 - " .insn rre,0xb25f0000,%2,0\n" 179 - "0: ipm %0\n" 180 - " srl %0,28\n" 173 + " .insn rre,0xb25f0000,%[chsc_area],0\n" 174 + "0: ipm %[cc]\n" 175 + " srl %[cc],28\n" 181 176 "1:\n" 182 177 EX_TABLE(0b, 1b) 183 - : "+d" (cc), "=m" (*(addr_type *) chsc_area) 184 - : "d" (chsc_area), "m" (*(addr_type *) chsc_area) 178 + : [cc] "+&d" (cc), "+m" (*(addr_type *)chsc_area) 179 + : [chsc_area] "d" (chsc_area) 185 180 : "cc"); 186 181 trace_s390_cio_chsc(chsc_area, cc); 187 182 ··· 191 186 192 187 static inline int __rsch(struct subchannel_id schid) 193 188 { 194 - register struct subchannel_id reg1 asm("1") = schid; 189 + unsigned long r1 = *(unsigned int *)&schid; 195 190 int ccode; 196 191 197 192 asm volatile( 193 + " lgr 1,%[r1]\n" 198 194 " rsch\n" 199 - " ipm %0\n" 200 - " srl %0,28" 201 - : "=d" (ccode) 202 - : "d" (reg1) 203 - : "cc", "memory"); 204 - 195 + " ipm %[cc]\n" 196 + " srl %[cc],28\n" 197 + : [cc] "=&d" (ccode) 198 + : [r1] "d" (r1) 199 + : "cc", "memory", "1"); 205 200 return ccode; 206 201 } 207 202 ··· 217 212 218 213 static inline int __hsch(struct subchannel_id schid) 219 214 { 220 - register struct subchannel_id reg1 asm("1") = schid; 215 + unsigned long r1 = *(unsigned int *)&schid; 221 216 int ccode; 222 217 223 218 asm volatile( 219 + " lgr 1,%[r1]\n" 224 220 " hsch\n" 225 - " ipm %0\n" 226 - " srl %0,28" 227 - : "=d" (ccode) 228 - : "d" (reg1) 229 - : "cc"); 221 + " ipm %[cc]\n" 222 + " srl %[cc],28\n" 223 + : [cc] "=&d" (ccode) 224 + : [r1] "d" (r1) 225 + : "cc", "1"); 230 226 return ccode; 231 227 } 232 228 ··· 244 238 245 239 static inline int __xsch(struct subchannel_id schid) 246 240 { 247 - register struct subchannel_id reg1 asm("1") = schid; 241 + unsigned long r1 = *(unsigned int *)&schid; 248 242 int ccode; 249 243 250 244 asm volatile( 245 + " lgr 1,%[r1]\n" 251 246 " xsch\n" 252 - " ipm %0\n" 253 - " srl %0,28" 254 - : "=d" (ccode) 255 - : "d" (reg1) 256 - : "cc"); 247 + " ipm %[cc]\n" 248 + " srl %[cc],28\n" 249 + : [cc] "=&d" (ccode) 250 + : [r1] "d" (r1) 251 + : "cc", "1"); 257 252 return ccode; 258 253 } 259 254 ··· 273 266 int ccode; 274 267 275 268 asm volatile( 276 - " stcrw 0(%2)\n" 277 - " ipm %0\n" 278 - " srl %0,28\n" 279 - : "=d" (ccode), "=m" (*crw) 280 - : "a" (crw) 269 + " stcrw %[crw]\n" 270 + " ipm %[cc]\n" 271 + " srl %[cc],28\n" 272 + : [cc] "=&d" (ccode), [crw] "=Q" (*crw) 273 + : 281 274 : "cc"); 282 275 return ccode; 283 276 }
+13 -12
drivers/s390/cio/qdio.h
··· 88 88 static inline int do_sqbs(u64 token, unsigned char state, int queue, 89 89 int *start, int *count) 90 90 { 91 - register unsigned long _ccq asm ("0") = *count; 92 - register unsigned long _token asm ("1") = token; 93 91 unsigned long _queuestart = ((unsigned long)queue << 32) | *start; 92 + unsigned long _ccq = *count; 94 93 95 94 asm volatile( 96 - " .insn rsy,0xeb000000008A,%1,0,0(%2)" 97 - : "+d" (_ccq), "+d" (_queuestart) 98 - : "d" ((unsigned long)state), "d" (_token) 99 - : "memory", "cc"); 95 + " lgr 1,%[token]\n" 96 + " .insn rsy,0xeb000000008a,%[qs],%[ccq],0(%[state])" 97 + : [ccq] "+&d" (_ccq), [qs] "+&d" (_queuestart) 98 + : [state] "d" ((unsigned long)state), [token] "d" (token) 99 + : "memory", "cc", "1"); 100 100 *count = _ccq & 0xff; 101 101 *start = _queuestart & 0xff; 102 102 ··· 106 106 static inline int do_eqbs(u64 token, unsigned char *state, int queue, 107 107 int *start, int *count, int ack) 108 108 { 109 - register unsigned long _ccq asm ("0") = *count; 110 - register unsigned long _token asm ("1") = token; 111 109 unsigned long _queuestart = ((unsigned long)queue << 32) | *start; 112 110 unsigned long _state = (unsigned long)ack << 63; 111 + unsigned long _ccq = *count; 113 112 114 113 asm volatile( 115 - " .insn rrf,0xB99c0000,%1,%2,0,0" 116 - : "+d" (_ccq), "+d" (_queuestart), "+d" (_state) 117 - : "d" (_token) 118 - : "memory", "cc"); 114 + " lgr 1,%[token]\n" 115 + " .insn rrf,0xb99c0000,%[qs],%[state],%[ccq],0" 116 + : [ccq] "+&d" (_ccq), [qs] "+&d" (_queuestart), 117 + [state] "+&d" (_state) 118 + : [token] "d" (token) 119 + : "memory", "cc", "1"); 119 120 *count = _ccq & 0xff; 120 121 *start = _queuestart & 0xff; 121 122 *state = _state & 0xff;
+33 -29
drivers/s390/cio/qdio_main.c
··· 31 31 MODULE_LICENSE("GPL"); 32 32 33 33 static inline int do_siga_sync(unsigned long schid, 34 - unsigned int out_mask, unsigned int in_mask, 34 + unsigned long out_mask, unsigned long in_mask, 35 35 unsigned int fc) 36 36 { 37 - register unsigned long __fc asm ("0") = fc; 38 - register unsigned long __schid asm ("1") = schid; 39 - register unsigned long out asm ("2") = out_mask; 40 - register unsigned long in asm ("3") = in_mask; 41 37 int cc; 42 38 43 39 asm volatile( 40 + " lgr 0,%[fc]\n" 41 + " lgr 1,%[schid]\n" 42 + " lgr 2,%[out]\n" 43 + " lgr 3,%[in]\n" 44 44 " siga 0\n" 45 - " ipm %0\n" 46 - " srl %0,28\n" 47 - : "=d" (cc) 48 - : "d" (__fc), "d" (__schid), "d" (out), "d" (in) : "cc"); 45 + " ipm %[cc]\n" 46 + " srl %[cc],28\n" 47 + : [cc] "=&d" (cc) 48 + : [fc] "d" (fc), [schid] "d" (schid), 49 + [out] "d" (out_mask), [in] "d" (in_mask) 50 + : "cc", "0", "1", "2", "3"); 49 51 return cc; 50 52 } 51 53 52 - static inline int do_siga_input(unsigned long schid, unsigned int mask, 53 - unsigned int fc) 54 + static inline int do_siga_input(unsigned long schid, unsigned long mask, 55 + unsigned long fc) 54 56 { 55 - register unsigned long __fc asm ("0") = fc; 56 - register unsigned long __schid asm ("1") = schid; 57 - register unsigned long __mask asm ("2") = mask; 58 57 int cc; 59 58 60 59 asm volatile( 60 + " lgr 0,%[fc]\n" 61 + " lgr 1,%[schid]\n" 62 + " lgr 2,%[mask]\n" 61 63 " siga 0\n" 62 - " ipm %0\n" 63 - " srl %0,28\n" 64 - : "=d" (cc) 65 - : "d" (__fc), "d" (__schid), "d" (__mask) : "cc"); 64 + " ipm %[cc]\n" 65 + " srl %[cc],28\n" 66 + : [cc] "=&d" (cc) 67 + : [fc] "d" (fc), [schid] "d" (schid), [mask] "d" (mask) 68 + : "cc", "0", "1", "2"); 66 69 return cc; 67 70 } 68 71 ··· 81 78 * Note: For IQDC unicast queues only the highest priority queue is processed. 82 79 */ 83 80 static inline int do_siga_output(unsigned long schid, unsigned long mask, 84 - unsigned int *bb, unsigned int fc, 81 + unsigned int *bb, unsigned long fc, 85 82 unsigned long aob) 86 83 { 87 - register unsigned long __fc asm("0") = fc; 88 - register unsigned long __schid asm("1") = schid; 89 - register unsigned long __mask asm("2") = mask; 90 - register unsigned long __aob asm("3") = aob; 91 84 int cc; 92 85 93 86 asm volatile( 87 + " lgr 0,%[fc]\n" 88 + " lgr 1,%[schid]\n" 89 + " lgr 2,%[mask]\n" 90 + " lgr 3,%[aob]\n" 94 91 " siga 0\n" 95 - " ipm %0\n" 96 - " srl %0,28\n" 97 - : "=d" (cc), "+d" (__fc), "+d" (__aob) 98 - : "d" (__schid), "d" (__mask) 99 - : "cc"); 100 - *bb = __fc >> 31; 92 + " lgr %[fc],0\n" 93 + " ipm %[cc]\n" 94 + " srl %[cc],28\n" 95 + : [cc] "=&d" (cc), [fc] "+&d" (fc) 96 + : [schid] "d" (schid), [mask] "d" (mask), [aob] "d" (aob) 97 + : "cc", "0", "1", "2", "3"); 98 + *bb = fc >> 31; 101 99 return cc; 102 100 } 103 101
+2 -4
drivers/s390/cio/trace.h
··· 168 168 memset(&__entry->tpi_info, 0, sizeof(struct tpi_info)); 169 169 else if (addr) 170 170 __entry->tpi_info = *addr; 171 - else { 172 - memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id, 173 - sizeof(struct tpi_info)); 174 - } 171 + else 172 + __entry->tpi_info = S390_lowcore.tpi_info; 175 173 __entry->cssid = __entry->tpi_info.schid.cssid; 176 174 __entry->ssid = __entry->tpi_info.schid.ssid; 177 175 __entry->schno = __entry->tpi_info.schid.sch_no;
+70 -14
drivers/s390/crypto/ap_bus.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * Copyright IBM Corp. 2006, 2020 3 + * Copyright IBM Corp. 2006, 2021 4 4 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 5 5 * Martin Schwidefsky <schwidefsky@de.ibm.com> 6 6 * Ralph Wuerthner <rwuerthn@de.ibm.com> ··· 76 76 77 77 /* # of bus scans since init */ 78 78 static atomic64_t ap_scan_bus_count; 79 + 80 + /* # of bindings complete since init */ 81 + static atomic64_t ap_bindings_complete_count = ATOMIC64_INIT(0); 79 82 80 83 /* completion for initial APQN bindings complete */ 81 84 static DECLARE_COMPLETION(ap_init_apqn_bindings_complete); ··· 587 584 */ 588 585 static int ap_uevent(struct device *dev, struct kobj_uevent_env *env) 589 586 { 590 - int rc; 587 + int rc = 0; 591 588 struct ap_device *ap_dev = to_ap_dev(dev); 592 589 593 590 /* Uevents from ap bus core don't need extensions to the env */ 594 591 if (dev == ap_root_device) 595 592 return 0; 596 593 597 - /* Set up DEV_TYPE environment variable. */ 598 - rc = add_uevent_var(env, "DEV_TYPE=%04X", ap_dev->device_type); 599 - if (rc) 600 - return rc; 594 + if (is_card_dev(dev)) { 595 + struct ap_card *ac = to_ap_card(&ap_dev->device); 601 596 602 - /* Add MODALIAS= */ 603 - rc = add_uevent_var(env, "MODALIAS=ap:t%02X", ap_dev->device_type); 604 - if (rc) 605 - return rc; 597 + /* Set up DEV_TYPE environment variable. */ 598 + rc = add_uevent_var(env, "DEV_TYPE=%04X", ap_dev->device_type); 599 + if (rc) 600 + return rc; 601 + /* Add MODALIAS= */ 602 + rc = add_uevent_var(env, "MODALIAS=ap:t%02X", ap_dev->device_type); 603 + if (rc) 604 + return rc; 605 + 606 + /* Add MODE=<accel|cca|ep11> */ 607 + if (ap_test_bit(&ac->functions, AP_FUNC_ACCEL)) 608 + rc = add_uevent_var(env, "MODE=accel"); 609 + else if (ap_test_bit(&ac->functions, AP_FUNC_COPRO)) 610 + rc = add_uevent_var(env, "MODE=cca"); 611 + else if (ap_test_bit(&ac->functions, AP_FUNC_EP11)) 612 + rc = add_uevent_var(env, "MODE=ep11"); 613 + if (rc) 614 + return rc; 615 + } else { 616 + struct ap_queue *aq = to_ap_queue(&ap_dev->device); 617 + 618 + /* Add MODE=<accel|cca|ep11> */ 619 + if (ap_test_bit(&aq->card->functions, AP_FUNC_ACCEL)) 620 + rc = add_uevent_var(env, "MODE=accel"); 621 + else if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO)) 622 + rc = add_uevent_var(env, "MODE=cca"); 623 + else if (ap_test_bit(&aq->card->functions, AP_FUNC_EP11)) 624 + rc = add_uevent_var(env, "MODE=ep11"); 625 + if (rc) 626 + return rc; 627 + } 606 628 607 629 return 0; 608 630 } ··· 641 613 642 614 static void ap_send_bindings_complete_uevent(void) 643 615 { 644 - char *envp[] = { "BINDINGS=complete", NULL }; 616 + char buf[32]; 617 + char *envp[] = { "BINDINGS=complete", buf, NULL }; 645 618 619 + snprintf(buf, sizeof(buf), "COMPLETECOUNT=%llu", 620 + atomic64_inc_return(&ap_bindings_complete_count)); 646 621 kobject_uevent_env(&ap_root_device->kobj, KOBJ_CHANGE, envp); 647 622 } 623 + 624 + void ap_send_config_uevent(struct ap_device *ap_dev, bool cfg) 625 + { 626 + char buf[16]; 627 + char *envp[] = { buf, NULL }; 628 + 629 + snprintf(buf, sizeof(buf), "CONFIG=%d", cfg ? 1 : 0); 630 + 631 + kobject_uevent_env(&ap_dev->device.kobj, KOBJ_CHANGE, envp); 632 + } 633 + EXPORT_SYMBOL(ap_send_config_uevent); 634 + 635 + void ap_send_online_uevent(struct ap_device *ap_dev, int online) 636 + { 637 + char buf[16]; 638 + char *envp[] = { buf, NULL }; 639 + 640 + snprintf(buf, sizeof(buf), "ONLINE=%d", online ? 1 : 0); 641 + 642 + kobject_uevent_env(&ap_dev->device.kobj, KOBJ_CHANGE, envp); 643 + } 644 + EXPORT_SYMBOL(ap_send_online_uevent); 648 645 649 646 /* 650 647 * calc # of bound APQNs ··· 938 885 struct device_driver *drv = &ap_drv->driver; 939 886 940 887 drv->bus = &ap_bus_type; 941 - drv->probe = ap_device_probe; 942 - drv->remove = ap_device_remove; 943 888 drv->owner = owner; 944 889 drv->name = name; 945 890 return driver_register(drv); ··· 1370 1319 .bus_groups = ap_bus_groups, 1371 1320 .match = &ap_bus_match, 1372 1321 .uevent = &ap_uevent, 1322 + .probe = ap_device_probe, 1323 + .remove = ap_device_remove, 1373 1324 }; 1374 1325 1375 1326 /** ··· 1593 1540 spin_unlock_bh(&aq->lock); 1594 1541 AP_DBF_INFO("%s(%d,%d) queue device config off\n", 1595 1542 __func__, ac->id, dom); 1543 + ap_send_config_uevent(&aq->ap_dev, aq->config); 1596 1544 /* 'receive' pending messages with -EAGAIN */ 1597 1545 ap_flush_queue(aq); 1598 1546 goto put_dev_and_continue; ··· 1608 1554 spin_unlock_bh(&aq->lock); 1609 1555 AP_DBF_INFO("%s(%d,%d) queue device config on\n", 1610 1556 __func__, ac->id, dom); 1557 + ap_send_config_uevent(&aq->ap_dev, aq->config); 1611 1558 goto put_dev_and_continue; 1612 1559 } 1613 1560 /* handle other error states */ ··· 1718 1663 ac->config = false; 1719 1664 AP_DBF_INFO("%s(%d) card device config off\n", 1720 1665 __func__, ap); 1721 - 1666 + ap_send_config_uevent(&ac->ap_dev, ac->config); 1722 1667 } 1723 1668 if (!decfg && !ac->config) { 1724 1669 ac->config = true; 1725 1670 AP_DBF_INFO("%s(%d) card device config on\n", 1726 1671 __func__, ap); 1672 + ap_send_config_uevent(&ac->ap_dev, ac->config); 1727 1673 } 1728 1674 } 1729 1675 }
+3
drivers/s390/crypto/ap_bus.h
··· 362 362 */ 363 363 int ap_wait_init_apqn_bindings_complete(unsigned long timeout); 364 364 365 + void ap_send_config_uevent(struct ap_device *ap_dev, bool cfg); 366 + void ap_send_online_uevent(struct ap_device *ap_dev, int online); 367 + 365 368 #endif /* _AP_BUS_H_ */
+2
drivers/s390/crypto/ap_card.c
··· 167 167 168 168 ac->config = cfg ? true : false; 169 169 170 + ap_send_config_uevent(&ac->ap_dev, ac->config); 171 + 170 172 return count; 171 173 } 172 174
+6 -7
drivers/s390/crypto/vfio_ap_drv.c
··· 22 22 MODULE_DESCRIPTION("VFIO AP device driver, Copyright IBM Corp. 2018"); 23 23 MODULE_LICENSE("GPL v2"); 24 24 25 - static struct ap_driver vfio_ap_drv; 26 - 27 25 struct ap_matrix_dev *matrix_dev; 28 26 29 27 /* Only type 10 adapters (CEX4 and later) are supported ··· 77 79 kfree(q); 78 80 mutex_unlock(&matrix_dev->lock); 79 81 } 82 + 83 + static struct ap_driver vfio_ap_drv = { 84 + .probe = vfio_ap_queue_dev_probe, 85 + .remove = vfio_ap_queue_dev_remove, 86 + .ids = ap_queue_ids, 87 + }; 80 88 81 89 static void vfio_ap_matrix_dev_release(struct device *dev) 82 90 { ··· 184 180 ret = vfio_ap_matrix_dev_create(); 185 181 if (ret) 186 182 return ret; 187 - 188 - memset(&vfio_ap_drv, 0, sizeof(vfio_ap_drv)); 189 - vfio_ap_drv.probe = vfio_ap_queue_dev_probe; 190 - vfio_ap_drv.remove = vfio_ap_queue_dev_remove; 191 - vfio_ap_drv.ids = ap_queue_ids; 192 183 193 184 ret = ap_driver_register(&vfio_ap_drv, THIS_MODULE, VFIO_AP_DRV_NAME); 194 185 if (ret) {
-1
drivers/s390/crypto/zcrypt_api.c
··· 59 59 60 60 DEFINE_SPINLOCK(zcrypt_list_lock); 61 61 LIST_HEAD(zcrypt_card_list); 62 - int zcrypt_device_count; 63 62 64 63 static atomic_t zcrypt_open_count = ATOMIC_INIT(0); 65 64 static atomic_t zcrypt_rescan_count = ATOMIC_INIT(0);
+1 -2
drivers/s390/crypto/zcrypt_api.h
··· 124 124 extern atomic_t zcrypt_rescan_req; 125 125 126 126 extern spinlock_t zcrypt_list_lock; 127 - extern int zcrypt_device_count; 128 127 extern struct list_head zcrypt_card_list; 129 128 130 129 #define for_each_zcrypt_card(_zc) \ ··· 145 146 int zcrypt_queue_put(struct zcrypt_queue *); 146 147 int zcrypt_queue_register(struct zcrypt_queue *); 147 148 void zcrypt_queue_unregister(struct zcrypt_queue *); 148 - void zcrypt_queue_force_online(struct zcrypt_queue *, int); 149 + bool zcrypt_queue_force_online(struct zcrypt_queue *zq, int online); 149 150 150 151 int zcrypt_rng_device_add(void); 151 152 void zcrypt_rng_device_remove(void);
+28 -2
drivers/s390/crypto/zcrypt_card.c
··· 64 64 struct ap_card *ac = to_ap_card(dev); 65 65 struct zcrypt_card *zc = ac->private; 66 66 struct zcrypt_queue *zq; 67 - int online, id; 67 + int online, id, i = 0, maxzqs = 0; 68 + struct zcrypt_queue **zq_uelist = NULL; 68 69 69 70 if (sscanf(buf, "%d\n", &online) != 1 || online < 0 || online > 1) 70 71 return -EINVAL; ··· 78 77 79 78 ZCRYPT_DBF(DBF_INFO, "card=%02x online=%d\n", id, online); 80 79 80 + ap_send_online_uevent(&ac->ap_dev, online); 81 + 81 82 spin_lock(&zcrypt_list_lock); 83 + /* 84 + * As we are in atomic context here, directly sending uevents 85 + * does not work. So collect the zqueues in a dynamic array 86 + * and process them after zcrypt_list_lock release. As we get/put 87 + * the zqueue objects, we make sure they exist after lock release. 88 + */ 82 89 list_for_each_entry(zq, &zc->zqueues, list) 83 - zcrypt_queue_force_online(zq, online); 90 + maxzqs++; 91 + if (maxzqs > 0) 92 + zq_uelist = kcalloc(maxzqs + 1, sizeof(zq), GFP_ATOMIC); 93 + list_for_each_entry(zq, &zc->zqueues, list) 94 + if (zcrypt_queue_force_online(zq, online)) 95 + if (zq_uelist) { 96 + zcrypt_queue_get(zq); 97 + zq_uelist[i++] = zq; 98 + } 84 99 spin_unlock(&zcrypt_list_lock); 100 + if (zq_uelist) { 101 + for (i = 0; zq_uelist[i]; i++) { 102 + zq = zq_uelist[i]; 103 + ap_send_online_uevent(&zq->queue->ap_dev, online); 104 + zcrypt_queue_put(zq); 105 + } 106 + kfree(zq_uelist); 107 + } 108 + 85 109 return count; 86 110 } 87 111
+7 -7
drivers/s390/crypto/zcrypt_ccamisc.c
··· 295 295 * Generate (random) CCA AES DATA secure key. 296 296 */ 297 297 int cca_genseckey(u16 cardnr, u16 domain, 298 - u32 keybitsize, u8 seckey[SECKEYBLOBSIZE]) 298 + u32 keybitsize, u8 *seckey) 299 299 { 300 300 int i, rc, keysize; 301 301 int seckeysize; ··· 330 330 struct { 331 331 u16 toklen; 332 332 u16 tokattr; 333 - u8 tok[0]; 333 + u8 tok[]; 334 334 /* ... some more data ... */ 335 335 } keyblock; 336 336 } lv3; ··· 438 438 * Generate an CCA AES DATA secure key with given key value. 439 439 */ 440 440 int cca_clr2seckey(u16 cardnr, u16 domain, u32 keybitsize, 441 - const u8 *clrkey, u8 seckey[SECKEYBLOBSIZE]) 441 + const u8 *clrkey, u8 *seckey) 442 442 { 443 443 int rc, keysize, seckeysize; 444 444 u8 *mem, *ptr; ··· 471 471 struct { 472 472 u16 toklen; 473 473 u16 tokattr; 474 - u8 tok[0]; 474 + u8 tok[]; 475 475 /* ... some more data ... */ 476 476 } keyblock; 477 477 } lv3; ··· 577 577 * Derive proteced key from an CCA AES DATA secure key. 578 578 */ 579 579 int cca_sec2protkey(u16 cardnr, u16 domain, 580 - const u8 seckey[SECKEYBLOBSIZE], 581 - u8 *protkey, u32 *protkeylen, u32 *protkeytype) 580 + const u8 *seckey, u8 *protkey, u32 *protkeylen, 581 + u32 *protkeytype) 582 582 { 583 583 int rc; 584 584 u8 *mem, *ptr; ··· 596 596 u16 len; 597 597 u16 attr_len; 598 598 u16 attr_flags; 599 - u8 token[0]; /* cca secure key token */ 599 + u8 token[]; /* cca secure key token */ 600 600 } lv2; 601 601 } __packed * preqparm; 602 602 struct uskrepparm {
+2 -2
drivers/s390/crypto/zcrypt_ccamisc.h
··· 171 171 * Derive proteced key from an CCA AES DATA secure key. 172 172 */ 173 173 int cca_sec2protkey(u16 cardnr, u16 domain, 174 - const u8 seckey[SECKEYBLOBSIZE], 175 - u8 *protkey, u32 *protkeylen, u32 *protkeytype); 174 + const u8 *seckey, u8 *protkey, u32 *protkeylen, 175 + u32 *protkeytype); 176 176 177 177 /* 178 178 * Generate (random) CCA AES CIPHER secure key.
+2
drivers/s390/crypto/zcrypt_msgtype50.c
··· 375 375 AP_QID_CARD(zq->queue->qid), 376 376 AP_QID_QUEUE(zq->queue->qid), 377 377 t80h->code); 378 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 378 379 return -EAGAIN; 379 380 } 380 381 if (zq->zcard->user_space_type == ZCRYPT_CEX2A) ··· 413 412 AP_QID_CARD(zq->queue->qid), 414 413 AP_QID_QUEUE(zq->queue->qid), 415 414 (int) rtype); 415 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 416 416 return -EAGAIN; 417 417 } 418 418 }
+5
drivers/s390/crypto/zcrypt_msgtype6.c
··· 675 675 AP_QID_CARD(zq->queue->qid), 676 676 AP_QID_QUEUE(zq->queue->qid), 677 677 (int) service_rc, (int) service_rs); 678 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 678 679 return -EAGAIN; 679 680 } 680 681 data = msg->text; ··· 821 820 AP_QID_CARD(zq->queue->qid), 822 821 AP_QID_QUEUE(zq->queue->qid), 823 822 (int) msg->hdr.type); 823 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 824 824 return -EAGAIN; 825 825 } 826 826 } ··· 856 854 AP_QID_CARD(zq->queue->qid), 857 855 AP_QID_QUEUE(zq->queue->qid), 858 856 (int) msg->hdr.type); 857 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 859 858 return -EAGAIN; 860 859 } 861 860 } ··· 886 883 AP_QID_CARD(zq->queue->qid), 887 884 AP_QID_QUEUE(zq->queue->qid), 888 885 (int) msg->hdr.type); 886 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 889 887 return -EAGAIN; 890 888 } 891 889 } ··· 917 913 AP_QID_CARD(zq->queue->qid), 918 914 AP_QID_QUEUE(zq->queue->qid), 919 915 (int) msg->hdr.type); 916 + ap_send_online_uevent(&zq->queue->ap_dev, zq->online); 920 917 return -EAGAIN; 921 918 } 922 919 }
+10 -6
drivers/s390/crypto/zcrypt_queue.c
··· 70 70 AP_QID_QUEUE(zq->queue->qid), 71 71 online); 72 72 73 + ap_send_online_uevent(&aq->ap_dev, online); 74 + 73 75 if (!online) 74 76 ap_flush_queue(zq->queue); 75 77 return count; ··· 100 98 .attrs = zcrypt_queue_attrs, 101 99 }; 102 100 103 - void zcrypt_queue_force_online(struct zcrypt_queue *zq, int online) 101 + bool zcrypt_queue_force_online(struct zcrypt_queue *zq, int online) 104 102 { 105 - zq->online = online; 106 - if (!online) 107 - ap_flush_queue(zq->queue); 103 + if (!!zq->online != !!online) { 104 + zq->online = online; 105 + if (!online) 106 + ap_flush_queue(zq->queue); 107 + return true; 108 + } 109 + return false; 108 110 } 109 111 110 112 struct zcrypt_queue *zcrypt_queue_alloc(size_t max_response_size) ··· 179 173 AP_QID_CARD(zq->queue->qid), AP_QID_QUEUE(zq->queue->qid)); 180 174 181 175 list_add_tail(&zq->list, &zc->zqueues); 182 - zcrypt_device_count++; 183 176 spin_unlock(&zcrypt_list_lock); 184 177 185 178 rc = sysfs_create_group(&zq->queue->ap_dev.device.kobj, ··· 221 216 zc = zq->zcard; 222 217 spin_lock(&zcrypt_list_lock); 223 218 list_del_init(&zq->list); 224 - zcrypt_device_count--; 225 219 spin_unlock(&zcrypt_list_lock); 226 220 if (zq->ops->rng) 227 221 zcrypt_rng_device_remove();
+4 -26
drivers/s390/virtio/virtio_ccw.c
··· 388 388 ccw_device_dma_free(vcdev->cdev, thinint_area, sizeof(*thinint_area)); 389 389 } 390 390 391 - static inline long __do_kvm_notify(struct subchannel_id schid, 392 - unsigned long queue_index, 393 - long cookie) 394 - { 395 - register unsigned long __nr asm("1") = KVM_S390_VIRTIO_CCW_NOTIFY; 396 - register struct subchannel_id __schid asm("2") = schid; 397 - register unsigned long __index asm("3") = queue_index; 398 - register long __rc asm("2"); 399 - register long __cookie asm("4") = cookie; 400 - 401 - asm volatile ("diag 2,4,0x500\n" 402 - : "=d" (__rc) : "d" (__nr), "d" (__schid), "d" (__index), 403 - "d"(__cookie) 404 - : "memory", "cc"); 405 - return __rc; 406 - } 407 - 408 - static inline long do_kvm_notify(struct subchannel_id schid, 409 - unsigned long queue_index, 410 - long cookie) 411 - { 412 - diag_stat_inc(DIAG_STAT_X500); 413 - return __do_kvm_notify(schid, queue_index, cookie); 414 - } 415 - 416 391 static bool virtio_ccw_kvm_notify(struct virtqueue *vq) 417 392 { 418 393 struct virtio_ccw_vq_info *info = vq->priv; ··· 396 421 397 422 vcdev = to_vc_device(info->vq->vdev); 398 423 ccw_device_get_schid(vcdev->cdev, &schid); 399 - info->cookie = do_kvm_notify(schid, vq->index, info->cookie); 424 + BUILD_BUG_ON(sizeof(struct subchannel_id) != sizeof(unsigned int)); 425 + info->cookie = kvm_hypercall3(KVM_S390_VIRTIO_CCW_NOTIFY, 426 + *((unsigned int *)&schid), 427 + vq->index, info->cookie); 400 428 if (info->cookie < 0) 401 429 return false; 402 430 return true;
-51
drivers/tty/hvc/hvc_iucv.c
··· 966 966 destroy_tty_buffer_list(&list_remove); 967 967 } 968 968 969 - /** 970 - * hvc_iucv_pm_freeze() - Freeze PM callback 971 - * @dev: IUVC HVC terminal device 972 - * 973 - * Sever an established IUCV communication path and 974 - * trigger a hang-up of the underlying HVC terminal. 975 - */ 976 - static int hvc_iucv_pm_freeze(struct device *dev) 977 - { 978 - struct hvc_iucv_private *priv = dev_get_drvdata(dev); 979 - 980 - local_bh_disable(); 981 - hvc_iucv_hangup(priv); 982 - local_bh_enable(); 983 - 984 - return 0; 985 - } 986 - 987 - /** 988 - * hvc_iucv_pm_restore_thaw() - Thaw and restore PM callback 989 - * @dev: IUVC HVC terminal device 990 - * 991 - * Wake up the HVC thread to trigger hang-up and respective 992 - * HVC back-end notifier invocations. 993 - */ 994 - static int hvc_iucv_pm_restore_thaw(struct device *dev) 995 - { 996 - hvc_kick(); 997 - return 0; 998 - } 999 - 1000 969 static ssize_t hvc_iucv_dev_termid_show(struct device *dev, 1001 970 struct device_attribute *attr, 1002 971 char *buf) ··· 1018 1049 .notifier_del = hvc_iucv_notifier_del, 1019 1050 .notifier_hangup = hvc_iucv_notifier_hangup, 1020 1051 .dtr_rts = hvc_iucv_dtr_rts, 1021 - }; 1022 - 1023 - /* Suspend / resume device operations */ 1024 - static const struct dev_pm_ops hvc_iucv_pm_ops = { 1025 - .freeze = hvc_iucv_pm_freeze, 1026 - .thaw = hvc_iucv_pm_restore_thaw, 1027 - .restore = hvc_iucv_pm_restore_thaw, 1028 - }; 1029 - 1030 - /* IUCV HVC device driver */ 1031 - static struct device_driver hvc_iucv_driver = { 1032 - .name = KMSG_COMPONENT, 1033 - .bus = &iucv_bus, 1034 - .pm = &hvc_iucv_pm_ops, 1035 1052 }; 1036 1053 1037 1054 /* IUCV HVC device attributes */ ··· 1099 1144 dev_set_drvdata(priv->dev, priv); 1100 1145 priv->dev->bus = &iucv_bus; 1101 1146 priv->dev->parent = iucv_root; 1102 - priv->dev->driver = &hvc_iucv_driver; 1103 1147 priv->dev->groups = hvc_iucv_dev_attr_groups; 1104 1148 priv->dev->release = (void (*)(struct device *)) kfree; 1105 1149 rc = device_register(priv->dev); ··· 1329 1375 rc = -EINVAL; 1330 1376 goto out_error; 1331 1377 } 1332 - 1333 - /* register IUCV HVC device driver */ 1334 - rc = driver_register(&hvc_iucv_driver); 1335 - if (rc) 1336 - goto out_error; 1337 1378 1338 1379 /* parse hvc_iucv_allow string and create z/VM user ID filter list */ 1339 1380 if (hvc_iucv_filter_string) {
+6 -1
scripts/min-tool-version.sh
··· 30 30 echo 16.0.3 31 31 ;; 32 32 llvm) 33 - echo 10.0.1 33 + # https://lore.kernel.org/r/YMtib5hKVyNknZt3@osiris/ 34 + if [ "$SRCARCH" = s390 ]; then 35 + echo 13.0.0 36 + else 37 + echo 10.0.1 38 + fi 34 39 ;; 35 40 *) 36 41 echo "$1: unknown tool" >&2