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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 updates from Martin Schwidefsky:
"This is the bulk of the s390 patches for the 3.11 merge window.

Notable enhancements are: the block timeout patches for dasd from
Hannes, and more work on the PCI support front. In addition some
cleanup and the usual bug fixing."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (42 commits)
s390/dasd: Fail all requests when DASD_FLAG_ABORTIO is set
s390/dasd: Add 'timeout' attribute
block: check for timeout function in blk_rq_timed_out()
block/dasd: detailed I/O errors
s390/dasd: Reduce amount of messages for specific errors
s390/dasd: Implement block timeout handling
s390/dasd: process all requests in the device tasklet
s390/dasd: make number of retries configurable
s390/dasd: Clarify comment
s390/hwsampler: Updated misleading member names in hws_data_entry
s390/appldata_net_sum: do not use static data
s390/appldata_mem: do not use static data
s390/vmwatchdog: do not use static data
s390/airq: simplify adapter interrupt code
s390/pci: remove per device debug attribute
s390/dma: remove gratuitous brackets
s390/facility: decompose test_facility()
s390/sclp: remove duplicated include from sclp_ctl.c
s390/irq: store interrupt information in pt_regs
s390/drivers: Cocci spatch "ptr_ret.spatch"
...

+1321 -565
+1
Documentation/ioctl/ioctl-number.txt
··· 72 72 0x06 all linux/lp.h 73 73 0x09 all linux/raid/md_u.h 74 74 0x10 00-0F drivers/char/s390/vmcp.h 75 + 0x10 10-1F arch/s390/include/uapi/sclp_ctl.h 75 76 0x12 all linux/fs.h 76 77 linux/blkpg.h 77 78 0x1b all InfiniBand Subsystem <http://infiniband.sourceforge.net/>
+14 -4
arch/s390/appldata/appldata_mem.c
··· 32 32 * book: 33 33 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 34 34 */ 35 - static struct appldata_mem_data { 35 + struct appldata_mem_data { 36 36 u64 timestamp; 37 37 u32 sync_count_1; /* after VM collected the record data, */ 38 38 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the ··· 63 63 u64 pgmajfault; /* page faults (major only) */ 64 64 // <-- New in 2.6 65 65 66 - } __attribute__((packed)) appldata_mem_data; 66 + } __packed; 67 67 68 68 69 69 /* ··· 118 118 .record_nr = APPLDATA_RECORD_MEM_ID, 119 119 .size = sizeof(struct appldata_mem_data), 120 120 .callback = &appldata_get_mem_data, 121 - .data = &appldata_mem_data, 122 121 .owner = THIS_MODULE, 123 122 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ 124 123 }; ··· 130 131 */ 131 132 static int __init appldata_mem_init(void) 132 133 { 133 - return appldata_register_ops(&ops); 134 + int ret; 135 + 136 + ops.data = kzalloc(sizeof(struct appldata_mem_data), GFP_KERNEL); 137 + if (!ops.data) 138 + return -ENOMEM; 139 + 140 + ret = appldata_register_ops(&ops); 141 + if (ret) 142 + kfree(ops.data); 143 + 144 + return ret; 134 145 } 135 146 136 147 /* ··· 151 142 static void __exit appldata_mem_exit(void) 152 143 { 153 144 appldata_unregister_ops(&ops); 145 + kfree(ops.data); 154 146 } 155 147 156 148
+14 -4
arch/s390/appldata/appldata_net_sum.c
··· 29 29 * book: 30 30 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 31 31 */ 32 - static struct appldata_net_sum_data { 32 + struct appldata_net_sum_data { 33 33 u64 timestamp; 34 34 u32 sync_count_1; /* after VM collected the record data, */ 35 35 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the ··· 51 51 u64 rx_dropped; /* no space in linux buffers */ 52 52 u64 tx_dropped; /* no space available in linux */ 53 53 u64 collisions; /* collisions while transmitting */ 54 - } __attribute__((packed)) appldata_net_sum_data; 54 + } __packed; 55 55 56 56 57 57 /* ··· 121 121 .record_nr = APPLDATA_RECORD_NET_SUM_ID, 122 122 .size = sizeof(struct appldata_net_sum_data), 123 123 .callback = &appldata_get_net_sum_data, 124 - .data = &appldata_net_sum_data, 125 124 .owner = THIS_MODULE, 126 125 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ 127 126 }; ··· 133 134 */ 134 135 static int __init appldata_net_init(void) 135 136 { 136 - return appldata_register_ops(&ops); 137 + int ret; 138 + 139 + ops.data = kzalloc(sizeof(struct appldata_net_sum_data), GFP_KERNEL); 140 + if (!ops.data) 141 + return -ENOMEM; 142 + 143 + ret = appldata_register_ops(&ops); 144 + if (ret) 145 + kfree(ops.data); 146 + 147 + return ret; 137 148 } 138 149 139 150 /* ··· 154 145 static void __exit appldata_net_exit(void) 155 146 { 156 147 appldata_unregister_ops(&ops); 148 + kfree(ops.data); 157 149 } 158 150 159 151
+2 -6
arch/s390/hypfs/hypfs_diag.c
··· 651 651 } 652 652 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); 653 653 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 654 - if (IS_ERR(rc)) 655 - return PTR_ERR(rc); 656 - return 0; 654 + return PTR_RET(rc); 657 655 } 658 656 659 657 static void *hypfs_create_lpar_files(struct super_block *sb, ··· 700 702 return PTR_ERR(rc); 701 703 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); 702 704 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 703 - if (IS_ERR(rc)) 704 - return PTR_ERR(rc); 705 - return 0; 705 + return PTR_RET(rc); 706 706 } 707 707 708 708 static void *hypfs_create_phys_files(struct super_block *sb,
+12 -3
arch/s390/include/asm/airq.h
··· 9 9 #ifndef _ASM_S390_AIRQ_H 10 10 #define _ASM_S390_AIRQ_H 11 11 12 - typedef void (*adapter_int_handler_t)(void *, void *); 12 + struct airq_struct { 13 + struct hlist_node list; /* Handler queueing. */ 14 + void (*handler)(struct airq_struct *); /* Thin-interrupt handler */ 15 + u8 *lsi_ptr; /* Local-Summary-Indicator pointer */ 16 + u8 lsi_mask; /* Local-Summary-Indicator mask */ 17 + u8 isc; /* Interrupt-subclass */ 18 + u8 flags; 19 + }; 13 20 14 - void *s390_register_adapter_interrupt(adapter_int_handler_t, void *, u8); 15 - void s390_unregister_adapter_interrupt(void *, u8); 21 + #define AIRQ_PTR_ALLOCATED 0x01 22 + 23 + int register_adapter_interrupt(struct airq_struct *airq); 24 + void unregister_adapter_interrupt(struct airq_struct *airq); 16 25 17 26 #endif /* _ASM_S390_AIRQ_H */
+1 -1
arch/s390/include/asm/dma-mapping.h
··· 53 53 debug_dma_mapping_error(dev, dma_addr); 54 54 if (dma_ops->mapping_error) 55 55 return dma_ops->mapping_error(dev, dma_addr); 56 - return (dma_addr == DMA_ERROR_CODE); 56 + return dma_addr == DMA_ERROR_CODE; 57 57 } 58 58 59 59 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
+11 -6
arch/s390/include/asm/facility.h
··· 13 13 14 14 #define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */ 15 15 16 + static inline int __test_facility(unsigned long nr, void *facilities) 17 + { 18 + unsigned char *ptr; 19 + 20 + if (nr >= MAX_FACILITY_BIT) 21 + return 0; 22 + ptr = (unsigned char *) facilities + (nr >> 3); 23 + return (*ptr & (0x80 >> (nr & 7))) != 0; 24 + } 25 + 16 26 /* 17 27 * The test_facility function uses the bit odering where the MSB is bit 0. 18 28 * That makes it easier to query facility bits with the bit number as ··· 30 20 */ 31 21 static inline int test_facility(unsigned long nr) 32 22 { 33 - unsigned char *ptr; 34 - 35 - if (nr >= MAX_FACILITY_BIT) 36 - return 0; 37 - ptr = (unsigned char *) &S390_lowcore.stfle_fac_list + (nr >> 3); 38 - return (*ptr & (0x80 >> (nr & 7))) != 0; 23 + return __test_facility(nr, &S390_lowcore.stfle_fac_list); 39 24 } 40 25 41 26 /**
-22
arch/s390/include/asm/io.h
··· 13 13 #include <asm/page.h> 14 14 #include <asm/pci_io.h> 15 15 16 - /* 17 - * Change virtual addresses to physical addresses and vv. 18 - * These are pretty trivial 19 - */ 20 - static inline unsigned long virt_to_phys(volatile void * address) 21 - { 22 - unsigned long real_address; 23 - asm volatile( 24 - " lra %0,0(%1)\n" 25 - " jz 0f\n" 26 - " la %0,0\n" 27 - "0:" 28 - : "=a" (real_address) : "a" (address) : "cc"); 29 - return real_address; 30 - } 31 - #define virt_to_phys virt_to_phys 32 - 33 - static inline void * phys_to_virt(unsigned long address) 34 - { 35 - return (void *) address; 36 - } 37 - 38 16 void *xlate_dev_mem_ptr(unsigned long phys); 39 17 #define xlate_dev_mem_ptr xlate_dev_mem_ptr 40 18 void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
-2
arch/s390/include/asm/pci.h
··· 120 120 121 121 struct dentry *debugfs_dev; 122 122 struct dentry *debugfs_perf; 123 - struct dentry *debugfs_debug; 124 123 }; 125 124 126 125 struct pci_hp_callback_ops { ··· 142 143 int zpci_disable_device(struct zpci_dev *); 143 144 void zpci_stop_device(struct zpci_dev *); 144 145 void zpci_free_device(struct zpci_dev *); 145 - int zpci_scan_device(struct zpci_dev *); 146 146 int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); 147 147 int zpci_unregister_ioat(struct zpci_dev *, u8); 148 148
+3
arch/s390/include/asm/pgalloc.h
··· 22 22 void page_table_free(struct mm_struct *, unsigned long *); 23 23 void page_table_free_rcu(struct mmu_gather *, unsigned long *); 24 24 25 + int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, 26 + unsigned long key, bool nq); 27 + 25 28 static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 26 29 { 27 30 typedef struct { char _[n]; } addrtype;
+1
arch/s390/include/asm/ptrace.h
··· 24 24 unsigned long gprs[NUM_GPRS]; 25 25 unsigned long orig_gpr2; 26 26 unsigned int int_code; 27 + unsigned int int_parm; 27 28 unsigned long int_parm_long; 28 29 }; 29 30
+1
arch/s390/include/uapi/asm/Kbuild
··· 35 35 header-y += signal.h 36 36 header-y += socket.h 37 37 header-y += sockios.h 38 + header-y += sclp_ctl.h 38 39 header-y += stat.h 39 40 header-y += statfs.h 40 41 header-y += swab.h
+13
arch/s390/include/uapi/asm/chsc.h
··· 29 29 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)]; 30 30 } __attribute__ ((packed)); 31 31 32 + struct chsc_header { 33 + __u16 length; 34 + __u16 code; 35 + } __attribute__ ((packed)); 36 + 37 + struct chsc_sync_area { 38 + struct chsc_header header; 39 + __u8 data[CHSC_SIZE - sizeof(struct chsc_header)]; 40 + } __attribute__ ((packed)); 41 + 32 42 struct chsc_response_struct { 33 43 __u16 length; 34 44 __u16 code; ··· 136 126 #define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list) 137 127 #define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info) 138 128 #define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal) 129 + #define CHSC_START_SYNC _IOWR(CHSC_IOCTL_MAGIC, 0x89, struct chsc_sync_area) 130 + #define CHSC_ON_CLOSE_SET _IOWR(CHSC_IOCTL_MAGIC, 0x8a, struct chsc_async_area) 131 + #define CHSC_ON_CLOSE_REMOVE _IO(CHSC_IOCTL_MAGIC, 0x8b) 139 132 140 133 #endif
+4
arch/s390/include/uapi/asm/dasd.h
··· 261 261 #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6) 262 262 /* Resume IO on device */ 263 263 #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7) 264 + /* Abort all I/O on a device */ 265 + #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240) 266 + /* Allow I/O on a device */ 267 + #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241) 264 268 265 269 266 270 /* retrieve API version number */
+24
arch/s390/include/uapi/asm/sclp_ctl.h
··· 1 + /* 2 + * IOCTL interface for SCLP 3 + * 4 + * Copyright IBM Corp. 2012 5 + * 6 + * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com> 7 + */ 8 + 9 + #ifndef _ASM_SCLP_CTL_H 10 + #define _ASM_SCLP_CTL_H 11 + 12 + #include <linux/types.h> 13 + 14 + struct sclp_ctl_sccb { 15 + __u32 cmdw; 16 + __u64 sccb; 17 + } __attribute__((packed)); 18 + 19 + #define SCLP_CTL_IOCTL_MAGIC 0x10 20 + 21 + #define SCLP_CTL_SCCB \ 22 + _IOWR(SCLP_CTL_IOCTL_MAGIC, 0x10, struct sclp_ctl_sccb) 23 + 24 + #endif
+1
arch/s390/kernel/asm-offsets.c
··· 47 47 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs)); 48 48 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2)); 49 49 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code)); 50 + DEFINE(__PT_INT_PARM, offsetof(struct pt_regs, int_parm)); 50 51 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long)); 51 52 DEFINE(__PT_SIZE, sizeof(struct pt_regs)); 52 53 BLANK();
+10 -2
arch/s390/kernel/entry.S
··· 429 429 stm %r0,%r7,__PT_R0(%r11) 430 430 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC 431 431 stm %r8,%r9,__PT_PSW(%r11) 432 + mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 432 433 TRACE_IRQS_OFF 433 434 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 435 + io_loop: 434 436 l %r1,BASED(.Ldo_IRQ) 435 437 lr %r2,%r11 # pass pointer to pt_regs 436 438 basr %r14,%r1 # call do_IRQ 439 + tm __LC_MACHINE_FLAGS+2,0x10 # MACHINE_FLAG_LPAR 440 + jz io_return 441 + tpi 0 442 + jz io_return 443 + mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 444 + j io_loop 437 445 io_return: 438 446 LOCKDEP_SYS_EXIT 439 447 TRACE_IRQS_ON ··· 581 573 stm %r0,%r7,__PT_R0(%r11) 582 574 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC 583 575 stm %r8,%r9,__PT_PSW(%r11) 576 + mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR 577 + mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS 584 578 TRACE_IRQS_OFF 585 579 lr %r2,%r11 # pass pointer to pt_regs 586 - l %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code 587 - l %r4,__LC_EXT_PARAMS # get external parameters 588 580 l %r1,BASED(.Ldo_extint) 589 581 basr %r14,%r1 # call do_extint 590 582 j io_return
+1 -1
arch/s390/kernel/entry.h
··· 54 54 void do_notify_resume(struct pt_regs *regs); 55 55 56 56 struct ext_code; 57 - void do_extint(struct pt_regs *regs, struct ext_code, unsigned int, unsigned long); 57 + void do_extint(struct pt_regs *regs); 58 58 void do_restart(void); 59 59 void __init startup_init(void); 60 60 void die(struct pt_regs *regs, const char *str);
+12 -4
arch/s390/kernel/entry64.S
··· 460 460 stmg %r0,%r7,__PT_R0(%r11) 461 461 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 462 462 stmg %r8,%r9,__PT_PSW(%r11) 463 + mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 463 464 TRACE_IRQS_OFF 464 465 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 466 + io_loop: 465 467 lgr %r2,%r11 # pass pointer to pt_regs 466 468 brasl %r14,do_IRQ 469 + tm __LC_MACHINE_FLAGS+6,0x10 # MACHINE_FLAG_LPAR 470 + jz io_return 471 + tpi 0 472 + jz io_return 473 + mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 474 + j io_loop 467 475 io_return: 468 476 LOCKDEP_SYS_EXIT 469 477 TRACE_IRQS_ON ··· 613 605 stmg %r0,%r7,__PT_R0(%r11) 614 606 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 615 607 stmg %r8,%r9,__PT_PSW(%r11) 608 + lghi %r1,__LC_EXT_PARAMS2 609 + mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR 610 + mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS 611 + mvc __PT_INT_PARM_LONG(8,%r11),0(%r1) 616 612 TRACE_IRQS_OFF 617 613 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 618 - lghi %r1,4096 619 614 lgr %r2,%r11 # pass pointer to pt_regs 620 - llgf %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code 621 - llgf %r4,__LC_EXT_PARAMS # get external parameter 622 - lg %r5,__LC_EXT_PARAMS2-4096(%r1) # get 64 bit external parameter 623 615 brasl %r14,do_extint 624 616 j io_return 625 617
+5 -3
arch/s390/kernel/irq.c
··· 234 234 } 235 235 EXPORT_SYMBOL(unregister_external_interrupt); 236 236 237 - void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, 238 - unsigned int param32, unsigned long param64) 237 + void __irq_entry do_extint(struct pt_regs *regs) 239 238 { 239 + struct ext_code ext_code; 240 240 struct pt_regs *old_regs; 241 241 struct ext_int_info *p; 242 242 int index; ··· 248 248 clock_comparator_work(); 249 249 } 250 250 kstat_incr_irqs_this_cpu(EXTERNAL_INTERRUPT, NULL); 251 + ext_code = *(struct ext_code *) &regs->int_code; 251 252 if (ext_code.code != 0x1004) 252 253 __get_cpu_var(s390_idle).nohz_delay = 1; 253 254 ··· 256 255 rcu_read_lock(); 257 256 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 258 257 if (likely(p->code == ext_code.code)) 259 - p->handler(ext_code, param32, param64); 258 + p->handler(ext_code, regs->int_parm, 259 + regs->int_parm_long); 260 260 rcu_read_unlock(); 261 261 irq_exit(); 262 262 set_irq_regs(old_regs);
+1 -4
arch/s390/kernel/smp.c
··· 49 49 50 50 enum { 51 51 ec_schedule = 0, 52 - ec_call_function, 53 52 ec_call_function_single, 54 53 ec_stop_cpu, 55 54 }; ··· 437 438 smp_stop_cpu(); 438 439 if (test_bit(ec_schedule, &bits)) 439 440 scheduler_ipi(); 440 - if (test_bit(ec_call_function, &bits)) 441 - generic_smp_call_function_interrupt(); 442 441 if (test_bit(ec_call_function_single, &bits)) 443 442 generic_smp_call_function_single_interrupt(); 444 443 } ··· 453 456 int cpu; 454 457 455 458 for_each_cpu(cpu, mask) 456 - pcpu_ec_call(pcpu_devices + cpu, ec_call_function); 459 + pcpu_ec_call(pcpu_devices + cpu, ec_call_function_single); 457 460 } 458 461 459 462 void arch_send_call_function_single_ipi(int cpu)
+48
arch/s390/mm/pgtable.c
··· 771 771 __free_page(page); 772 772 } 773 773 774 + int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, 775 + unsigned long key, bool nq) 776 + { 777 + spinlock_t *ptl; 778 + pgste_t old, new; 779 + pte_t *ptep; 780 + 781 + down_read(&mm->mmap_sem); 782 + ptep = get_locked_pte(current->mm, addr, &ptl); 783 + if (unlikely(!ptep)) { 784 + up_read(&mm->mmap_sem); 785 + return -EFAULT; 786 + } 787 + 788 + new = old = pgste_get_lock(ptep); 789 + pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | 790 + PGSTE_ACC_BITS | PGSTE_FP_BIT); 791 + pgste_val(new) |= (key & (_PAGE_CHANGED | _PAGE_REFERENCED)) << 48; 792 + pgste_val(new) |= (key & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56; 793 + if (!(pte_val(*ptep) & _PAGE_INVALID)) { 794 + unsigned long address, bits; 795 + unsigned char skey; 796 + 797 + address = pte_val(*ptep) & PAGE_MASK; 798 + skey = page_get_storage_key(address); 799 + bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); 800 + /* Set storage key ACC and FP */ 801 + page_set_storage_key(address, 802 + (key & (_PAGE_ACC_BITS | _PAGE_FP_BIT)), 803 + !nq); 804 + 805 + /* Merge host changed & referenced into pgste */ 806 + pgste_val(new) |= bits << 52; 807 + /* Transfer skey changed & referenced bit to kvm user bits */ 808 + pgste_val(new) |= bits << 45; /* PGSTE_UR_BIT & PGSTE_UC_BIT */ 809 + } 810 + /* changing the guest storage key is considered a change of the page */ 811 + if ((pgste_val(new) ^ pgste_val(old)) & 812 + (PGSTE_ACC_BITS | PGSTE_FP_BIT | PGSTE_GR_BIT | PGSTE_GC_BIT)) 813 + pgste_val(new) |= PGSTE_UC_BIT; 814 + 815 + pgste_set_unlock(ptep, new); 816 + pte_unmap_unlock(*ptep, ptl); 817 + up_read(&mm->mmap_sem); 818 + return 0; 819 + } 820 + EXPORT_SYMBOL(set_guest_storage_key); 821 + 774 822 #else /* CONFIG_PGSTE */ 775 823 776 824 static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
+2 -2
arch/s390/oprofile/hwsampler.h
··· 81 81 unsigned int:16; 82 82 unsigned int prim_asn:16; /* primary ASN */ 83 83 unsigned long long ia; /* Instruction Address */ 84 - unsigned long long lpp; /* Logical-Partition Program Param. */ 85 - unsigned long long vpp; /* Virtual-Machine Program Param. */ 84 + unsigned long long gpp; /* Guest Program Parameter */ 85 + unsigned long long hpp; /* Host Program Parameter */ 86 86 }; 87 87 88 88 struct hws_trailer_entry {
+37 -46
arch/s390/pci/pci.c
··· 82 82 83 83 static struct intr_bucket *bucket; 84 84 85 - /* Adapter local summary indicator */ 86 - static u8 *zpci_irq_si; 85 + /* Adapter interrupt definitions */ 86 + static void zpci_irq_handler(struct airq_struct *airq); 87 87 88 - static atomic_t irq_retries = ATOMIC_INIT(0); 88 + static struct airq_struct zpci_airq = { 89 + .handler = zpci_irq_handler, 90 + .isc = PCI_ISC, 91 + }; 89 92 90 93 /* I/O Map */ 91 94 static DEFINE_SPINLOCK(zpci_iomap_lock); ··· 407 404 /* store the last handled bit to implement fair scheduling of devices */ 408 405 static DEFINE_PER_CPU(unsigned long, next_sbit); 409 406 410 - static void zpci_irq_handler(void *dont, void *need) 407 + static void zpci_irq_handler(struct airq_struct *airq) 411 408 { 412 409 unsigned long sbit, mbit, last = 0, start = __get_cpu_var(next_sbit); 413 410 int rescan = 0, max = aisb_max; ··· 455 452 max = aisb_max; 456 453 sbit = find_first_bit_left(bucket->aisb, max); 457 454 if (sbit != max) { 458 - atomic_inc(&irq_retries); 459 455 rescan++; 460 456 goto scan; 461 457 } ··· 567 565 pr_debug("BAR%i: -> start: %Lx end: %Lx\n", 568 566 i, pdev->resource[i].start, pdev->resource[i].end); 569 567 } 570 - }; 568 + } 569 + 570 + static void zpci_unmap_resources(struct zpci_dev *zdev) 571 + { 572 + struct pci_dev *pdev = zdev->pdev; 573 + resource_size_t len; 574 + int i; 575 + 576 + for (i = 0; i < PCI_BAR_COUNT; i++) { 577 + len = pci_resource_len(pdev, i); 578 + if (!len) 579 + continue; 580 + pci_iounmap(pdev, (void *) pdev->resource[i].start); 581 + } 582 + } 571 583 572 584 struct zpci_dev *zpci_alloc_device(void) 573 585 { ··· 717 701 goto out_alloc; 718 702 } 719 703 720 - isc_register(PCI_ISC); 721 - zpci_irq_si = s390_register_adapter_interrupt(&zpci_irq_handler, NULL, PCI_ISC); 722 - if (IS_ERR(zpci_irq_si)) { 723 - rc = PTR_ERR(zpci_irq_si); 724 - zpci_irq_si = NULL; 704 + rc = register_adapter_interrupt(&zpci_airq); 705 + if (rc) 725 706 goto out_ai; 726 - } 707 + /* Set summary to 1 to be called every time for the ISC. */ 708 + *zpci_airq.lsi_ptr = 1; 727 709 728 710 for_each_online_cpu(cpu) 729 711 per_cpu(next_sbit, cpu) = 0; 730 712 731 713 spin_lock_init(&bucket->lock); 732 - /* set summary to 1 to be called every time for the ISC */ 733 - *zpci_irq_si = 1; 734 714 set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); 735 715 return 0; 736 716 737 717 out_ai: 738 - isc_unregister(PCI_ISC); 739 718 free_page((unsigned long) bucket->alloc); 740 719 out_alloc: 741 720 free_page((unsigned long) bucket->aisb); ··· 743 732 { 744 733 free_page((unsigned long) bucket->alloc); 745 734 free_page((unsigned long) bucket->aisb); 746 - s390_unregister_adapter_interrupt(zpci_irq_si, PCI_ISC); 747 - isc_unregister(PCI_ISC); 735 + unregister_adapter_interrupt(&zpci_airq); 748 736 kfree(bucket); 749 - } 750 - 751 - void zpci_debug_info(struct zpci_dev *zdev, struct seq_file *m) 752 - { 753 - if (!zdev) 754 - return; 755 - 756 - seq_printf(m, "global irq retries: %u\n", atomic_read(&irq_retries)); 757 - seq_printf(m, "aibv[0]:%016lx aibv[1]:%016lx aisb:%016lx\n", 758 - get_imap(0)->aibv, get_imap(1)->aibv, *bucket->aisb); 759 737 } 760 738 761 739 static struct resource *zpci_alloc_bus_resource(unsigned long start, unsigned long size, ··· 808 808 zpci_map_resources(zdev); 809 809 810 810 return 0; 811 + } 812 + 813 + void pcibios_release_device(struct pci_dev *pdev) 814 + { 815 + struct zpci_dev *zdev = get_zdev(pdev); 816 + 817 + zpci_unmap_resources(zdev); 818 + zpci_fmb_disable_device(zdev); 819 + zpci_debug_exit_device(zdev); 820 + zdev->pdev = NULL; 811 821 } 812 822 813 823 static int zpci_scan_bus(struct zpci_dev *zdev) ··· 959 949 */ 960 950 } 961 951 EXPORT_SYMBOL_GPL(zpci_stop_device); 962 - 963 - int zpci_scan_device(struct zpci_dev *zdev) 964 - { 965 - zdev->pdev = pci_scan_single_device(zdev->bus, ZPCI_DEVFN); 966 - if (!zdev->pdev) { 967 - pr_err("pci_scan_single_device failed for fid: 0x%x\n", 968 - zdev->fid); 969 - goto out; 970 - } 971 - 972 - pci_bus_add_devices(zdev->bus); 973 - 974 - return 0; 975 - out: 976 - zpci_dma_exit_device(zdev); 977 - clp_disable_fh(zdev); 978 - return -EIO; 979 - } 980 - EXPORT_SYMBOL_GPL(zpci_scan_device); 981 952 982 953 static inline int barsize(u8 size) 983 954 {
-1
arch/s390/pci/pci_clp.c
··· 236 236 if (!zdev_enabled(zdev)) 237 237 return 0; 238 238 239 - dev_info(&zdev->pdev->dev, "disabling fn handle: 0x%x\n", fh); 240 239 rc = clp_set_pci_fn(&fh, 0, CLP_SET_DISABLE_PCI_FN); 241 240 if (!rc) 242 241 /* Success -> store disabled handle in zdev */
-29
arch/s390/pci/pci_debug.c
··· 115 115 .release = single_release, 116 116 }; 117 117 118 - static int pci_debug_show(struct seq_file *m, void *v) 119 - { 120 - struct zpci_dev *zdev = m->private; 121 - 122 - zpci_debug_info(zdev, m); 123 - return 0; 124 - } 125 - 126 - static int pci_debug_seq_open(struct inode *inode, struct file *filp) 127 - { 128 - return single_open(filp, pci_debug_show, 129 - file_inode(filp)->i_private); 130 - } 131 - 132 - static const struct file_operations debugfs_pci_debug_fops = { 133 - .open = pci_debug_seq_open, 134 - .read = seq_read, 135 - .llseek = seq_lseek, 136 - .release = single_release, 137 - }; 138 - 139 118 void zpci_debug_init_device(struct zpci_dev *zdev) 140 119 { 141 120 zdev->debugfs_dev = debugfs_create_dir(dev_name(&zdev->pdev->dev), ··· 128 149 &debugfs_pci_perf_fops); 129 150 if (IS_ERR(zdev->debugfs_perf)) 130 151 zdev->debugfs_perf = NULL; 131 - 132 - zdev->debugfs_debug = debugfs_create_file("debug", 133 - S_IFREG | S_IRUGO | S_IWUSR, 134 - zdev->debugfs_dev, zdev, 135 - &debugfs_pci_debug_fops); 136 - if (IS_ERR(zdev->debugfs_debug)) 137 - zdev->debugfs_debug = NULL; 138 152 } 139 153 140 154 void zpci_debug_exit_device(struct zpci_dev *zdev) 141 155 { 142 156 debugfs_remove(zdev->debugfs_perf); 143 - debugfs_remove(zdev->debugfs_debug); 144 157 debugfs_remove(zdev->debugfs_dev); 145 158 } 146 159
+3 -3
arch/s390/pci/pci_dma.c
··· 263 263 enum dma_data_direction direction, 264 264 struct dma_attrs *attrs) 265 265 { 266 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 266 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 267 267 unsigned long nr_pages, iommu_page_index; 268 268 unsigned long pa = page_to_phys(page) + offset; 269 269 int flags = ZPCI_PTE_VALID; ··· 304 304 size_t size, enum dma_data_direction direction, 305 305 struct dma_attrs *attrs) 306 306 { 307 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 307 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 308 308 unsigned long iommu_page_index; 309 309 int npages; 310 310 ··· 323 323 dma_addr_t *dma_handle, gfp_t flag, 324 324 struct dma_attrs *attrs) 325 325 { 326 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 326 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 327 327 struct page *page; 328 328 unsigned long pa; 329 329 dma_addr_t map;
+8 -12
arch/s390/pci/pci_sysfs.c
··· 15 15 static ssize_t show_fid(struct device *dev, struct device_attribute *attr, 16 16 char *buf) 17 17 { 18 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 18 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 19 19 20 - sprintf(buf, "0x%08x\n", zdev->fid); 21 - return strlen(buf); 20 + return sprintf(buf, "0x%08x\n", zdev->fid); 22 21 } 23 22 static DEVICE_ATTR(function_id, S_IRUGO, show_fid, NULL); 24 23 25 24 static ssize_t show_fh(struct device *dev, struct device_attribute *attr, 26 25 char *buf) 27 26 { 28 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 27 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 29 28 30 - sprintf(buf, "0x%08x\n", zdev->fh); 31 - return strlen(buf); 29 + return sprintf(buf, "0x%08x\n", zdev->fh); 32 30 } 33 31 static DEVICE_ATTR(function_handle, S_IRUGO, show_fh, NULL); 34 32 35 33 static ssize_t show_pchid(struct device *dev, struct device_attribute *attr, 36 34 char *buf) 37 35 { 38 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 36 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 39 37 40 - sprintf(buf, "0x%04x\n", zdev->pchid); 41 - return strlen(buf); 38 + return sprintf(buf, "0x%04x\n", zdev->pchid); 42 39 } 43 40 static DEVICE_ATTR(pchid, S_IRUGO, show_pchid, NULL); 44 41 45 42 static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr, 46 43 char *buf) 47 44 { 48 - struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 45 + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); 49 46 50 - sprintf(buf, "0x%02x\n", zdev->pfgid); 51 - return strlen(buf); 47 + return sprintf(buf, "0x%02x\n", zdev->pfgid); 52 48 } 53 49 static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL); 54 50
+3
block/blk-core.c
··· 2315 2315 case -EBADE: 2316 2316 error_type = "critical nexus"; 2317 2317 break; 2318 + case -ETIMEDOUT: 2319 + error_type = "timeout"; 2320 + break; 2318 2321 case -EIO: 2319 2322 default: 2320 2323 error_type = "I/O";
+3 -2
block/blk-timeout.c
··· 82 82 static void blk_rq_timed_out(struct request *req) 83 83 { 84 84 struct request_queue *q = req->q; 85 - enum blk_eh_timer_return ret; 85 + enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER; 86 86 87 - ret = q->rq_timed_out_fn(req); 87 + if (q->rq_timed_out_fn) 88 + ret = q->rq_timed_out_fn(req); 88 89 switch (ret) { 89 90 case BLK_EH_HANDLED: 90 91 __blk_complete_request(req);
+44 -16
drivers/pci/hotplug/s390_pci_hpc.c
··· 41 41 struct zpci_dev *zdev; 42 42 }; 43 43 44 + static inline int slot_configure(struct slot *slot) 45 + { 46 + int ret = sclp_pci_configure(slot->zdev->fid); 47 + 48 + zpci_dbg(3, "conf fid:%x, rc:%d\n", slot->zdev->fid, ret); 49 + if (!ret) 50 + slot->zdev->state = ZPCI_FN_STATE_CONFIGURED; 51 + 52 + return ret; 53 + } 54 + 55 + static inline int slot_deconfigure(struct slot *slot) 56 + { 57 + int ret = sclp_pci_deconfigure(slot->zdev->fid); 58 + 59 + zpci_dbg(3, "deconf fid:%x, rc:%d\n", slot->zdev->fid, ret); 60 + if (!ret) 61 + slot->zdev->state = ZPCI_FN_STATE_STANDBY; 62 + 63 + return ret; 64 + } 65 + 44 66 static int enable_slot(struct hotplug_slot *hotplug_slot) 45 67 { 46 68 struct slot *slot = hotplug_slot->private; ··· 71 49 if (slot->zdev->state != ZPCI_FN_STATE_STANDBY) 72 50 return -EIO; 73 51 74 - rc = sclp_pci_configure(slot->zdev->fid); 75 - zpci_dbg(3, "conf fid:%x, rc:%d\n", slot->zdev->fid, rc); 76 - if (!rc) { 77 - slot->zdev->state = ZPCI_FN_STATE_CONFIGURED; 78 - /* automatically scan the device after is was configured */ 79 - zpci_enable_device(slot->zdev); 80 - zpci_scan_device(slot->zdev); 81 - } 52 + rc = slot_configure(slot); 53 + if (rc) 54 + return rc; 55 + 56 + rc = zpci_enable_device(slot->zdev); 57 + if (rc) 58 + goto out_deconfigure; 59 + 60 + slot->zdev->state = ZPCI_FN_STATE_ONLINE; 61 + 62 + pci_scan_slot(slot->zdev->bus, ZPCI_DEVFN); 63 + pci_bus_add_devices(slot->zdev->bus); 64 + 65 + return rc; 66 + 67 + out_deconfigure: 68 + slot_deconfigure(slot); 82 69 return rc; 83 70 } 84 71 ··· 99 68 if (!zpci_fn_configured(slot->zdev->state)) 100 69 return -EIO; 101 70 71 + if (slot->zdev->pdev) 72 + pci_stop_and_remove_bus_device(slot->zdev->pdev); 73 + 102 74 rc = zpci_disable_device(slot->zdev); 103 75 if (rc) 104 76 return rc; 105 - /* TODO: we rely on the user to unbind/remove the device, is that plausible 106 - * or do we need to trigger that here? 107 - */ 108 - rc = sclp_pci_deconfigure(slot->zdev->fid); 109 - zpci_dbg(3, "deconf fid:%x, rc:%d\n", slot->zdev->fid, rc); 110 - if (!rc) 111 - slot->zdev->state = ZPCI_FN_STATE_STANDBY; 112 - return rc; 77 + 78 + return slot_deconfigure(slot); 113 79 } 114 80 115 81 static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
+10
drivers/pci/pci.c
··· 1335 1335 } 1336 1336 1337 1337 /** 1338 + * pcibios_release_device - provide arch specific hooks when releasing device dev 1339 + * @dev: the PCI device being released 1340 + * 1341 + * Permits the platform to provide architecture specific functionality when 1342 + * devices are released. This is the default implementation. Architecture 1343 + * implementations can override this. 1344 + */ 1345 + void __weak pcibios_release_device(struct pci_dev *dev) {} 1346 + 1347 + /** 1338 1348 * pcibios_disable_device - disable arch specific PCI resources for device dev 1339 1349 * @dev: the PCI device to disable 1340 1350 *
+1
drivers/pci/probe.c
··· 1132 1132 pci_dev = to_pci_dev(dev); 1133 1133 pci_release_capabilities(pci_dev); 1134 1134 pci_release_of_node(pci_dev); 1135 + pcibios_release_device(pci_dev); 1135 1136 kfree(pci_dev); 1136 1137 } 1137 1138
+104 -11
drivers/s390/block/dasd.c
··· 38 38 */ 39 39 #define DASD_CHANQ_MAX_SIZE 4 40 40 41 - #define DASD_SLEEPON_START_TAG (void *) 1 42 - #define DASD_SLEEPON_END_TAG (void *) 2 43 - 44 41 /* 45 42 * SECTION: exported variables of dasd.c 46 43 */ ··· 1784 1787 list_for_each_safe(l, n, &device->ccw_queue) { 1785 1788 cqr = list_entry(l, struct dasd_ccw_req, devlist); 1786 1789 1787 - /* Stop list processing at the first non-final request. */ 1790 + /* Skip any non-final request. */ 1788 1791 if (cqr->status == DASD_CQR_QUEUED || 1789 1792 cqr->status == DASD_CQR_IN_IO || 1790 1793 cqr->status == DASD_CQR_CLEAR_PENDING) 1791 - break; 1794 + continue; 1792 1795 if (cqr->status == DASD_CQR_ERROR) { 1793 1796 __dasd_device_recovery(device, cqr); 1794 1797 } ··· 2180 2183 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && 2181 2184 (!dasd_eer_enabled(device))) { 2182 2185 cqr->status = DASD_CQR_FAILED; 2183 - cqr->intrc = -EAGAIN; 2186 + cqr->intrc = -ENOLINK; 2184 2187 continue; 2185 2188 } 2186 2189 /* Don't try to start requests if device is stopped */ ··· 2399 2402 * Cancels a request that was started with dasd_sleep_on_req. 2400 2403 * This is useful to timeout requests. The request will be 2401 2404 * terminated if it is currently in i/o. 2402 - * Returns 1 if the request has been terminated. 2403 - * 0 if there was no need to terminate the request (not started yet) 2405 + * Returns 0 if request termination was successful 2404 2406 * negative error code if termination failed 2405 2407 * Cancellation of a request is an asynchronous operation! The calling 2406 2408 * function has to wait until the request is properly returned via callback. ··· 2435 2439 dasd_schedule_device_bh(device); 2436 2440 return rc; 2437 2441 } 2438 - 2439 2442 2440 2443 /* 2441 2444 * SECTION: Operations of the dasd_block layer. ··· 2532 2537 __blk_end_request_all(req, -EIO); 2533 2538 continue; 2534 2539 } 2540 + if (test_bit(DASD_FLAG_ABORTALL, &basedev->flags) && 2541 + (basedev->features & DASD_FEATURE_FAILFAST || 2542 + blk_noretry_request(req))) { 2543 + DBF_DEV_EVENT(DBF_ERR, basedev, 2544 + "Rejecting failfast request %p", 2545 + req); 2546 + blk_start_request(req); 2547 + __blk_end_request_all(req, -ETIMEDOUT); 2548 + continue; 2549 + } 2535 2550 cqr = basedev->discipline->build_cp(basedev, block, req); 2536 2551 if (IS_ERR(cqr)) { 2537 2552 if (PTR_ERR(cqr) == -EBUSY) ··· 2580 2575 */ 2581 2576 cqr->callback_data = (void *) req; 2582 2577 cqr->status = DASD_CQR_FILLED; 2578 + req->completion_data = cqr; 2583 2579 blk_start_request(req); 2584 2580 list_add_tail(&cqr->blocklist, &block->ccw_queue); 2581 + INIT_LIST_HEAD(&cqr->devlist); 2585 2582 dasd_profile_start(block, cqr, req); 2586 2583 } 2587 2584 } ··· 2597 2590 req = (struct request *) cqr->callback_data; 2598 2591 dasd_profile_end(cqr->block, cqr, req); 2599 2592 status = cqr->block->base->discipline->free_cp(cqr, req); 2600 - if (status <= 0) 2601 - error = status ? status : -EIO; 2593 + if (status < 0) 2594 + error = status; 2595 + else if (status == 0) { 2596 + if (cqr->intrc == -EPERM) 2597 + error = -EBADE; 2598 + else if (cqr->intrc == -ENOLINK || 2599 + cqr->intrc == -ETIMEDOUT) 2600 + error = cqr->intrc; 2601 + else 2602 + error = -EIO; 2603 + } 2602 2604 __blk_end_request_all(req, error); 2603 2605 } 2604 2606 ··· 2708 2692 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && 2709 2693 (!dasd_eer_enabled(block->base))) { 2710 2694 cqr->status = DASD_CQR_FAILED; 2695 + cqr->intrc = -ENOLINK; 2711 2696 dasd_schedule_block_bh(block); 2712 2697 continue; 2713 2698 } ··· 2878 2861 /* Now check if the head of the ccw queue needs to be started. */ 2879 2862 __dasd_block_start_head(block); 2880 2863 spin_unlock(&block->queue_lock); 2864 + } 2865 + 2866 + /* 2867 + * Block timeout callback, called from the block layer 2868 + * 2869 + * request_queue lock is held on entry. 2870 + * 2871 + * Return values: 2872 + * BLK_EH_RESET_TIMER if the request should be left running 2873 + * BLK_EH_NOT_HANDLED if the request is handled or terminated 2874 + * by the driver. 2875 + */ 2876 + enum blk_eh_timer_return dasd_times_out(struct request *req) 2877 + { 2878 + struct dasd_ccw_req *cqr = req->completion_data; 2879 + struct dasd_block *block = req->q->queuedata; 2880 + struct dasd_device *device; 2881 + int rc = 0; 2882 + 2883 + if (!cqr) 2884 + return BLK_EH_NOT_HANDLED; 2885 + 2886 + device = cqr->startdev ? cqr->startdev : block->base; 2887 + if (!device->blk_timeout) 2888 + return BLK_EH_RESET_TIMER; 2889 + DBF_DEV_EVENT(DBF_WARNING, device, 2890 + " dasd_times_out cqr %p status %x", 2891 + cqr, cqr->status); 2892 + 2893 + spin_lock(&block->queue_lock); 2894 + spin_lock(get_ccwdev_lock(device->cdev)); 2895 + cqr->retries = -1; 2896 + cqr->intrc = -ETIMEDOUT; 2897 + if (cqr->status >= DASD_CQR_QUEUED) { 2898 + spin_unlock(get_ccwdev_lock(device->cdev)); 2899 + rc = dasd_cancel_req(cqr); 2900 + } else if (cqr->status == DASD_CQR_FILLED || 2901 + cqr->status == DASD_CQR_NEED_ERP) { 2902 + cqr->status = DASD_CQR_TERMINATED; 2903 + spin_unlock(get_ccwdev_lock(device->cdev)); 2904 + } else if (cqr->status == DASD_CQR_IN_ERP) { 2905 + struct dasd_ccw_req *searchcqr, *nextcqr, *tmpcqr; 2906 + 2907 + list_for_each_entry_safe(searchcqr, nextcqr, 2908 + &block->ccw_queue, blocklist) { 2909 + tmpcqr = searchcqr; 2910 + while (tmpcqr->refers) 2911 + tmpcqr = tmpcqr->refers; 2912 + if (tmpcqr != cqr) 2913 + continue; 2914 + /* searchcqr is an ERP request for cqr */ 2915 + searchcqr->retries = -1; 2916 + searchcqr->intrc = -ETIMEDOUT; 2917 + if (searchcqr->status >= DASD_CQR_QUEUED) { 2918 + spin_unlock(get_ccwdev_lock(device->cdev)); 2919 + rc = dasd_cancel_req(searchcqr); 2920 + spin_lock(get_ccwdev_lock(device->cdev)); 2921 + } else if ((searchcqr->status == DASD_CQR_FILLED) || 2922 + (searchcqr->status == DASD_CQR_NEED_ERP)) { 2923 + searchcqr->status = DASD_CQR_TERMINATED; 2924 + rc = 0; 2925 + } else if (searchcqr->status == DASD_CQR_IN_ERP) { 2926 + /* 2927 + * Shouldn't happen; most recent ERP 2928 + * request is at the front of queue 2929 + */ 2930 + continue; 2931 + } 2932 + break; 2933 + } 2934 + spin_unlock(get_ccwdev_lock(device->cdev)); 2935 + } 2936 + dasd_schedule_block_bh(block); 2937 + spin_unlock(&block->queue_lock); 2938 + 2939 + return rc ? BLK_EH_RESET_TIMER : BLK_EH_NOT_HANDLED; 2881 2940 } 2882 2941 2883 2942 /*
+97
drivers/s390/block/dasd_devmap.c
··· 1240 1240 1241 1241 static DEVICE_ATTR(expires, 0644, dasd_expires_show, dasd_expires_store); 1242 1242 1243 + static ssize_t 1244 + dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) 1245 + { 1246 + struct dasd_device *device; 1247 + int len; 1248 + 1249 + device = dasd_device_from_cdev(to_ccwdev(dev)); 1250 + if (IS_ERR(device)) 1251 + return -ENODEV; 1252 + len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_retries); 1253 + dasd_put_device(device); 1254 + return len; 1255 + } 1256 + 1257 + static ssize_t 1258 + dasd_retries_store(struct device *dev, struct device_attribute *attr, 1259 + const char *buf, size_t count) 1260 + { 1261 + struct dasd_device *device; 1262 + unsigned long val; 1263 + 1264 + device = dasd_device_from_cdev(to_ccwdev(dev)); 1265 + if (IS_ERR(device)) 1266 + return -ENODEV; 1267 + 1268 + if ((strict_strtoul(buf, 10, &val) != 0) || 1269 + (val > DASD_RETRIES_MAX)) { 1270 + dasd_put_device(device); 1271 + return -EINVAL; 1272 + } 1273 + 1274 + if (val) 1275 + device->default_retries = val; 1276 + 1277 + dasd_put_device(device); 1278 + return count; 1279 + } 1280 + 1281 + static DEVICE_ATTR(retries, 0644, dasd_retries_show, dasd_retries_store); 1282 + 1283 + static ssize_t 1284 + dasd_timeout_show(struct device *dev, struct device_attribute *attr, 1285 + char *buf) 1286 + { 1287 + struct dasd_device *device; 1288 + int len; 1289 + 1290 + device = dasd_device_from_cdev(to_ccwdev(dev)); 1291 + if (IS_ERR(device)) 1292 + return -ENODEV; 1293 + len = snprintf(buf, PAGE_SIZE, "%lu\n", device->blk_timeout); 1294 + dasd_put_device(device); 1295 + return len; 1296 + } 1297 + 1298 + static ssize_t 1299 + dasd_timeout_store(struct device *dev, struct device_attribute *attr, 1300 + const char *buf, size_t count) 1301 + { 1302 + struct dasd_device *device; 1303 + struct request_queue *q; 1304 + unsigned long val, flags; 1305 + 1306 + device = dasd_device_from_cdev(to_ccwdev(dev)); 1307 + if (IS_ERR(device) || !device->block) 1308 + return -ENODEV; 1309 + 1310 + if ((strict_strtoul(buf, 10, &val) != 0) || 1311 + val > UINT_MAX / HZ) { 1312 + dasd_put_device(device); 1313 + return -EINVAL; 1314 + } 1315 + q = device->block->request_queue; 1316 + if (!q) { 1317 + dasd_put_device(device); 1318 + return -ENODEV; 1319 + } 1320 + spin_lock_irqsave(&device->block->request_queue_lock, flags); 1321 + if (!val) 1322 + blk_queue_rq_timed_out(q, NULL); 1323 + else 1324 + blk_queue_rq_timed_out(q, dasd_times_out); 1325 + 1326 + device->blk_timeout = val; 1327 + 1328 + blk_queue_rq_timeout(q, device->blk_timeout * HZ); 1329 + spin_unlock_irqrestore(&device->block->request_queue_lock, flags); 1330 + 1331 + dasd_put_device(device); 1332 + return count; 1333 + } 1334 + 1335 + static DEVICE_ATTR(timeout, 0644, 1336 + dasd_timeout_show, dasd_timeout_store); 1337 + 1243 1338 static ssize_t dasd_reservation_policy_show(struct device *dev, 1244 1339 struct device_attribute *attr, 1245 1340 char *buf) ··· 1445 1350 &dev_attr_erplog.attr, 1446 1351 &dev_attr_failfast.attr, 1447 1352 &dev_attr_expires.attr, 1353 + &dev_attr_retries.attr, 1354 + &dev_attr_timeout.attr, 1448 1355 &dev_attr_reservation_policy.attr, 1449 1356 &dev_attr_last_known_reservation_state.attr, 1450 1357 &dev_attr_safe_offline.attr,
+6 -2
drivers/s390/block/dasd_diag.c
··· 359 359 } 360 360 361 361 device->default_expires = DIAG_TIMEOUT; 362 + device->default_retries = DIAG_MAX_RETRIES; 362 363 363 364 /* Figure out position of label block */ 364 365 switch (private->rdc_data.vdev_class) { ··· 556 555 recid++; 557 556 } 558 557 } 559 - cqr->retries = DIAG_MAX_RETRIES; 558 + cqr->retries = memdev->default_retries; 560 559 cqr->buildclk = get_tod_clock(); 561 560 if (blk_noretry_request(req) || 562 561 block->base->features & DASD_FEATURE_FAILFAST) ··· 583 582 584 583 static void dasd_diag_handle_terminated_request(struct dasd_ccw_req *cqr) 585 584 { 586 - cqr->status = DASD_CQR_FILLED; 585 + if (cqr->retries < 0) 586 + cqr->status = DASD_CQR_FAILED; 587 + else 588 + cqr->status = DASD_CQR_FILLED; 587 589 }; 588 590 589 591 /* Fill in IOCTL data for device. */
+12 -5
drivers/s390/block/dasd_eckd.c
··· 1682 1682 1683 1683 /* set default timeout */ 1684 1684 device->default_expires = DASD_EXPIRES; 1685 + /* set default retry count */ 1686 + device->default_retries = DASD_RETRIES; 1687 + 1685 1688 if (private->gneq) { 1686 1689 value = 1; 1687 1690 for (i = 0; i < private->gneq->timeout.value; i++) ··· 2381 2378 2382 2379 static void dasd_eckd_handle_terminated_request(struct dasd_ccw_req *cqr) 2383 2380 { 2381 + if (cqr->retries < 0) { 2382 + cqr->status = DASD_CQR_FAILED; 2383 + return; 2384 + } 2384 2385 cqr->status = DASD_CQR_FILLED; 2385 2386 if (cqr->block && (cqr->startdev != cqr->block->base)) { 2386 2387 dasd_eckd_reset_ccw_to_base_io(cqr); ··· 2666 2659 cqr->block = block; 2667 2660 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 2668 2661 cqr->lpm = startdev->path_data.ppm; 2669 - cqr->retries = 256; 2662 + cqr->retries = startdev->default_retries; 2670 2663 cqr->buildclk = get_tod_clock(); 2671 2664 cqr->status = DASD_CQR_FILLED; 2672 2665 return cqr; ··· 2841 2834 cqr->block = block; 2842 2835 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 2843 2836 cqr->lpm = startdev->path_data.ppm; 2844 - cqr->retries = 256; 2837 + cqr->retries = startdev->default_retries; 2845 2838 cqr->buildclk = get_tod_clock(); 2846 2839 cqr->status = DASD_CQR_FILLED; 2847 2840 return cqr; ··· 2975 2968 2976 2969 dcw = itcw_add_dcw(itcw, pfx_cmd, 0, 2977 2970 &pfxdata, sizeof(pfxdata), total_data_size); 2978 - return IS_ERR(dcw) ? PTR_ERR(dcw) : 0; 2971 + return PTR_RET(dcw); 2979 2972 } 2980 2973 2981 2974 static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( ··· 3134 3127 cqr->block = block; 3135 3128 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ 3136 3129 cqr->lpm = startdev->path_data.ppm; 3137 - cqr->retries = 256; 3130 + cqr->retries = startdev->default_retries; 3138 3131 cqr->buildclk = get_tod_clock(); 3139 3132 cqr->status = DASD_CQR_FILLED; 3140 3133 return cqr; ··· 3337 3330 cqr->block = block; 3338 3331 cqr->expires = startdev->default_expires * HZ; 3339 3332 cqr->lpm = startdev->path_data.ppm; 3340 - cqr->retries = 256; 3333 + cqr->retries = startdev->default_retries; 3341 3334 cqr->buildclk = get_tod_clock(); 3342 3335 cqr->status = DASD_CQR_FILLED; 3343 3336
+8
drivers/s390/block/dasd_erp.c
··· 159 159 struct dasd_device *device; 160 160 161 161 device = cqr->startdev; 162 + if (cqr->intrc == -ETIMEDOUT) { 163 + dev_err(&device->cdev->dev, "cqr %p timeout error", cqr); 164 + return; 165 + } 166 + if (cqr->intrc == -ENOLINK) { 167 + dev_err(&device->cdev->dev, "cqr %p transport error", cqr); 168 + return; 169 + } 162 170 /* dump sense data */ 163 171 if (device->discipline && device->discipline->dump_sense) 164 172 device->discipline->dump_sense(device, cqr, irb);
+8 -2
drivers/s390/block/dasd_fba.c
··· 29 29 #endif /* PRINTK_HEADER */ 30 30 #define PRINTK_HEADER "dasd(fba):" 31 31 32 + #define FBA_DEFAULT_RETRIES 32 33 + 32 34 #define DASD_FBA_CCW_WRITE 0x41 33 35 #define DASD_FBA_CCW_READ 0x42 34 36 #define DASD_FBA_CCW_LOCATE 0x43 ··· 169 167 } 170 168 171 169 device->default_expires = DASD_EXPIRES; 170 + device->default_retries = FBA_DEFAULT_RETRIES; 172 171 device->path_data.opm = LPM_ANYPATH; 173 172 174 173 readonly = dasd_device_is_ro(device); ··· 372 369 cqr->memdev = memdev; 373 370 cqr->block = block; 374 371 cqr->expires = memdev->default_expires * HZ; /* default 5 minutes */ 375 - cqr->retries = 32; 372 + cqr->retries = memdev->default_retries; 376 373 cqr->buildclk = get_tod_clock(); 377 374 cqr->status = DASD_CQR_FILLED; 378 375 return cqr; ··· 428 425 429 426 static void dasd_fba_handle_terminated_request(struct dasd_ccw_req *cqr) 430 427 { 431 - cqr->status = DASD_CQR_FILLED; 428 + if (cqr->retries < 0) 429 + cqr->status = DASD_CQR_FAILED; 430 + else 431 + cqr->status = DASD_CQR_FILLED; 432 432 }; 433 433 434 434 static int
+10
drivers/s390/block/dasd_int.h
··· 224 224 /* default expiration time*/ 225 225 #define DASD_EXPIRES 300 226 226 #define DASD_EXPIRES_MAX 40000000 227 + #define DASD_RETRIES 256 228 + #define DASD_RETRIES_MAX 32768 227 229 228 230 /* per dasd_ccw_req flags */ 229 231 #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ ··· 468 466 469 467 /* default expiration time in s */ 470 468 unsigned long default_expires; 469 + unsigned long default_retries; 470 + 471 + unsigned long blk_timeout; 471 472 472 473 struct dentry *debugfs_dentry; 473 474 struct dasd_profile profile; ··· 524 519 #define DASD_FLAG_SUSPENDED 9 /* The device was suspended */ 525 520 #define DASD_FLAG_SAFE_OFFLINE 10 /* safe offline processing requested*/ 526 521 #define DASD_FLAG_SAFE_OFFLINE_RUNNING 11 /* safe offline running */ 522 + #define DASD_FLAG_ABORTALL 12 /* Abort all noretry requests */ 527 523 524 + #define DASD_SLEEPON_START_TAG ((void *) 1) 525 + #define DASD_SLEEPON_END_TAG ((void *) 2) 528 526 529 527 void dasd_put_device_wake(struct dasd_device *); 530 528 ··· 667 659 668 660 struct dasd_block *dasd_alloc_block(void); 669 661 void dasd_free_block(struct dasd_block *); 662 + 663 + enum blk_eh_timer_return dasd_times_out(struct request *req); 670 664 671 665 void dasd_enable_device(struct dasd_device *); 672 666 void dasd_set_target_state(struct dasd_device *, int);
+59
drivers/s390/block/dasd_ioctl.c
··· 141 141 } 142 142 143 143 /* 144 + * Abort all failfast I/O on a device. 145 + */ 146 + static int dasd_ioctl_abortio(struct dasd_block *block) 147 + { 148 + unsigned long flags; 149 + struct dasd_device *base; 150 + struct dasd_ccw_req *cqr, *n; 151 + 152 + base = block->base; 153 + if (!capable(CAP_SYS_ADMIN)) 154 + return -EACCES; 155 + 156 + if (test_and_set_bit(DASD_FLAG_ABORTALL, &base->flags)) 157 + return 0; 158 + DBF_DEV_EVENT(DBF_NOTICE, base, "%s", "abortall flag set"); 159 + 160 + spin_lock_irqsave(&block->request_queue_lock, flags); 161 + spin_lock(&block->queue_lock); 162 + list_for_each_entry_safe(cqr, n, &block->ccw_queue, blocklist) { 163 + if (test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && 164 + cqr->callback_data && 165 + cqr->callback_data != DASD_SLEEPON_START_TAG && 166 + cqr->callback_data != DASD_SLEEPON_END_TAG) { 167 + spin_unlock(&block->queue_lock); 168 + blk_abort_request(cqr->callback_data); 169 + spin_lock(&block->queue_lock); 170 + } 171 + } 172 + spin_unlock(&block->queue_lock); 173 + spin_unlock_irqrestore(&block->request_queue_lock, flags); 174 + 175 + dasd_schedule_block_bh(block); 176 + return 0; 177 + } 178 + 179 + /* 180 + * Allow I/O on a device 181 + */ 182 + static int dasd_ioctl_allowio(struct dasd_block *block) 183 + { 184 + struct dasd_device *base; 185 + 186 + base = block->base; 187 + if (!capable(CAP_SYS_ADMIN)) 188 + return -EACCES; 189 + 190 + if (test_and_clear_bit(DASD_FLAG_ABORTALL, &base->flags)) 191 + DBF_DEV_EVENT(DBF_NOTICE, base, "%s", "abortall flag unset"); 192 + 193 + return 0; 194 + } 195 + 196 + /* 144 197 * performs formatting of _device_ according to _fdata_ 145 198 * Note: The discipline's format_function is assumed to deliver formatting 146 199 * commands to format multiple units of the device. In terms of the ECKD ··· 510 457 break; 511 458 case BIODASDRESUME: 512 459 rc = dasd_ioctl_resume(block); 460 + break; 461 + case BIODASDABORTIO: 462 + rc = dasd_ioctl_abortio(block); 463 + break; 464 + case BIODASDALLOWIO: 465 + rc = dasd_ioctl_allowio(block); 513 466 break; 514 467 case BIODASDFMT: 515 468 rc = dasd_ioctl_format(bdev, argp);
+1 -1
drivers/s390/char/Makefile
··· 3 3 # 4 4 5 5 obj-y += ctrlchar.o keyboard.o defkeymap.o sclp.o sclp_rw.o sclp_quiesce.o \ 6 - sclp_cmd.o sclp_config.o sclp_cpi_sys.o sclp_ocf.o 6 + sclp_cmd.o sclp_config.o sclp_cpi_sys.o sclp_ocf.o sclp_ctl.o 7 7 8 8 obj-$(CONFIG_TN3270) += raw3270.o 9 9 obj-$(CONFIG_TN3270_CONSOLE) += con3270.o
+80 -6
drivers/s390/char/sclp.c
··· 50 50 /* Suspend request */ 51 51 static DECLARE_COMPLETION(sclp_request_queue_flushed); 52 52 53 + /* Number of console pages to allocate, used by sclp_con.c and sclp_vt220.c */ 54 + int sclp_console_pages = SCLP_CONSOLE_PAGES; 55 + /* Flag to indicate if buffer pages are dropped on buffer full condition */ 56 + int sclp_console_drop = 0; 57 + /* Number of times the console dropped buffer pages */ 58 + unsigned long sclp_console_full; 59 + 53 60 static void sclp_suspend_req_cb(struct sclp_req *req, void *data) 54 61 { 55 62 complete(&sclp_request_queue_flushed); 56 63 } 64 + 65 + static int __init sclp_setup_console_pages(char *str) 66 + { 67 + int pages, rc; 68 + 69 + rc = kstrtoint(str, 0, &pages); 70 + if (!rc && pages >= SCLP_CONSOLE_PAGES) 71 + sclp_console_pages = pages; 72 + return 1; 73 + } 74 + 75 + __setup("sclp_con_pages=", sclp_setup_console_pages); 76 + 77 + static int __init sclp_setup_console_drop(char *str) 78 + { 79 + int drop, rc; 80 + 81 + rc = kstrtoint(str, 0, &drop); 82 + if (!rc && drop) 83 + sclp_console_drop = 1; 84 + return 1; 85 + } 86 + 87 + __setup("sclp_con_drop=", sclp_setup_console_drop); 57 88 58 89 static struct sclp_req sclp_suspend_req; 59 90 ··· 148 117 int 149 118 sclp_service_call(sclp_cmdw_t command, void *sccb) 150 119 { 151 - int cc; 120 + int cc = 4; /* Initialize for program check handling */ 152 121 153 122 asm volatile( 154 - " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ 155 - " ipm %0\n" 156 - " srl %0,28" 157 - : "=&d" (cc) : "d" (command), "a" (__pa(sccb)) 123 + "0: .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ 124 + "1: ipm %0\n" 125 + " srl %0,28\n" 126 + "2:\n" 127 + EX_TABLE(0b, 2b) 128 + EX_TABLE(1b, 2b) 129 + : "+&d" (cc) : "d" (command), "a" (__pa(sccb)) 158 130 : "cc", "memory"); 131 + if (cc == 4) 132 + return -EINVAL; 159 133 if (cc == 3) 160 134 return -EIO; 161 135 if (cc == 2) ··· 1049 1013 .restore = sclp_restore, 1050 1014 }; 1051 1015 1016 + static ssize_t sclp_show_console_pages(struct device_driver *dev, char *buf) 1017 + { 1018 + return sprintf(buf, "%i\n", sclp_console_pages); 1019 + } 1020 + 1021 + static DRIVER_ATTR(con_pages, S_IRUSR, sclp_show_console_pages, NULL); 1022 + 1023 + static ssize_t sclp_show_con_drop(struct device_driver *dev, char *buf) 1024 + { 1025 + return sprintf(buf, "%i\n", sclp_console_drop); 1026 + } 1027 + 1028 + static DRIVER_ATTR(con_drop, S_IRUSR, sclp_show_con_drop, NULL); 1029 + 1030 + static ssize_t sclp_show_console_full(struct device_driver *dev, char *buf) 1031 + { 1032 + return sprintf(buf, "%lu\n", sclp_console_full); 1033 + } 1034 + 1035 + static DRIVER_ATTR(con_full, S_IRUSR, sclp_show_console_full, NULL); 1036 + 1037 + static struct attribute *sclp_drv_attrs[] = { 1038 + &driver_attr_con_pages.attr, 1039 + &driver_attr_con_drop.attr, 1040 + &driver_attr_con_full.attr, 1041 + NULL, 1042 + }; 1043 + static struct attribute_group sclp_drv_attr_group = { 1044 + .attrs = sclp_drv_attrs, 1045 + }; 1046 + static const struct attribute_group *sclp_drv_attr_groups[] = { 1047 + &sclp_drv_attr_group, 1048 + NULL, 1049 + }; 1050 + 1052 1051 static struct platform_driver sclp_pdrv = { 1053 1052 .driver = { 1054 1053 .name = "sclp", 1055 1054 .owner = THIS_MODULE, 1056 1055 .pm = &sclp_pm_ops, 1056 + .groups = sclp_drv_attr_groups, 1057 1057 }, 1058 1058 }; 1059 1059 ··· 1168 1096 rc = platform_driver_register(&sclp_pdrv); 1169 1097 if (rc) 1170 1098 return rc; 1099 + 1171 1100 sclp_pdev = platform_device_register_simple("sclp", -1, NULL, 0); 1172 - rc = IS_ERR(sclp_pdev) ? PTR_ERR(sclp_pdev) : 0; 1101 + rc = PTR_RET(sclp_pdev); 1173 1102 if (rc) 1174 1103 goto fail_platform_driver_unregister; 1104 + 1175 1105 rc = atomic_notifier_chain_register(&panic_notifier_list, 1176 1106 &sclp_on_panic_nb); 1177 1107 if (rc)
+6 -1
drivers/s390/char/sclp.h
··· 15 15 16 16 /* maximum number of pages concerning our own memory management */ 17 17 #define MAX_KMEM_PAGES (sizeof(unsigned long) << 3) 18 - #define MAX_CONSOLE_PAGES 6 18 + #define SCLP_CONSOLE_PAGES 6 19 19 20 20 #define EVTYP_OPCMD 0x01 21 21 #define EVTYP_MSG 0x02 ··· 171 171 int sclp_deactivate(void); 172 172 int sclp_reactivate(void); 173 173 int sclp_service_call(sclp_cmdw_t command, void *sccb); 174 + int sclp_sync_request(sclp_cmdw_t command, void *sccb); 174 175 175 176 int sclp_sdias_init(void); 176 177 void sclp_sdias_exit(void); 178 + 179 + extern int sclp_console_pages; 180 + extern int sclp_console_drop; 181 + extern unsigned long sclp_console_full; 177 182 178 183 /* useful inlines */ 179 184
+10 -10
drivers/s390/char/sclp_cmd.c
··· 195 195 complete(completion); 196 196 } 197 197 198 - static int do_sync_request(sclp_cmdw_t cmd, void *sccb) 198 + int sclp_sync_request(sclp_cmdw_t cmd, void *sccb) 199 199 { 200 200 struct completion completion; 201 201 struct sclp_req *request; ··· 270 270 if (!sccb) 271 271 return -ENOMEM; 272 272 sccb->header.length = sizeof(*sccb); 273 - rc = do_sync_request(SCLP_CMDW_READ_CPU_INFO, sccb); 273 + rc = sclp_sync_request(SCLP_CMDW_READ_CPU_INFO, sccb); 274 274 if (rc) 275 275 goto out; 276 276 if (sccb->header.response_code != 0x0010) { ··· 304 304 if (!sccb) 305 305 return -ENOMEM; 306 306 sccb->header.length = sizeof(*sccb); 307 - rc = do_sync_request(cmd, sccb); 307 + rc = sclp_sync_request(cmd, sccb); 308 308 if (rc) 309 309 goto out; 310 310 switch (sccb->header.response_code) { ··· 374 374 return -ENOMEM; 375 375 sccb->header.length = PAGE_SIZE; 376 376 sccb->rn = rn; 377 - rc = do_sync_request(cmd, sccb); 377 + rc = sclp_sync_request(cmd, sccb); 378 378 if (rc) 379 379 goto out; 380 380 switch (sccb->header.response_code) { ··· 429 429 if (!sccb) 430 430 return -ENOMEM; 431 431 sccb->header.length = PAGE_SIZE; 432 - rc = do_sync_request(0x00080001 | id << 8, sccb); 432 + rc = sclp_sync_request(0x00080001 | id << 8, sccb); 433 433 if (rc) 434 434 goto out; 435 435 switch (sccb->header.response_code) { ··· 627 627 for (id = 0; id <= sclp_max_storage_id; id++) { 628 628 memset(sccb, 0, PAGE_SIZE); 629 629 sccb->header.length = PAGE_SIZE; 630 - rc = do_sync_request(0x00040001 | id << 8, sccb); 630 + rc = sclp_sync_request(0x00040001 | id << 8, sccb); 631 631 if (rc) 632 632 goto out; 633 633 switch (sccb->header.response_code) { ··· 668 668 if (rc) 669 669 goto out; 670 670 sclp_pdev = platform_device_register_simple("sclp_mem", -1, NULL, 0); 671 - rc = IS_ERR(sclp_pdev) ? PTR_ERR(sclp_pdev) : 0; 671 + rc = PTR_RET(sclp_pdev); 672 672 if (rc) 673 673 goto out_driver; 674 674 sclp_add_standby_memory(); ··· 714 714 sccb->header.length = PAGE_SIZE; 715 715 sccb->atype = SCLP_RECONFIG_PCI_ATPYE; 716 716 sccb->aid = fid; 717 - rc = do_sync_request(cmd, sccb); 717 + rc = sclp_sync_request(cmd, sccb); 718 718 if (rc) 719 719 goto out; 720 720 switch (sccb->header.response_code) { ··· 771 771 if (!sccb) 772 772 return -ENOMEM; 773 773 sccb->header.length = sizeof(*sccb); 774 - rc = do_sync_request(cmd, sccb); 774 + rc = sclp_sync_request(cmd, sccb); 775 775 if (rc) 776 776 goto out; 777 777 switch (sccb->header.response_code) { ··· 846 846 if (!sccb) 847 847 return -ENOMEM; 848 848 sccb->header.length = sizeof(*sccb); 849 - rc = do_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); 849 + rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); 850 850 if (rc) 851 851 goto out; 852 852 if (sccb->header.response_code != 0x0010) {
+30 -1
drivers/s390/char/sclp_con.c
··· 130 130 } 131 131 132 132 /* 133 + * Drop oldest console buffer if sclp_con_drop is set 134 + */ 135 + static int 136 + sclp_console_drop_buffer(void) 137 + { 138 + struct list_head *list; 139 + struct sclp_buffer *buffer; 140 + void *page; 141 + 142 + if (!sclp_console_drop) 143 + return 0; 144 + list = sclp_con_outqueue.next; 145 + if (sclp_con_queue_running) 146 + /* The first element is in I/O */ 147 + list = list->next; 148 + if (list == &sclp_con_outqueue) 149 + return 0; 150 + list_del(list); 151 + buffer = list_entry(list, struct sclp_buffer, list); 152 + page = sclp_unmake_buffer(buffer); 153 + list_add_tail((struct list_head *) page, &sclp_con_pages); 154 + return 1; 155 + } 156 + 157 + /* 133 158 * Writes the given message to S390 system console 134 159 */ 135 160 static void ··· 175 150 do { 176 151 /* make sure we have a console output buffer */ 177 152 if (sclp_conbuf == NULL) { 153 + if (list_empty(&sclp_con_pages)) 154 + sclp_console_full++; 178 155 while (list_empty(&sclp_con_pages)) { 179 156 if (sclp_con_suspended) 180 157 goto out; 158 + if (sclp_console_drop_buffer()) 159 + break; 181 160 spin_unlock_irqrestore(&sclp_con_lock, flags); 182 161 sclp_sync_wait(); 183 162 spin_lock_irqsave(&sclp_con_lock, flags); ··· 326 297 return rc; 327 298 /* Allocate pages for output buffering */ 328 299 INIT_LIST_HEAD(&sclp_con_pages); 329 - for (i = 0; i < MAX_CONSOLE_PAGES; i++) { 300 + for (i = 0; i < sclp_console_pages; i++) { 330 301 page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 331 302 list_add_tail(page, &sclp_con_pages); 332 303 }
+144
drivers/s390/char/sclp_ctl.c
··· 1 + /* 2 + * IOCTL interface for SCLP 3 + * 4 + * Copyright IBM Corp. 2012 5 + * 6 + * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com> 7 + */ 8 + 9 + #include <linux/compat.h> 10 + #include <linux/uaccess.h> 11 + #include <linux/miscdevice.h> 12 + #include <linux/gfp.h> 13 + #include <linux/module.h> 14 + #include <linux/ioctl.h> 15 + #include <linux/fs.h> 16 + #include <asm/compat.h> 17 + #include <asm/sclp_ctl.h> 18 + #include <asm/sclp.h> 19 + 20 + #include "sclp.h" 21 + 22 + /* 23 + * Supported command words 24 + */ 25 + static unsigned int sclp_ctl_sccb_wlist[] = { 26 + 0x00400002, 27 + 0x00410002, 28 + }; 29 + 30 + /* 31 + * Check if command word is supported 32 + */ 33 + static int sclp_ctl_cmdw_supported(unsigned int cmdw) 34 + { 35 + int i; 36 + 37 + for (i = 0; i < ARRAY_SIZE(sclp_ctl_sccb_wlist); i++) { 38 + if (cmdw == sclp_ctl_sccb_wlist[i]) 39 + return 1; 40 + } 41 + return 0; 42 + } 43 + 44 + static void __user *u64_to_uptr(u64 value) 45 + { 46 + if (is_compat_task()) 47 + return compat_ptr(value); 48 + else 49 + return (void __user *)(unsigned long)value; 50 + } 51 + 52 + /* 53 + * Start SCLP request 54 + */ 55 + static int sclp_ctl_ioctl_sccb(void __user *user_area) 56 + { 57 + struct sclp_ctl_sccb ctl_sccb; 58 + struct sccb_header *sccb; 59 + int rc; 60 + 61 + if (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb))) 62 + return -EFAULT; 63 + if (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw)) 64 + return -EOPNOTSUPP; 65 + sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 66 + if (!sccb) 67 + return -ENOMEM; 68 + if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sizeof(*sccb))) { 69 + rc = -EFAULT; 70 + goto out_free; 71 + } 72 + if (sccb->length > PAGE_SIZE || sccb->length < 8) 73 + return -EINVAL; 74 + if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sccb->length)) { 75 + rc = -EFAULT; 76 + goto out_free; 77 + } 78 + rc = sclp_sync_request(ctl_sccb.cmdw, sccb); 79 + if (rc) 80 + goto out_free; 81 + if (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length)) 82 + rc = -EFAULT; 83 + out_free: 84 + free_page((unsigned long) sccb); 85 + return rc; 86 + } 87 + 88 + /* 89 + * SCLP SCCB ioctl function 90 + */ 91 + static long sclp_ctl_ioctl(struct file *filp, unsigned int cmd, 92 + unsigned long arg) 93 + { 94 + void __user *argp; 95 + 96 + if (is_compat_task()) 97 + argp = compat_ptr(arg); 98 + else 99 + argp = (void __user *) arg; 100 + switch (cmd) { 101 + case SCLP_CTL_SCCB: 102 + return sclp_ctl_ioctl_sccb(argp); 103 + default: /* unknown ioctl number */ 104 + return -ENOTTY; 105 + } 106 + } 107 + 108 + /* 109 + * File operations 110 + */ 111 + static const struct file_operations sclp_ctl_fops = { 112 + .owner = THIS_MODULE, 113 + .open = nonseekable_open, 114 + .unlocked_ioctl = sclp_ctl_ioctl, 115 + .compat_ioctl = sclp_ctl_ioctl, 116 + .llseek = no_llseek, 117 + }; 118 + 119 + /* 120 + * Misc device definition 121 + */ 122 + static struct miscdevice sclp_ctl_device = { 123 + .minor = MISC_DYNAMIC_MINOR, 124 + .name = "sclp", 125 + .fops = &sclp_ctl_fops, 126 + }; 127 + 128 + /* 129 + * Register sclp_ctl misc device 130 + */ 131 + static int __init sclp_ctl_init(void) 132 + { 133 + return misc_register(&sclp_ctl_device); 134 + } 135 + module_init(sclp_ctl_init); 136 + 137 + /* 138 + * Deregister sclp_ctl misc device 139 + */ 140 + static void __exit sclp_ctl_exit(void) 141 + { 142 + misc_deregister(&sclp_ctl_device); 143 + } 144 + module_exit(sclp_ctl_exit);
+34 -5
drivers/s390/char/sclp_vt220.c
··· 362 362 363 363 #define BUFFER_MAX_DELAY HZ/20 364 364 365 + /* 366 + * Drop oldest console buffer if sclp_con_drop is set 367 + */ 368 + static int 369 + sclp_vt220_drop_buffer(void) 370 + { 371 + struct list_head *list; 372 + struct sclp_vt220_request *request; 373 + void *page; 374 + 375 + if (!sclp_console_drop) 376 + return 0; 377 + list = sclp_vt220_outqueue.next; 378 + if (sclp_vt220_queue_running) 379 + /* The first element is in I/O */ 380 + list = list->next; 381 + if (list == &sclp_vt220_outqueue) 382 + return 0; 383 + list_del(list); 384 + request = list_entry(list, struct sclp_vt220_request, list); 385 + page = request->sclp_req.sccb; 386 + list_add_tail((struct list_head *) page, &sclp_vt220_empty); 387 + return 1; 388 + } 389 + 365 390 /* 366 391 * Internal implementation of the write function. Write COUNT bytes of data 367 392 * from memory at BUF ··· 415 390 do { 416 391 /* Create an sclp output buffer if none exists yet */ 417 392 if (sclp_vt220_current_request == NULL) { 393 + if (list_empty(&sclp_vt220_empty)) 394 + sclp_console_full++; 418 395 while (list_empty(&sclp_vt220_empty)) { 419 - spin_unlock_irqrestore(&sclp_vt220_lock, flags); 420 396 if (may_fail || sclp_vt220_suspended) 421 397 goto out; 422 - else 423 - sclp_sync_wait(); 398 + if (sclp_vt220_drop_buffer()) 399 + break; 400 + spin_unlock_irqrestore(&sclp_vt220_lock, flags); 401 + 402 + sclp_sync_wait(); 424 403 spin_lock_irqsave(&sclp_vt220_lock, flags); 425 404 } 426 405 page = (void *) sclp_vt220_empty.next; ··· 457 428 sclp_vt220_timer.expires = jiffies + BUFFER_MAX_DELAY; 458 429 add_timer(&sclp_vt220_timer); 459 430 } 460 - spin_unlock_irqrestore(&sclp_vt220_lock, flags); 461 431 out: 432 + spin_unlock_irqrestore(&sclp_vt220_lock, flags); 462 433 return overall_written; 463 434 } 464 435 ··· 832 803 833 804 if (!CONSOLE_IS_SCLP) 834 805 return 0; 835 - rc = __sclp_vt220_init(MAX_CONSOLE_PAGES); 806 + rc = __sclp_vt220_init(sclp_console_pages); 836 807 if (rc) 837 808 return rc; 838 809 /* Attach linux console */
+1 -1
drivers/s390/char/tape_class.c
··· 77 77 tcd->class_device = device_create(tape_class, device, 78 78 tcd->char_device->dev, NULL, 79 79 "%s", tcd->device_name); 80 - rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; 80 + rc = PTR_RET(tcd->class_device); 81 81 if (rc) 82 82 goto fail_with_cdev; 83 83 rc = sysfs_create_link(
+3 -2
drivers/s390/char/vmwatchdog.c
··· 112 112 113 113 static int vmwdt_disable(void) 114 114 { 115 - int ret = __diag288(wdt_cancel, 0, "", 0); 115 + char cmd[] = {'\0'}; 116 + int ret = __diag288(wdt_cancel, 0, cmd, 0); 116 117 WARN_ON(ret != 0); 117 118 clear_bit(VMWDT_RUNNING, &vmwdt_is_open); 118 119 return ret; ··· 125 124 * so we try initializing it with a NOP command ("BEGIN") 126 125 * that won't cause any harm even if the following disable 127 126 * fails for some reason */ 128 - static char __initdata ebc_begin[] = { 127 + char ebc_begin[] = { 129 128 194, 197, 199, 201, 213 130 129 }; 131 130 if (__diag288(wdt_init, 15, ebc_begin, sizeof(ebc_begin)) != 0)
+54 -109
drivers/s390/cio/airq.c
··· 9 9 */ 10 10 11 11 #include <linux/init.h> 12 + #include <linux/irq.h> 13 + #include <linux/kernel_stat.h> 12 14 #include <linux/module.h> 15 + #include <linux/mutex.h> 16 + #include <linux/rculist.h> 13 17 #include <linux/slab.h> 14 - #include <linux/rcupdate.h> 15 18 16 19 #include <asm/airq.h> 17 20 #include <asm/isc.h> 18 21 19 22 #include "cio.h" 20 23 #include "cio_debug.h" 24 + #include "ioasm.h" 21 25 22 - #define NR_AIRQS 32 23 - #define NR_AIRQS_PER_WORD sizeof(unsigned long) 24 - #define NR_AIRQ_WORDS (NR_AIRQS / NR_AIRQS_PER_WORD) 25 - 26 - union indicator_t { 27 - unsigned long word[NR_AIRQ_WORDS]; 28 - unsigned char byte[NR_AIRQS]; 29 - } __attribute__((packed)); 30 - 31 - struct airq_t { 32 - adapter_int_handler_t handler; 33 - void *drv_data; 34 - }; 35 - 36 - static union indicator_t indicators[MAX_ISC+1]; 37 - static struct airq_t *airqs[MAX_ISC+1][NR_AIRQS]; 38 - 39 - static int register_airq(struct airq_t *airq, u8 isc) 40 - { 41 - int i; 42 - 43 - for (i = 0; i < NR_AIRQS; i++) 44 - if (!cmpxchg(&airqs[isc][i], NULL, airq)) 45 - return i; 46 - return -ENOMEM; 47 - } 26 + static DEFINE_SPINLOCK(airq_lists_lock); 27 + static struct hlist_head airq_lists[MAX_ISC+1]; 48 28 49 29 /** 50 - * s390_register_adapter_interrupt() - register adapter interrupt handler 51 - * @handler: adapter handler to be registered 52 - * @drv_data: driver data passed with each call to the handler 53 - * @isc: isc for which the handler should be called 30 + * register_adapter_interrupt() - register adapter interrupt handler 31 + * @airq: pointer to adapter interrupt descriptor 54 32 * 55 - * Returns: 56 - * Pointer to the indicator to be used on success 57 - * ERR_PTR() if registration failed 33 + * Returns 0 on success, or -EINVAL. 58 34 */ 59 - void *s390_register_adapter_interrupt(adapter_int_handler_t handler, 60 - void *drv_data, u8 isc) 35 + int register_adapter_interrupt(struct airq_struct *airq) 61 36 { 62 - struct airq_t *airq; 63 - char dbf_txt[16]; 64 - int ret; 37 + char dbf_txt[32]; 65 38 66 - if (isc > MAX_ISC) 67 - return ERR_PTR(-EINVAL); 68 - airq = kmalloc(sizeof(struct airq_t), GFP_KERNEL); 69 - if (!airq) { 70 - ret = -ENOMEM; 71 - goto out; 39 + if (!airq->handler || airq->isc > MAX_ISC) 40 + return -EINVAL; 41 + if (!airq->lsi_ptr) { 42 + airq->lsi_ptr = kzalloc(1, GFP_KERNEL); 43 + if (!airq->lsi_ptr) 44 + return -ENOMEM; 45 + airq->flags |= AIRQ_PTR_ALLOCATED; 72 46 } 73 - airq->handler = handler; 74 - airq->drv_data = drv_data; 75 - 76 - ret = register_airq(airq, isc); 77 - out: 78 - snprintf(dbf_txt, sizeof(dbf_txt), "rairq:%d", ret); 47 + if (!airq->lsi_mask) 48 + airq->lsi_mask = 0xff; 49 + snprintf(dbf_txt, sizeof(dbf_txt), "rairq:%p", airq); 79 50 CIO_TRACE_EVENT(4, dbf_txt); 80 - if (ret < 0) { 81 - kfree(airq); 82 - return ERR_PTR(ret); 83 - } else 84 - return &indicators[isc].byte[ret]; 51 + isc_register(airq->isc); 52 + spin_lock(&airq_lists_lock); 53 + hlist_add_head_rcu(&airq->list, &airq_lists[airq->isc]); 54 + spin_unlock(&airq_lists_lock); 55 + return 0; 85 56 } 86 - EXPORT_SYMBOL(s390_register_adapter_interrupt); 57 + EXPORT_SYMBOL(register_adapter_interrupt); 87 58 88 59 /** 89 - * s390_unregister_adapter_interrupt - unregister adapter interrupt handler 90 - * @ind: indicator for which the handler is to be unregistered 91 - * @isc: interruption subclass 60 + * unregister_adapter_interrupt - unregister adapter interrupt handler 61 + * @airq: pointer to adapter interrupt descriptor 92 62 */ 93 - void s390_unregister_adapter_interrupt(void *ind, u8 isc) 63 + void unregister_adapter_interrupt(struct airq_struct *airq) 94 64 { 95 - struct airq_t *airq; 96 - char dbf_txt[16]; 97 - int i; 65 + char dbf_txt[32]; 98 66 99 - i = (int) ((addr_t) ind) - ((addr_t) &indicators[isc].byte[0]); 100 - snprintf(dbf_txt, sizeof(dbf_txt), "urairq:%d", i); 67 + if (hlist_unhashed(&airq->list)) 68 + return; 69 + snprintf(dbf_txt, sizeof(dbf_txt), "urairq:%p", airq); 101 70 CIO_TRACE_EVENT(4, dbf_txt); 102 - indicators[isc].byte[i] = 0; 103 - airq = xchg(&airqs[isc][i], NULL); 104 - /* 105 - * Allow interrupts to complete. This will ensure that the airq handle 106 - * is no longer referenced by any interrupt handler. 107 - */ 108 - synchronize_sched(); 109 - kfree(airq); 71 + spin_lock(&airq_lists_lock); 72 + hlist_del_rcu(&airq->list); 73 + spin_unlock(&airq_lists_lock); 74 + synchronize_rcu(); 75 + isc_unregister(airq->isc); 76 + if (airq->flags & AIRQ_PTR_ALLOCATED) { 77 + kfree(airq->lsi_ptr); 78 + airq->lsi_ptr = NULL; 79 + airq->flags &= ~AIRQ_PTR_ALLOCATED; 80 + } 110 81 } 111 - EXPORT_SYMBOL(s390_unregister_adapter_interrupt); 112 - 113 - #define INDICATOR_MASK (0xffUL << ((NR_AIRQS_PER_WORD - 1) * 8)) 82 + EXPORT_SYMBOL(unregister_adapter_interrupt); 114 83 115 84 void do_adapter_IO(u8 isc) 116 85 { 117 - int w; 118 - int i; 119 - unsigned long word; 120 - struct airq_t *airq; 86 + struct airq_struct *airq; 87 + struct hlist_head *head; 121 88 122 - /* 123 - * Access indicator array in word-sized chunks to minimize storage 124 - * fetch operations. 125 - */ 126 - for (w = 0; w < NR_AIRQ_WORDS; w++) { 127 - word = indicators[isc].word[w]; 128 - i = w * NR_AIRQS_PER_WORD; 129 - /* 130 - * Check bytes within word for active indicators. 131 - */ 132 - while (word) { 133 - if (word & INDICATOR_MASK) { 134 - airq = airqs[isc][i]; 135 - /* Make sure gcc reads from airqs only once. */ 136 - barrier(); 137 - if (likely(airq)) 138 - airq->handler(&indicators[isc].byte[i], 139 - airq->drv_data); 140 - else 141 - /* 142 - * Reset ill-behaved indicator. 143 - */ 144 - indicators[isc].byte[i] = 0; 145 - } 146 - word <<= 8; 147 - i++; 148 - } 149 - } 89 + head = &airq_lists[isc]; 90 + rcu_read_lock(); 91 + hlist_for_each_entry_rcu(airq, head, list) 92 + if ((*airq->lsi_ptr & airq->lsi_mask) != 0) 93 + airq->handler(airq); 94 + rcu_read_unlock(); 150 95 }
+60
drivers/s390/cio/chsc.c
··· 20 20 #include <asm/chpid.h> 21 21 #include <asm/chsc.h> 22 22 #include <asm/crw.h> 23 + #include <asm/isc.h> 23 24 24 25 #include "css.h" 25 26 #include "cio.h" ··· 144 143 spin_unlock_irq(&chsc_page_lock); 145 144 return ret; 146 145 } 146 + 147 + /** 148 + * chsc_ssqd() - store subchannel QDIO data (SSQD) 149 + * @schid: id of the subchannel on which SSQD is performed 150 + * @ssqd: request and response block for SSQD 151 + * 152 + * Returns 0 on success. 153 + */ 154 + int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd) 155 + { 156 + memset(ssqd, 0, sizeof(*ssqd)); 157 + ssqd->request.length = 0x0010; 158 + ssqd->request.code = 0x0024; 159 + ssqd->first_sch = schid.sch_no; 160 + ssqd->last_sch = schid.sch_no; 161 + ssqd->ssid = schid.ssid; 162 + 163 + if (chsc(ssqd)) 164 + return -EIO; 165 + 166 + return chsc_error_from_response(ssqd->response.code); 167 + } 168 + EXPORT_SYMBOL_GPL(chsc_ssqd); 169 + 170 + /** 171 + * chsc_sadc() - set adapter device controls (SADC) 172 + * @schid: id of the subchannel on which SADC is performed 173 + * @scssc: request and response block for SADC 174 + * @summary_indicator_addr: summary indicator address 175 + * @subchannel_indicator_addr: subchannel indicator address 176 + * 177 + * Returns 0 on success. 178 + */ 179 + int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, 180 + u64 summary_indicator_addr, u64 subchannel_indicator_addr) 181 + { 182 + memset(scssc, 0, sizeof(*scssc)); 183 + scssc->request.length = 0x0fe0; 184 + scssc->request.code = 0x0021; 185 + scssc->operation_code = 0; 186 + 187 + scssc->summary_indicator_addr = summary_indicator_addr; 188 + scssc->subchannel_indicator_addr = subchannel_indicator_addr; 189 + 190 + scssc->ks = PAGE_DEFAULT_KEY >> 4; 191 + scssc->kc = PAGE_DEFAULT_KEY >> 4; 192 + scssc->isc = QDIO_AIRQ_ISC; 193 + scssc->schid = schid; 194 + 195 + /* enable the time delay disablement facility */ 196 + if (css_general_characteristics.aif_tdd) 197 + scssc->word_with_d_bit = 0x10000000; 198 + 199 + if (chsc(scssc)) 200 + return -EIO; 201 + 202 + return chsc_error_from_response(scssc->response.code); 203 + } 204 + EXPORT_SYMBOL_GPL(chsc_sadc); 147 205 148 206 static int s390_subchannel_remove_chpid(struct subchannel *sch, void *data) 149 207 {
+38 -6
drivers/s390/cio/chsc.h
··· 7 7 #include <asm/chpid.h> 8 8 #include <asm/chsc.h> 9 9 #include <asm/schid.h> 10 + #include <asm/qdio.h> 10 11 11 12 #define CHSC_SDA_OC_MSS 0x2 12 - 13 - struct chsc_header { 14 - u16 length; 15 - u16 code; 16 - } __attribute__ ((packed)); 17 13 18 14 #define NR_MEASUREMENT_CHARS 5 19 15 struct cmg_chars { ··· 73 77 u16 fla[8]; 74 78 }; 75 79 80 + struct chsc_ssqd_area { 81 + struct chsc_header request; 82 + u16:10; 83 + u8 ssid:2; 84 + u8 fmt:4; 85 + u16 first_sch; 86 + u16:16; 87 + u16 last_sch; 88 + u32:32; 89 + struct chsc_header response; 90 + u32:32; 91 + struct qdio_ssqd_desc qdio_ssqd; 92 + } __packed; 93 + 94 + struct chsc_scssc_area { 95 + struct chsc_header request; 96 + u16 operation_code; 97 + u16:16; 98 + u32:32; 99 + u32:32; 100 + u64 summary_indicator_addr; 101 + u64 subchannel_indicator_addr; 102 + u32 ks:4; 103 + u32 kc:4; 104 + u32:21; 105 + u32 isc:3; 106 + u32 word_with_d_bit; 107 + u32:32; 108 + struct subchannel_id schid; 109 + u32 reserved[1004]; 110 + struct chsc_header response; 111 + u32:32; 112 + } __packed; 113 + 76 114 struct chsc_scpd { 77 115 struct chsc_header request; 78 116 u32:2; ··· 146 116 void chsc_chp_online(struct chp_id chpid); 147 117 void chsc_chp_offline(struct chp_id chpid); 148 118 int chsc_get_channel_measurement_chars(struct channel_path *chp); 149 - 119 + int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd); 120 + int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, 121 + u64 summary_indicator_addr, u64 subchannel_indicator_addr); 150 122 int chsc_error_from_response(int response); 151 123 152 124 int chsc_siosl(struct subchannel_id schid);
+150 -5
drivers/s390/cio/chsc_sch.c
··· 29 29 static debug_info_t *chsc_debug_msg_id; 30 30 static debug_info_t *chsc_debug_log_id; 31 31 32 + static struct chsc_request *on_close_request; 33 + static struct chsc_async_area *on_close_chsc_area; 34 + static DEFINE_MUTEX(on_close_mutex); 35 + 32 36 #define CHSC_MSG(imp, args...) do { \ 33 37 debug_sprintf_event(chsc_debug_msg_id, imp , ##args); \ 34 38 } while (0) ··· 262 258 CHSC_LOG(2, "schid"); 263 259 CHSC_LOG_HEX(2, &sch->schid, sizeof(sch->schid)); 264 260 cc = chsc(chsc_area); 265 - sprintf(dbf, "cc:%d", cc); 261 + snprintf(dbf, sizeof(dbf), "cc:%d", cc); 266 262 CHSC_LOG(2, dbf); 267 263 switch (cc) { 268 264 case 0: ··· 291 287 return ret; 292 288 } 293 289 294 - static void chsc_log_command(struct chsc_async_area *chsc_area) 290 + static void chsc_log_command(void *chsc_area) 295 291 { 296 292 char dbf[10]; 297 293 298 - sprintf(dbf, "CHSC:%x", chsc_area->header.code); 294 + snprintf(dbf, sizeof(dbf), "CHSC:%x", ((uint16_t *)chsc_area)[1]); 299 295 CHSC_LOG(0, dbf); 300 296 CHSC_LOG_HEX(0, chsc_area, 32); 301 297 } ··· 359 355 if (copy_to_user(user_area, chsc_area, PAGE_SIZE)) 360 356 ret = -EFAULT; 361 357 out_free: 362 - sprintf(dbf, "ret:%d", ret); 358 + snprintf(dbf, sizeof(dbf), "ret:%d", ret); 363 359 CHSC_LOG(0, dbf); 364 360 kfree(request); 361 + free_page((unsigned long)chsc_area); 362 + return ret; 363 + } 364 + 365 + static int chsc_ioctl_on_close_set(void __user *user_area) 366 + { 367 + char dbf[13]; 368 + int ret; 369 + 370 + mutex_lock(&on_close_mutex); 371 + if (on_close_chsc_area) { 372 + ret = -EBUSY; 373 + goto out_unlock; 374 + } 375 + on_close_request = kzalloc(sizeof(*on_close_request), GFP_KERNEL); 376 + if (!on_close_request) { 377 + ret = -ENOMEM; 378 + goto out_unlock; 379 + } 380 + on_close_chsc_area = (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL); 381 + if (!on_close_chsc_area) { 382 + ret = -ENOMEM; 383 + goto out_free_request; 384 + } 385 + if (copy_from_user(on_close_chsc_area, user_area, PAGE_SIZE)) { 386 + ret = -EFAULT; 387 + goto out_free_chsc; 388 + } 389 + ret = 0; 390 + goto out_unlock; 391 + 392 + out_free_chsc: 393 + free_page((unsigned long)on_close_chsc_area); 394 + on_close_chsc_area = NULL; 395 + out_free_request: 396 + kfree(on_close_request); 397 + on_close_request = NULL; 398 + out_unlock: 399 + mutex_unlock(&on_close_mutex); 400 + snprintf(dbf, sizeof(dbf), "ocsret:%d", ret); 401 + CHSC_LOG(0, dbf); 402 + return ret; 403 + } 404 + 405 + static int chsc_ioctl_on_close_remove(void) 406 + { 407 + char dbf[13]; 408 + int ret; 409 + 410 + mutex_lock(&on_close_mutex); 411 + if (!on_close_chsc_area) { 412 + ret = -ENOENT; 413 + goto out_unlock; 414 + } 415 + free_page((unsigned long)on_close_chsc_area); 416 + on_close_chsc_area = NULL; 417 + kfree(on_close_request); 418 + on_close_request = NULL; 419 + ret = 0; 420 + out_unlock: 421 + mutex_unlock(&on_close_mutex); 422 + snprintf(dbf, sizeof(dbf), "ocrret:%d", ret); 423 + CHSC_LOG(0, dbf); 424 + return ret; 425 + } 426 + 427 + static int chsc_ioctl_start_sync(void __user *user_area) 428 + { 429 + struct chsc_sync_area *chsc_area; 430 + int ret, ccode; 431 + 432 + chsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); 433 + if (!chsc_area) 434 + return -ENOMEM; 435 + if (copy_from_user(chsc_area, user_area, PAGE_SIZE)) { 436 + ret = -EFAULT; 437 + goto out_free; 438 + } 439 + if (chsc_area->header.code & 0x4000) { 440 + ret = -EINVAL; 441 + goto out_free; 442 + } 443 + chsc_log_command(chsc_area); 444 + ccode = chsc(chsc_area); 445 + if (ccode != 0) { 446 + ret = -EIO; 447 + goto out_free; 448 + } 449 + if (copy_to_user(user_area, chsc_area, PAGE_SIZE)) 450 + ret = -EFAULT; 451 + else 452 + ret = 0; 453 + out_free: 365 454 free_page((unsigned long)chsc_area); 366 455 return ret; 367 456 } ··· 892 795 switch (cmd) { 893 796 case CHSC_START: 894 797 return chsc_ioctl_start(argp); 798 + case CHSC_START_SYNC: 799 + return chsc_ioctl_start_sync(argp); 895 800 case CHSC_INFO_CHANNEL_PATH: 896 801 return chsc_ioctl_info_channel_path(argp); 897 802 case CHSC_INFO_CU: ··· 908 809 return chsc_ioctl_chpd(argp); 909 810 case CHSC_INFO_DCAL: 910 811 return chsc_ioctl_dcal(argp); 812 + case CHSC_ON_CLOSE_SET: 813 + return chsc_ioctl_on_close_set(argp); 814 + case CHSC_ON_CLOSE_REMOVE: 815 + return chsc_ioctl_on_close_remove(); 911 816 default: /* unknown ioctl number */ 912 817 return -ENOIOCTLCMD; 913 818 } 914 819 } 915 820 821 + static atomic_t chsc_ready_for_use = ATOMIC_INIT(1); 822 + 823 + static int chsc_open(struct inode *inode, struct file *file) 824 + { 825 + if (!atomic_dec_and_test(&chsc_ready_for_use)) { 826 + atomic_inc(&chsc_ready_for_use); 827 + return -EBUSY; 828 + } 829 + return nonseekable_open(inode, file); 830 + } 831 + 832 + static int chsc_release(struct inode *inode, struct file *filp) 833 + { 834 + char dbf[13]; 835 + int ret; 836 + 837 + mutex_lock(&on_close_mutex); 838 + if (!on_close_chsc_area) 839 + goto out_unlock; 840 + init_completion(&on_close_request->completion); 841 + CHSC_LOG(0, "on_close"); 842 + chsc_log_command(on_close_chsc_area); 843 + spin_lock_irq(&chsc_lock); 844 + ret = chsc_async(on_close_chsc_area, on_close_request); 845 + spin_unlock_irq(&chsc_lock); 846 + if (ret == -EINPROGRESS) { 847 + wait_for_completion(&on_close_request->completion); 848 + ret = chsc_examine_irb(on_close_request); 849 + } 850 + snprintf(dbf, sizeof(dbf), "relret:%d", ret); 851 + CHSC_LOG(0, dbf); 852 + free_page((unsigned long)on_close_chsc_area); 853 + on_close_chsc_area = NULL; 854 + kfree(on_close_request); 855 + on_close_request = NULL; 856 + out_unlock: 857 + mutex_unlock(&on_close_mutex); 858 + atomic_inc(&chsc_ready_for_use); 859 + return 0; 860 + } 861 + 916 862 static const struct file_operations chsc_fops = { 917 863 .owner = THIS_MODULE, 918 - .open = nonseekable_open, 864 + .open = chsc_open, 865 + .release = chsc_release, 919 866 .unlocked_ioctl = chsc_ioctl, 920 867 .compat_ioctl = chsc_ioctl, 921 868 .llseek = no_llseek,
+28 -40
drivers/s390/cio/cio.c
··· 568 568 */ 569 569 void __irq_entry do_IRQ(struct pt_regs *regs) 570 570 { 571 - struct tpi_info *tpi_info; 571 + struct tpi_info *tpi_info = (struct tpi_info *) &regs->int_code; 572 572 struct subchannel *sch; 573 573 struct irb *irb; 574 574 struct pt_regs *old_regs; ··· 579 579 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 580 580 /* Serve timer interrupts first. */ 581 581 clock_comparator_work(); 582 - /* 583 - * Get interrupt information from lowcore 584 - */ 585 - tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; 586 - irb = (struct irb *)&S390_lowcore.irb; 587 - do { 588 - kstat_incr_irqs_this_cpu(IO_INTERRUPT, NULL); 589 - if (tpi_info->adapter_IO) { 590 - do_adapter_IO(tpi_info->isc); 591 - continue; 592 - } 593 - sch = (struct subchannel *)(unsigned long)tpi_info->intparm; 594 - if (!sch) { 595 - /* Clear pending interrupt condition. */ 582 + 583 + kstat_incr_irqs_this_cpu(IO_INTERRUPT, NULL); 584 + irb = (struct irb *) &S390_lowcore.irb; 585 + if (tpi_info->adapter_IO) { 586 + do_adapter_IO(tpi_info->isc); 587 + goto out; 588 + } 589 + sch = (struct subchannel *)(unsigned long) tpi_info->intparm; 590 + if (!sch) { 591 + /* Clear pending interrupt condition. */ 592 + inc_irq_stat(IRQIO_CIO); 593 + tsch(tpi_info->schid, irb); 594 + goto out; 595 + } 596 + spin_lock(sch->lock); 597 + /* Store interrupt response block to lowcore. */ 598 + if (tsch(tpi_info->schid, irb) == 0) { 599 + /* Keep subchannel information word up to date. */ 600 + memcpy (&sch->schib.scsw, &irb->scsw, sizeof (irb->scsw)); 601 + /* Call interrupt handler if there is one. */ 602 + if (sch->driver && sch->driver->irq) 603 + sch->driver->irq(sch); 604 + else 596 605 inc_irq_stat(IRQIO_CIO); 597 - tsch(tpi_info->schid, irb); 598 - continue; 599 - } 600 - spin_lock(sch->lock); 601 - /* Store interrupt response block to lowcore. */ 602 - if (tsch(tpi_info->schid, irb) == 0) { 603 - /* Keep subchannel information word up to date. */ 604 - memcpy (&sch->schib.scsw, &irb->scsw, 605 - sizeof (irb->scsw)); 606 - /* Call interrupt handler if there is one. */ 607 - if (sch->driver && sch->driver->irq) 608 - sch->driver->irq(sch); 609 - else 610 - inc_irq_stat(IRQIO_CIO); 611 - } else 612 - inc_irq_stat(IRQIO_CIO); 613 - spin_unlock(sch->lock); 614 - /* 615 - * Are more interrupts pending? 616 - * If so, the tpi instruction will update the lowcore 617 - * to hold the info for the next interrupt. 618 - * We don't do this for VM because a tpi drops the cpu 619 - * out of the sie which costs more cycles than it saves. 620 - */ 621 - } while (MACHINE_IS_LPAR && tpi(NULL) != 0); 606 + } else 607 + inc_irq_stat(IRQIO_CIO); 608 + spin_unlock(sch->lock); 609 + out: 622 610 irq_exit(); 623 611 set_irq_regs(old_regs); 624 612 }
-34
drivers/s390/cio/qdio.h
··· 140 140 u8:3; 141 141 } __attribute__ ((packed)); 142 142 143 - struct chsc_ssqd_area { 144 - struct chsc_header request; 145 - u16:10; 146 - u8 ssid:2; 147 - u8 fmt:4; 148 - u16 first_sch; 149 - u16:16; 150 - u16 last_sch; 151 - u32:32; 152 - struct chsc_header response; 153 - u32:32; 154 - struct qdio_ssqd_desc qdio_ssqd; 155 - } __attribute__ ((packed)); 156 - 157 - struct scssc_area { 158 - struct chsc_header request; 159 - u16 operation_code; 160 - u16:16; 161 - u32:32; 162 - u32:32; 163 - u64 summary_indicator_addr; 164 - u64 subchannel_indicator_addr; 165 - u32 ks:4; 166 - u32 kc:4; 167 - u32:21; 168 - u32 isc:3; 169 - u32 word_with_d_bit; 170 - u32:32; 171 - struct subchannel_id schid; 172 - u32 reserved[1004]; 173 - struct chsc_header response; 174 - u32:32; 175 - } __attribute__ ((packed)); 176 - 177 143 struct qdio_dev_perf_stat { 178 144 unsigned int adapter_int; 179 145 unsigned int qdio_int;
-44
drivers/s390/cio/qdio_main.c
··· 608 608 return !q->is_input_q && q->u.out.use_cq; 609 609 } 610 610 611 - static inline void qdio_trace_aob(struct qdio_irq *irq, struct qdio_q *q, 612 - int i, struct qaob *aob) 613 - { 614 - int tmp; 615 - 616 - DBF_DEV_EVENT(DBF_INFO, irq, "AOB%d:%lx", i, 617 - (unsigned long) virt_to_phys(aob)); 618 - DBF_DEV_EVENT(DBF_INFO, irq, "RES00:%lx", 619 - (unsigned long) aob->res0[0]); 620 - DBF_DEV_EVENT(DBF_INFO, irq, "RES01:%lx", 621 - (unsigned long) aob->res0[1]); 622 - DBF_DEV_EVENT(DBF_INFO, irq, "RES02:%lx", 623 - (unsigned long) aob->res0[2]); 624 - DBF_DEV_EVENT(DBF_INFO, irq, "RES03:%lx", 625 - (unsigned long) aob->res0[3]); 626 - DBF_DEV_EVENT(DBF_INFO, irq, "RES04:%lx", 627 - (unsigned long) aob->res0[4]); 628 - DBF_DEV_EVENT(DBF_INFO, irq, "RES05:%lx", 629 - (unsigned long) aob->res0[5]); 630 - DBF_DEV_EVENT(DBF_INFO, irq, "RES1:%x", aob->res1); 631 - DBF_DEV_EVENT(DBF_INFO, irq, "RES2:%x", aob->res2); 632 - DBF_DEV_EVENT(DBF_INFO, irq, "RES3:%x", aob->res3); 633 - DBF_DEV_EVENT(DBF_INFO, irq, "AORC:%u", aob->aorc); 634 - DBF_DEV_EVENT(DBF_INFO, irq, "FLAGS:%u", aob->flags); 635 - DBF_DEV_EVENT(DBF_INFO, irq, "CBTBS:%u", aob->cbtbs); 636 - DBF_DEV_EVENT(DBF_INFO, irq, "SBC:%u", aob->sb_count); 637 - for (tmp = 0; tmp < QDIO_MAX_ELEMENTS_PER_BUFFER; ++tmp) { 638 - DBF_DEV_EVENT(DBF_INFO, irq, "SBA%d:%lx", tmp, 639 - (unsigned long) aob->sba[tmp]); 640 - DBF_DEV_EVENT(DBF_INFO, irq, "rSBA%d:%lx", tmp, 641 - (unsigned long) q->sbal[i]->element[tmp].addr); 642 - DBF_DEV_EVENT(DBF_INFO, irq, "DC%d:%u", tmp, aob->dcount[tmp]); 643 - DBF_DEV_EVENT(DBF_INFO, irq, "rDC%d:%u", tmp, 644 - q->sbal[i]->element[tmp].length); 645 - } 646 - DBF_DEV_EVENT(DBF_INFO, irq, "USER0:%lx", (unsigned long) aob->user0); 647 - for (tmp = 0; tmp < 2; ++tmp) { 648 - DBF_DEV_EVENT(DBF_INFO, irq, "RES4%d:%lx", tmp, 649 - (unsigned long) aob->res4[tmp]); 650 - } 651 - DBF_DEV_EVENT(DBF_INFO, irq, "USER1:%lx", (unsigned long) aob->user1); 652 - DBF_DEV_EVENT(DBF_INFO, irq, "USER2:%lx", (unsigned long) aob->user2); 653 - } 654 - 655 611 static inline void qdio_handle_aobs(struct qdio_q *q, int start, int count) 656 612 { 657 613 unsigned char state = 0;
+17 -26
drivers/s390/cio/qdio_setup.c
··· 254 254 int rc; 255 255 256 256 DBF_EVENT("getssqd:%4x", schid->sch_no); 257 - if (irq_ptr != NULL) 258 - ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page; 259 - else 257 + if (!irq_ptr) { 260 258 ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL); 261 - memset(ssqd, 0, PAGE_SIZE); 259 + if (!ssqd) 260 + return -ENOMEM; 261 + } else { 262 + ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page; 263 + } 262 264 263 - ssqd->request = (struct chsc_header) { 264 - .length = 0x0010, 265 - .code = 0x0024, 266 - }; 267 - ssqd->first_sch = schid->sch_no; 268 - ssqd->last_sch = schid->sch_no; 269 - ssqd->ssid = schid->ssid; 270 - 271 - if (chsc(ssqd)) 272 - return -EIO; 273 - rc = chsc_error_from_response(ssqd->response.code); 265 + rc = chsc_ssqd(*schid, ssqd); 274 266 if (rc) 275 - return rc; 267 + goto out; 276 268 277 269 if (!(ssqd->qdio_ssqd.flags & CHSC_FLAG_QDIO_CAPABILITY) || 278 270 !(ssqd->qdio_ssqd.flags & CHSC_FLAG_VALIDITY) || 279 271 (ssqd->qdio_ssqd.sch != schid->sch_no)) 280 - return -EINVAL; 272 + rc = -EINVAL; 281 273 282 - if (irq_ptr != NULL) 283 - memcpy(&irq_ptr->ssqd_desc, &ssqd->qdio_ssqd, 284 - sizeof(struct qdio_ssqd_desc)); 285 - else { 286 - memcpy(data, &ssqd->qdio_ssqd, 287 - sizeof(struct qdio_ssqd_desc)); 274 + if (!rc) 275 + memcpy(data, &ssqd->qdio_ssqd, sizeof(*data)); 276 + 277 + out: 278 + if (!irq_ptr) 288 279 free_page((unsigned long)ssqd); 289 - } 290 - return 0; 280 + 281 + return rc; 291 282 } 292 283 293 284 void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) ··· 286 295 unsigned char qdioac; 287 296 int rc; 288 297 289 - rc = qdio_setup_get_ssqd(irq_ptr, &irq_ptr->schid, NULL); 298 + rc = qdio_setup_get_ssqd(irq_ptr, &irq_ptr->schid, &irq_ptr->ssqd_desc); 290 299 if (rc) { 291 300 DBF_ERROR("%4x ssqd ERR", irq_ptr->schid.sch_no); 292 301 DBF_ERROR("rc:%x", rc);
+29 -50
drivers/s390/cio/qdio_thinint.c
··· 36 36 static LIST_HEAD(tiq_list); 37 37 static DEFINE_MUTEX(tiq_list_lock); 38 38 39 - /* adapter local summary indicator */ 40 - static u8 *tiqdio_alsi; 39 + /* Adapter interrupt definitions */ 40 + static void tiqdio_thinint_handler(struct airq_struct *airq); 41 + 42 + static struct airq_struct tiqdio_airq = { 43 + .handler = tiqdio_thinint_handler, 44 + .isc = QDIO_AIRQ_ISC, 45 + }; 41 46 42 47 static struct indicator_t *q_indicators; 43 48 ··· 181 176 * @alsi: pointer to adapter local summary indicator 182 177 * @data: NULL 183 178 */ 184 - static void tiqdio_thinint_handler(void *alsi, void *data) 179 + static void tiqdio_thinint_handler(struct airq_struct *airq) 185 180 { 186 181 u32 si_used = clear_shared_ind(); 187 182 struct qdio_q *q; ··· 213 208 214 209 static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset) 215 210 { 216 - struct scssc_area *scssc_area; 211 + struct chsc_scssc_area *scssc = (void *)irq_ptr->chsc_page; 212 + u64 summary_indicator_addr, subchannel_indicator_addr; 217 213 int rc; 218 214 219 - scssc_area = (struct scssc_area *)irq_ptr->chsc_page; 220 - memset(scssc_area, 0, PAGE_SIZE); 221 - 222 215 if (reset) { 223 - scssc_area->summary_indicator_addr = 0; 224 - scssc_area->subchannel_indicator_addr = 0; 216 + summary_indicator_addr = 0; 217 + subchannel_indicator_addr = 0; 225 218 } else { 226 - scssc_area->summary_indicator_addr = virt_to_phys(tiqdio_alsi); 227 - scssc_area->subchannel_indicator_addr = 228 - virt_to_phys(irq_ptr->dsci); 219 + summary_indicator_addr = virt_to_phys(tiqdio_airq.lsi_ptr); 220 + subchannel_indicator_addr = virt_to_phys(irq_ptr->dsci); 229 221 } 230 222 231 - scssc_area->request = (struct chsc_header) { 232 - .length = 0x0fe0, 233 - .code = 0x0021, 234 - }; 235 - scssc_area->operation_code = 0; 236 - scssc_area->ks = PAGE_DEFAULT_KEY >> 4; 237 - scssc_area->kc = PAGE_DEFAULT_KEY >> 4; 238 - scssc_area->isc = QDIO_AIRQ_ISC; 239 - scssc_area->schid = irq_ptr->schid; 240 - 241 - /* enable the time delay disablement facility */ 242 - if (css_general_characteristics.aif_tdd) 243 - scssc_area->word_with_d_bit = 0x10000000; 244 - 245 - rc = chsc(scssc_area); 246 - if (rc) 247 - return -EIO; 248 - 249 - rc = chsc_error_from_response(scssc_area->response.code); 223 + rc = chsc_sadc(irq_ptr->schid, scssc, summary_indicator_addr, 224 + subchannel_indicator_addr); 250 225 if (rc) { 251 226 DBF_ERROR("%4x SSI r:%4x", irq_ptr->schid.sch_no, 252 - scssc_area->response.code); 253 - DBF_ERROR_HEX(&scssc_area->response, sizeof(void *)); 254 - return rc; 227 + scssc->response.code); 228 + goto out; 255 229 } 256 230 257 231 DBF_EVENT("setscind"); 258 - DBF_HEX(&scssc_area->summary_indicator_addr, sizeof(unsigned long)); 259 - DBF_HEX(&scssc_area->subchannel_indicator_addr, sizeof(unsigned long)); 260 - return 0; 232 + DBF_HEX(&summary_indicator_addr, sizeof(summary_indicator_addr)); 233 + DBF_HEX(&subchannel_indicator_addr, sizeof(subchannel_indicator_addr)); 234 + out: 235 + return rc; 261 236 } 262 237 263 238 /* allocate non-shared indicators and shared indicator */ ··· 257 272 258 273 int __init tiqdio_register_thinints(void) 259 274 { 260 - isc_register(QDIO_AIRQ_ISC); 261 - tiqdio_alsi = s390_register_adapter_interrupt(&tiqdio_thinint_handler, 262 - NULL, QDIO_AIRQ_ISC); 263 - if (IS_ERR(tiqdio_alsi)) { 264 - DBF_EVENT("RTI:%lx", PTR_ERR(tiqdio_alsi)); 265 - tiqdio_alsi = NULL; 266 - isc_unregister(QDIO_AIRQ_ISC); 267 - return -ENOMEM; 275 + int rc; 276 + 277 + rc = register_adapter_interrupt(&tiqdio_airq); 278 + if (rc) { 279 + DBF_EVENT("RTI:%x", rc); 280 + return rc; 268 281 } 269 282 return 0; 270 283 } ··· 295 312 void __exit tiqdio_unregister_thinints(void) 296 313 { 297 314 WARN_ON(!list_empty(&tiq_list)); 298 - 299 - if (tiqdio_alsi) { 300 - s390_unregister_adapter_interrupt(tiqdio_alsi, QDIO_AIRQ_ISC); 301 - isc_unregister(QDIO_AIRQ_ISC); 302 - } 315 + unregister_adapter_interrupt(&tiqdio_airq); 303 316 }
+37 -27
drivers/s390/crypto/ap_bus.c
··· 58 58 static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags); 59 59 static int ap_device_remove(struct device *dev); 60 60 static int ap_device_probe(struct device *dev); 61 - static void ap_interrupt_handler(void *unused1, void *unused2); 61 + static void ap_interrupt_handler(struct airq_struct *airq); 62 62 static void ap_reset(struct ap_device *ap_dev); 63 63 static void ap_config_timeout(unsigned long ptr); 64 64 static int ap_select_domain(void); ··· 106 106 static struct task_struct *ap_poll_kthread = NULL; 107 107 static DEFINE_MUTEX(ap_poll_thread_mutex); 108 108 static DEFINE_SPINLOCK(ap_poll_timer_lock); 109 - static void *ap_interrupt_indicator; 110 109 static struct hrtimer ap_poll_timer; 111 110 /* In LPAR poll with 4kHz frequency. Poll every 250000 nanoseconds. 112 111 * If z/VM change to 1500000 nanoseconds to adjust to z/VM polling.*/ ··· 119 120 static int user_set_domain = 0; 120 121 static struct bus_type ap_bus_type; 121 122 123 + /* Adapter interrupt definitions */ 124 + static int ap_airq_flag; 125 + 126 + static struct airq_struct ap_airq = { 127 + .handler = ap_interrupt_handler, 128 + .isc = AP_ISC, 129 + }; 130 + 122 131 /** 123 132 * ap_using_interrupts() - Returns non-zero if interrupt support is 124 133 * available. 125 134 */ 126 135 static inline int ap_using_interrupts(void) 127 136 { 128 - return ap_interrupt_indicator != NULL; 137 + return ap_airq_flag; 129 138 } 130 139 131 140 /** ··· 595 588 } 596 589 } 597 590 if (rc == 0 && ap_using_interrupts()) { 598 - rc = ap_queue_enable_interruption(qid, ap_interrupt_indicator); 591 + rc = ap_queue_enable_interruption(qid, ap_airq.lsi_ptr); 599 592 /* If interruption mode is supported by the machine, 600 593 * but an AP can not be enabled for interruption then 601 594 * the AP will be discarded. */ ··· 828 821 829 822 static int ap_bus_resume(struct device *dev) 830 823 { 831 - int rc = 0; 832 824 struct ap_device *ap_dev = to_ap_dev(dev); 825 + int rc; 833 826 834 827 if (ap_suspend_flag) { 835 828 ap_suspend_flag = 0; 836 - if (!ap_interrupts_available()) 837 - ap_interrupt_indicator = NULL; 829 + if (ap_interrupts_available()) { 830 + if (!ap_using_interrupts()) { 831 + rc = register_adapter_interrupt(&ap_airq); 832 + ap_airq_flag = (rc == 0); 833 + } 834 + } else { 835 + if (ap_using_interrupts()) { 836 + unregister_adapter_interrupt(&ap_airq); 837 + ap_airq_flag = 0; 838 + } 839 + } 838 840 ap_query_configuration(); 839 841 if (!user_set_domain) { 840 842 ap_domain_index = -1; ··· 864 848 tasklet_schedule(&ap_tasklet); 865 849 if (ap_thread_flag) 866 850 rc = ap_poll_thread_start(); 867 - } 851 + else 852 + rc = 0; 853 + } else 854 + rc = 0; 868 855 if (AP_QID_QUEUE(ap_dev->qid) != ap_domain_index) { 869 856 spin_lock_bh(&ap_dev->lock); 870 857 ap_dev->qid = AP_MKQID(AP_QID_DEVICE(ap_dev->qid), ··· 1285 1266 return rc; 1286 1267 } 1287 1268 1288 - static void ap_interrupt_handler(void *unused1, void *unused2) 1269 + static void ap_interrupt_handler(struct airq_struct *airq) 1289 1270 { 1290 1271 inc_irq_stat(IRQIO_APB); 1291 1272 tasklet_schedule(&ap_tasklet); ··· 1741 1722 * important that no requests on any AP get lost. 1742 1723 */ 1743 1724 if (ap_using_interrupts()) 1744 - xchg((u8 *)ap_interrupt_indicator, 0); 1725 + xchg(ap_airq.lsi_ptr, 0); 1745 1726 do { 1746 1727 flags = 0; 1747 1728 spin_lock(&ap_device_list_lock); ··· 1814 1795 mutex_lock(&ap_poll_thread_mutex); 1815 1796 if (!ap_poll_kthread) { 1816 1797 ap_poll_kthread = kthread_run(ap_poll_thread, NULL, "appoll"); 1817 - rc = IS_ERR(ap_poll_kthread) ? PTR_ERR(ap_poll_kthread) : 0; 1798 + rc = PTR_RET(ap_poll_kthread); 1818 1799 if (rc) 1819 1800 ap_poll_kthread = NULL; 1820 1801 } ··· 1900 1881 return -ENODEV; 1901 1882 } 1902 1883 if (ap_interrupts_available()) { 1903 - isc_register(AP_ISC); 1904 - ap_interrupt_indicator = s390_register_adapter_interrupt( 1905 - &ap_interrupt_handler, NULL, AP_ISC); 1906 - if (IS_ERR(ap_interrupt_indicator)) { 1907 - ap_interrupt_indicator = NULL; 1908 - isc_unregister(AP_ISC); 1909 - } 1884 + rc = register_adapter_interrupt(&ap_airq); 1885 + ap_airq_flag = (rc == 0); 1910 1886 } 1911 1887 1912 1888 register_reset_call(&ap_reset_call); ··· 1918 1904 1919 1905 /* Create /sys/devices/ap. */ 1920 1906 ap_root_device = root_device_register("ap"); 1921 - rc = IS_ERR(ap_root_device) ? PTR_ERR(ap_root_device) : 0; 1907 + rc = PTR_RET(ap_root_device); 1922 1908 if (rc) 1923 1909 goto out_bus; 1924 1910 ··· 1969 1955 bus_unregister(&ap_bus_type); 1970 1956 out: 1971 1957 unregister_reset_call(&ap_reset_call); 1972 - if (ap_using_interrupts()) { 1973 - s390_unregister_adapter_interrupt(ap_interrupt_indicator, AP_ISC); 1974 - isc_unregister(AP_ISC); 1975 - } 1958 + if (ap_using_interrupts()) 1959 + unregister_adapter_interrupt(&ap_airq); 1976 1960 return rc; 1977 1961 } 1978 1962 ··· 2006 1994 bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); 2007 1995 bus_unregister(&ap_bus_type); 2008 1996 unregister_reset_call(&ap_reset_call); 2009 - if (ap_using_interrupts()) { 2010 - s390_unregister_adapter_interrupt(ap_interrupt_indicator, AP_ISC); 2011 - isc_unregister(AP_ISC); 2012 - } 1997 + if (ap_using_interrupts()) 1998 + unregister_adapter_interrupt(&ap_airq); 2013 1999 } 2014 2000 2015 2001 module_init(ap_module_init);
+1 -1
drivers/s390/net/claw.c
··· 3348 3348 } 3349 3349 CLAW_DBF_TEXT(2, setup, "init_mod"); 3350 3350 claw_root_dev = root_device_register("claw"); 3351 - ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0; 3351 + ret = PTR_RET(claw_root_dev); 3352 3352 if (ret) 3353 3353 goto register_err; 3354 3354 ret = ccw_driver_register(&claw_ccw_driver);
+1 -1
drivers/s390/net/ctcm_main.c
··· 1837 1837 if (ret) 1838 1838 goto out_err; 1839 1839 ctcm_root_dev = root_device_register("ctcm"); 1840 - ret = IS_ERR(ctcm_root_dev) ? PTR_ERR(ctcm_root_dev) : 0; 1840 + ret = PTR_RET(ctcm_root_dev); 1841 1841 if (ret) 1842 1842 goto register_err; 1843 1843 ret = ccw_driver_register(&ctcm_ccw_driver);
+1 -1
drivers/s390/net/lcs.c
··· 2441 2441 if (rc) 2442 2442 goto out_err; 2443 2443 lcs_root_dev = root_device_register("lcs"); 2444 - rc = IS_ERR(lcs_root_dev) ? PTR_ERR(lcs_root_dev) : 0; 2444 + rc = PTR_RET(lcs_root_dev); 2445 2445 if (rc) 2446 2446 goto register_err; 2447 2447 rc = ccw_driver_register(&lcs_ccw_driver);
+1 -1
drivers/s390/net/qeth_core_main.c
··· 5705 5705 if (rc) 5706 5706 goto out_err; 5707 5707 qeth_core_root_dev = root_device_register("qeth"); 5708 - rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; 5708 + rc = PTR_RET(qeth_core_root_dev); 5709 5709 if (rc) 5710 5710 goto register_err; 5711 5711 qeth_core_header_cache = kmem_cache_create("qeth_hdr",
+1
include/linux/pci.h
··· 1643 1643 int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1644 1644 enum pcie_reset_state state); 1645 1645 int pcibios_add_device(struct pci_dev *dev); 1646 + void pcibios_release_device(struct pci_dev *dev); 1646 1647 1647 1648 #ifdef CONFIG_PCI_MMCONFIG 1648 1649 void __init pci_mmcfg_early_init(void);