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

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

* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
[S390] update documentation for hvc_iucv kernel parameter.
[S390] hvc_iucv: Special handling of IUCV HVC devices
[S390] hvc_iucv: Refactor console and device initialization
[S390] hvc_iucv: Update function documentation
[S390] hvc_iucv: Limit rate of outgoing IUCV messages
[S390] hvc_iucv: Change IUCV term id and use one device as default
[S390] Use unsigned long long for u64 on 64bit.
[S390] qdio: fix broken pointer in case of CONFIG_DEBUG_FS is disabled
[S390] vdso: compile fix
[S390] remove code for oldselect system call
[S390] types: add/fix types.h include in header files
[S390] dasd: add device attribute to disable blocking on lost paths
[S390] dasd: send change uevents for dasd block devices
[S390] tape block: fix dependencies
[S390] asm-s390/posix_types.h: drop __USE_ALL usage
[S390] gettimeofday.S: removed duplicated #includes
[S390] ptrace: no extern declarations for userspace

+376 -203
+2 -2
Documentation/kernel-parameters.txt
··· 834 834 835 835 hlt [BUGS=ARM,SH] 836 836 837 - hvc_iucv= [S390] Number of z/VM IUCV Hypervisor console (HVC) 838 - back-ends. Valid parameters: 0..8 837 + hvc_iucv= [S390] Number of z/VM IUCV hypervisor console (HVC) 838 + terminal devices. Valid values: 0..8 839 839 840 840 i8042.debug [HW] Toggle i8042 debug mode 841 841 i8042.direct [HW] Put keyboard port into non-translated mode
+1 -1
arch/s390/include/asm/chpid.h
··· 9 9 #define _ASM_S390_CHPID_H _ASM_S390_CHPID_H 10 10 11 11 #include <linux/string.h> 12 - #include <asm/types.h> 12 + #include <linux/types.h> 13 13 14 14 #define __MAX_CHPID 255 15 15
+1
arch/s390/include/asm/chsc.h
··· 8 8 #ifndef _ASM_CHSC_H 9 9 #define _ASM_CHSC_H 10 10 11 + #include <linux/types.h> 11 12 #include <asm/chpid.h> 12 13 #include <asm/schid.h> 13 14
+3
arch/s390/include/asm/cmb.h
··· 1 1 #ifndef S390_CMB_H 2 2 #define S390_CMB_H 3 + 4 + #include <linux/types.h> 5 + 3 6 /** 4 7 * struct cmbdata - channel measurement block data for user space 5 8 * @size: size of the stored data
+2
arch/s390/include/asm/dasd.h
··· 14 14 15 15 #ifndef DASD_H 16 16 #define DASD_H 17 + #include <linux/types.h> 17 18 #include <linux/ioctl.h> 18 19 19 20 #define DASD_IOCTL_LETTER 'D' ··· 79 78 #define DASD_FEATURE_USEDIAG 0x02 80 79 #define DASD_FEATURE_INITIAL_ONLINE 0x04 81 80 #define DASD_FEATURE_ERPLOG 0x08 81 + #define DASD_FEATURE_FAILFAST 0x10 82 82 83 83 #define DASD_PARTN_BITS 2 84 84
+1 -1
arch/s390/include/asm/kvm.h
··· 13 13 * Author(s): Carsten Otte <cotte@de.ibm.com> 14 14 * Christian Borntraeger <borntraeger@de.ibm.com> 15 15 */ 16 - #include <asm/types.h> 16 + #include <linux/types.h> 17 17 18 18 /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ 19 19 struct kvm_pic_state {
-4
arch/s390/include/asm/posix_types.h
··· 68 68 #endif /* __s390x__ */ 69 69 70 70 typedef struct { 71 - #if defined(__KERNEL__) || defined(__USE_ALL) 72 71 int val[2]; 73 - #else /* !defined(__KERNEL__) && !defined(__USE_ALL)*/ 74 - int __val[2]; 75 - #endif /* !defined(__KERNEL__) && !defined(__USE_ALL)*/ 76 72 } __kernel_fsid_t; 77 73 78 74
+5 -2
arch/s390/include/asm/ptrace.h
··· 272 272 #define PSW_ASC_SECONDARY 0x0000800000000000UL 273 273 #define PSW_ASC_HOME 0x0000C00000000000UL 274 274 275 - extern long psw_user32_bits; 276 - 277 275 #endif /* __s390x__ */ 278 276 277 + #ifdef __KERNEL__ 279 278 extern long psw_kernel_bits; 280 279 extern long psw_user_bits; 280 + #ifdef CONFIG_64BIT 281 + extern long psw_user32_bits; 282 + #endif 283 + #endif 281 284 282 285 /* This macro merges a NEW PSW mask specified by the user into 283 286 the currently active PSW mask CURRENT, modifying only those
+1
arch/s390/include/asm/qeth.h
··· 10 10 */ 11 11 #ifndef __ASM_S390_QETH_IOCTL_H__ 12 12 #define __ASM_S390_QETH_IOCTL_H__ 13 + #include <linux/types.h> 13 14 #include <linux/ioctl.h> 14 15 15 16 #define SIOC_QETH_ARP_SET_NO_ENTRIES (SIOCDEVPRIVATE)
+2
arch/s390/include/asm/schid.h
··· 1 1 #ifndef ASM_SCHID_H 2 2 #define ASM_SCHID_H 3 3 4 + #include <linux/types.h> 5 + 4 6 struct subchannel_id { 5 7 __u32 cssid : 8; 6 8 __u32 : 4;
+1 -1
arch/s390/include/asm/swab.h
··· 9 9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) 10 10 */ 11 11 12 - #include <asm/types.h> 12 + #include <linux/types.h> 13 13 14 14 #ifndef __s390x__ 15 15 # define __SWAB_64_THRU_32__
+1 -5
arch/s390/include/asm/types.h
··· 9 9 #ifndef _S390_TYPES_H 10 10 #define _S390_TYPES_H 11 11 12 - #ifndef __s390x__ 13 - # include <asm-generic/int-ll64.h> 14 - #else 15 - # include <asm-generic/int-l64.h> 16 - #endif 12 + #include <asm-generic/int-ll64.h> 17 13 18 14 #ifndef __ASSEMBLY__ 19 15
-2
arch/s390/kernel/entry.h
··· 54 54 long sys_rt_sigreturn(void); 55 55 long sys32_sigreturn(void); 56 56 long sys32_rt_sigreturn(void); 57 - long old_select(struct sel_arg_struct __user *arg); 58 - long sys_ptrace(long request, long pid, long addr, long data); 59 57 60 58 #endif /* _ENTRY_H */
+2 -1
arch/s390/kernel/smp.c
··· 685 685 if (MACHINE_HAS_IEEE) 686 686 lowcore->extended_save_area_addr = (u32) save_area; 687 687 #else 688 - BUG_ON(vdso_alloc_per_cpu(smp_processor_id(), lowcore)); 688 + if (vdso_alloc_per_cpu(smp_processor_id(), lowcore)) 689 + BUG(); 689 690 #endif 690 691 set_prefix((u32)(unsigned long) lowcore); 691 692 local_mcck_enable();
-19
arch/s390/kernel/sys_s390.c
··· 103 103 return error; 104 104 } 105 105 106 - #ifndef CONFIG_64BIT 107 - struct sel_arg_struct { 108 - unsigned long n; 109 - fd_set __user *inp, *outp, *exp; 110 - struct timeval __user *tvp; 111 - }; 112 - 113 - asmlinkage long old_select(struct sel_arg_struct __user *arg) 114 - { 115 - struct sel_arg_struct a; 116 - 117 - if (copy_from_user(&a, arg, sizeof(a))) 118 - return -EFAULT; 119 - /* sys_select() does the appropriate kernel locking */ 120 - return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); 121 - 122 - } 123 - #endif /* CONFIG_64BIT */ 124 - 125 106 /* 126 107 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 127 108 *
+2 -1
arch/s390/kernel/vdso.c
··· 322 322 vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data); 323 323 vdso64_pagelist[vdso64_pages] = NULL; 324 324 #ifndef CONFIG_SMP 325 - BUG_ON(vdso_alloc_per_cpu(0, S390_lowcore)); 325 + if (vdso_alloc_per_cpu(0, &S390_lowcore)) 326 + BUG(); 326 327 #endif 327 328 vdso_init_cr5(); 328 329 #endif /* CONFIG_64BIT */
-4
arch/s390/kernel/vdso32/gettimeofday.S
··· 13 13 #include <asm/asm-offsets.h> 14 14 #include <asm/unistd.h> 15 15 16 - #include <asm/vdso.h> 17 - #include <asm/asm-offsets.h> 18 - #include <asm/unistd.h> 19 - 20 16 .text 21 17 .align 4 22 18 .globl __kernel_gettimeofday
+1 -1
arch/s390/kvm/diag.c
··· 47 47 vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL; 48 48 vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT; 49 49 vcpu->run->exit_reason = KVM_EXIT_S390_RESET; 50 - VCPU_EVENT(vcpu, 3, "requesting userspace resets %lx", 50 + VCPU_EVENT(vcpu, 3, "requesting userspace resets %llx", 51 51 vcpu->run->s390_reset_flags); 52 52 return -EREMOTE; 53 53 }
+3 -3
arch/s390/kvm/interrupt.c
··· 160 160 break; 161 161 162 162 case KVM_S390_INT_VIRTIO: 163 - VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%lx", 163 + VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%llx", 164 164 inti->ext.ext_params, inti->ext.ext_params2); 165 165 vcpu->stat.deliver_virtio_interrupt++; 166 166 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2603); ··· 360 360 vcpu->arch.ckc_timer.expires = jiffies + sltime; 361 361 362 362 add_timer(&vcpu->arch.ckc_timer); 363 - VCPU_EVENT(vcpu, 5, "enabled wait timer:%lx jiffies", sltime); 363 + VCPU_EVENT(vcpu, 5, "enabled wait timer:%llx jiffies", sltime); 364 364 no_timer: 365 365 spin_lock_bh(&vcpu->arch.local_int.float_int->lock); 366 366 spin_lock_bh(&vcpu->arch.local_int.lock); ··· 491 491 492 492 switch (s390int->type) { 493 493 case KVM_S390_INT_VIRTIO: 494 - VM_EVENT(kvm, 5, "inject: virtio parm:%x,parm64:%lx", 494 + VM_EVENT(kvm, 5, "inject: virtio parm:%x,parm64:%llx", 495 495 s390int->parm, s390int->parm64); 496 496 inti->type = s390int->type; 497 497 inti->ext.ext_params = s390int->parm;
+1 -1
arch/s390/kvm/priv.c
··· 118 118 goto out; 119 119 } 120 120 121 - VCPU_EVENT(vcpu, 5, "storing cpu address to %lx", useraddr); 121 + VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr); 122 122 out: 123 123 return 0; 124 124 }
+270 -150
drivers/char/hvc_iucv.c
··· 1 1 /* 2 - * hvc_iucv.c - z/VM IUCV back-end for the Hypervisor Console (HVC) 2 + * hvc_iucv.c - z/VM IUCV hypervisor console (HVC) device driver 3 3 * 4 - * This back-end for HVC provides terminal access via 4 + * This HVC device driver provides terminal access using 5 5 * z/VM IUCV communication paths. 6 6 * 7 - * Copyright IBM Corp. 2008. 7 + * Copyright IBM Corp. 2008 8 8 * 9 9 * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> 10 10 */ 11 11 #define KMSG_COMPONENT "hvc_iucv" 12 + #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 12 13 13 14 #include <linux/types.h> 14 15 #include <asm/ebcdic.h> 16 + #include <linux/delay.h> 17 + #include <linux/init.h> 15 18 #include <linux/mempool.h> 16 19 #include <linux/module.h> 17 20 #include <linux/tty.h> 21 + #include <linux/wait.h> 18 22 #include <net/iucv/iucv.h> 19 23 20 24 #include "hvc_console.h" 21 25 22 26 23 - /* HVC backend for z/VM IUCV */ 27 + /* General device driver settings */ 24 28 #define HVC_IUCV_MAGIC 0xc9e4c3e5 25 29 #define MAX_HVC_IUCV_LINES HVC_ALLOC_TTY_ADAPTERS 26 30 #define MEMPOOL_MIN_NR (PAGE_SIZE / sizeof(struct iucv_tty_buffer)/4) ··· 37 33 #define MSG_TYPE_WINSIZE 0x08 /* Terminal window size update */ 38 34 #define MSG_TYPE_DATA 0x10 /* Terminal data */ 39 35 40 - #define MSG_SIZE(s) ((s) + offsetof(struct iucv_tty_msg, data)) 41 36 struct iucv_tty_msg { 42 37 u8 version; /* Message version */ 43 38 u8 type; /* Message type */ 44 - #define MSG_MAX_DATALEN (~(u16)0) 39 + #define MSG_MAX_DATALEN ((u16)(~0)) 45 40 u16 datalen; /* Payload length */ 46 41 u8 data[]; /* Payload buffer */ 47 42 } __attribute__((packed)); 43 + #define MSG_SIZE(s) ((s) + offsetof(struct iucv_tty_msg, data)) 48 44 49 45 enum iucv_state_t { 50 46 IUCV_DISCONN = 0, ··· 58 54 }; 59 55 60 56 struct hvc_iucv_private { 61 - struct hvc_struct *hvc; /* HVC console struct reference */ 57 + struct hvc_struct *hvc; /* HVC struct reference */ 62 58 u8 srv_name[8]; /* IUCV service name (ebcdic) */ 59 + unsigned char is_console; /* Linux console usage flag */ 63 60 enum iucv_state_t iucv_state; /* IUCV connection status */ 64 61 enum tty_state_t tty_state; /* TTY status */ 65 62 struct iucv_path *path; /* IUCV path pointer */ 66 63 spinlock_t lock; /* hvc_iucv_private lock */ 64 + #define SNDBUF_SIZE (PAGE_SIZE) /* must be < MSG_MAX_DATALEN */ 65 + void *sndbuf; /* send buffer */ 66 + size_t sndbuf_len; /* length of send buffer */ 67 + #define QUEUE_SNDBUF_DELAY (HZ / 25) 68 + struct delayed_work sndbuf_work; /* work: send iucv msg(s) */ 69 + wait_queue_head_t sndbuf_waitq; /* wait for send completion */ 67 70 struct list_head tty_outqueue; /* outgoing IUCV messages */ 68 71 struct list_head tty_inqueue; /* incoming IUCV messages */ 69 72 }; 70 73 71 74 struct iucv_tty_buffer { 72 75 struct list_head list; /* list pointer */ 73 - struct iucv_message msg; /* store an incoming IUCV message */ 76 + struct iucv_message msg; /* store an IUCV message */ 74 77 size_t offset; /* data buffer offset */ 75 78 struct iucv_tty_msg *mbuf; /* buffer to store input/output data */ 76 79 }; ··· 89 78 static void hvc_iucv_msg_complete(struct iucv_path *, struct iucv_message *); 90 79 91 80 92 - /* Kernel module parameters */ 93 - static unsigned long hvc_iucv_devices; 81 + /* Kernel module parameter: use one terminal device as default */ 82 + static unsigned long hvc_iucv_devices = 1; 94 83 95 84 /* Array of allocated hvc iucv tty lines... */ 96 85 static struct hvc_iucv_private *hvc_iucv_table[MAX_HVC_IUCV_LINES]; 86 + #define IUCV_HVC_CON_IDX (0) 97 87 98 88 /* Kmem cache and mempool for iucv_tty_buffer elements */ 99 89 static struct kmem_cache *hvc_iucv_buffer_cache; ··· 124 112 } 125 113 126 114 /** 127 - * alloc_tty_buffer() - Returns a new struct iucv_tty_buffer element. 115 + * alloc_tty_buffer() - Return a new struct iucv_tty_buffer element. 128 116 * @size: Size of the internal buffer used to store data. 129 117 * @flags: Memory allocation flags passed to mempool. 130 118 * ··· 132 120 * allocates an internal data buffer with the specified size @size. 133 121 * Note: The total message size arises from the internal buffer size and the 134 122 * members of the iucv_tty_msg structure. 135 - * 136 123 * The function returns NULL if memory allocation has failed. 137 124 */ 138 125 static struct iucv_tty_buffer *alloc_tty_buffer(size_t size, gfp_t flags) ··· 141 130 bufp = mempool_alloc(hvc_iucv_mempool, flags); 142 131 if (!bufp) 143 132 return NULL; 144 - memset(bufp, 0, sizeof(struct iucv_tty_buffer)); 133 + memset(bufp, 0, sizeof(*bufp)); 145 134 146 135 if (size > 0) { 147 136 bufp->msg.length = MSG_SIZE(size); ··· 160 149 /** 161 150 * destroy_tty_buffer() - destroy struct iucv_tty_buffer element. 162 151 * @bufp: Pointer to a struct iucv_tty_buffer element, SHALL NOT be NULL. 163 - * 164 - * The destroy_tty_buffer() function frees the internal data buffer and returns 165 - * the struct iucv_tty_buffer element back to the mempool for freeing. 166 152 */ 167 153 static void destroy_tty_buffer(struct iucv_tty_buffer *bufp) 168 154 { ··· 169 161 170 162 /** 171 163 * destroy_tty_buffer_list() - call destroy_tty_buffer() for each list element. 172 - * @list: List head pointer to a list containing struct iucv_tty_buffer 173 - * elements. 174 - * 175 - * Calls destroy_tty_buffer() for each struct iucv_tty_buffer element in the 176 - * list @list. 164 + * @list: List containing struct iucv_tty_buffer elements. 177 165 */ 178 166 static void destroy_tty_buffer_list(struct list_head *list) 179 167 { ··· 182 178 } 183 179 184 180 /** 185 - * hvc_iucv_write() - Receive IUCV message write data to HVC console buffer. 186 - * @priv: Pointer to hvc_iucv_private structure. 187 - * @buf: HVC console buffer for writing received terminal data. 188 - * @count: HVC console buffer size. 181 + * hvc_iucv_write() - Receive IUCV message & write data to HVC buffer. 182 + * @priv: Pointer to struct hvc_iucv_private 183 + * @buf: HVC buffer for writing received terminal data. 184 + * @count: HVC buffer size. 189 185 * @has_more_data: Pointer to an int variable. 190 186 * 191 187 * The function picks up pending messages from the input queue and receives 192 188 * the message data that is then written to the specified buffer @buf. 193 - * If the buffer size @count is less than the data message size, then the 189 + * If the buffer size @count is less than the data message size, the 194 190 * message is kept on the input queue and @has_more_data is set to 1. 195 - * If the message data has been entirely written, the message is removed from 191 + * If all message data has been written, the message is removed from 196 192 * the input queue. 197 193 * 198 194 * The function returns the number of bytes written to the terminal, zero if 199 195 * there are no pending data messages available or if there is no established 200 196 * IUCV path. 201 197 * If the IUCV path has been severed, then -EPIPE is returned to cause a 202 - * hang up (that is issued by the HVC console layer). 198 + * hang up (that is issued by the HVC layer). 203 199 */ 204 200 static int hvc_iucv_write(struct hvc_iucv_private *priv, 205 201 char *buf, int count, int *has_more_data) ··· 208 204 int written; 209 205 int rc; 210 206 211 - /* Immediately return if there is no IUCV connection */ 207 + /* immediately return if there is no IUCV connection */ 212 208 if (priv->iucv_state == IUCV_DISCONN) 213 209 return 0; 214 210 215 - /* If the IUCV path has been severed, return -EPIPE to inform the 216 - * hvc console layer to hang up the tty device. */ 211 + /* if the IUCV path has been severed, return -EPIPE to inform the 212 + * HVC layer to hang up the tty device. */ 217 213 if (priv->iucv_state == IUCV_SEVERED) 218 214 return -EPIPE; 219 215 ··· 221 217 if (list_empty(&priv->tty_inqueue)) 222 218 return 0; 223 219 224 - /* receive a iucv message and flip data to the tty (ldisc) */ 220 + /* receive an iucv message and flip data to the tty (ldisc) */ 225 221 rb = list_first_entry(&priv->tty_inqueue, struct iucv_tty_buffer, list); 226 222 227 223 written = 0; ··· 264 260 case MSG_TYPE_WINSIZE: 265 261 if (rb->mbuf->datalen != sizeof(struct winsize)) 266 262 break; 267 - hvc_resize(priv->hvc, *((struct winsize *)rb->mbuf->data)); 263 + hvc_resize(priv->hvc, *((struct winsize *) rb->mbuf->data)); 268 264 break; 269 265 270 266 case MSG_TYPE_ERROR: /* ignored ... */ ··· 288 284 * @buf: Pointer to a buffer to store data 289 285 * @count: Size of buffer available for writing 290 286 * 291 - * The hvc_console thread calls this method to read characters from 292 - * the terminal backend. If an IUCV communication path has been established, 293 - * pending IUCV messages are received and data is copied into buffer @buf 294 - * up to @count bytes. 287 + * The HVC thread calls this method to read characters from the back-end. 288 + * If an IUCV communication path has been established, pending IUCV messages 289 + * are received and data is copied into buffer @buf up to @count bytes. 295 290 * 296 291 * Locking: The routine gets called under an irqsave() spinlock; and 297 292 * the routine locks the struct hvc_iucv_private->lock to call ··· 321 318 } 322 319 323 320 /** 324 - * hvc_iucv_send() - Send an IUCV message containing terminal data. 321 + * hvc_iucv_queue() - Buffer terminal data for sending. 325 322 * @priv: Pointer to struct hvc_iucv_private instance. 326 323 * @buf: Buffer containing data to send. 327 - * @size: Size of buffer and amount of data to send. 324 + * @count: Size of buffer and amount of data to send. 328 325 * 329 - * If an IUCV communication path is established, the function copies the buffer 330 - * data to a newly allocated struct iucv_tty_buffer element, sends the data and 331 - * puts the element to the outqueue. 326 + * The function queues data for sending. To actually send the buffered data, 327 + * a work queue function is scheduled (with QUEUE_SNDBUF_DELAY). 328 + * The function returns the number of data bytes that has been buffered. 332 329 * 333 - * If there is no IUCV communication path established, the function returns 0. 334 - * If an existing IUCV communicaton path has been severed, the function returns 335 - * -EPIPE (can be passed to HVC layer to cause a tty hangup). 330 + * If the device is not connected, data is ignored and the function returns 331 + * @count. 332 + * If the buffer is full, the function returns 0. 333 + * If an existing IUCV communicaton path has been severed, -EPIPE is returned 334 + * (that can be passed to HVC layer to cause a tty hangup). 336 335 */ 337 - static int hvc_iucv_send(struct hvc_iucv_private *priv, const char *buf, 338 - int count) 336 + static int hvc_iucv_queue(struct hvc_iucv_private *priv, const char *buf, 337 + int count) 338 + { 339 + size_t len; 340 + 341 + if (priv->iucv_state == IUCV_DISCONN) 342 + return count; /* ignore data */ 343 + 344 + if (priv->iucv_state == IUCV_SEVERED) 345 + return -EPIPE; 346 + 347 + len = min_t(size_t, count, SNDBUF_SIZE - priv->sndbuf_len); 348 + if (!len) 349 + return 0; 350 + 351 + memcpy(priv->sndbuf + priv->sndbuf_len, buf, len); 352 + priv->sndbuf_len += len; 353 + 354 + if (priv->iucv_state == IUCV_CONNECTED) 355 + schedule_delayed_work(&priv->sndbuf_work, QUEUE_SNDBUF_DELAY); 356 + 357 + return len; 358 + } 359 + 360 + /** 361 + * hvc_iucv_send() - Send an IUCV message containing terminal data. 362 + * @priv: Pointer to struct hvc_iucv_private instance. 363 + * 364 + * If an IUCV communication path has been established, the buffered output data 365 + * is sent via an IUCV message and the number of bytes sent is returned. 366 + * Returns 0 if there is no established IUCV communication path or 367 + * -EPIPE if an existing IUCV communicaton path has been severed. 368 + */ 369 + static int hvc_iucv_send(struct hvc_iucv_private *priv) 339 370 { 340 371 struct iucv_tty_buffer *sb; 341 - int rc; 342 - u16 len; 372 + int rc, len; 343 373 344 374 if (priv->iucv_state == IUCV_SEVERED) 345 375 return -EPIPE; 346 376 347 377 if (priv->iucv_state == IUCV_DISCONN) 348 - return 0; 378 + return -EIO; 349 379 350 - len = min_t(u16, MSG_MAX_DATALEN, count); 380 + if (!priv->sndbuf_len) 381 + return 0; 351 382 352 383 /* allocate internal buffer to store msg data and also compute total 353 384 * message length */ 354 - sb = alloc_tty_buffer(len, GFP_ATOMIC); 385 + sb = alloc_tty_buffer(priv->sndbuf_len, GFP_ATOMIC); 355 386 if (!sb) 356 387 return -ENOMEM; 357 388 358 - sb->mbuf->datalen = len; 359 - memcpy(sb->mbuf->data, buf, len); 389 + memcpy(sb->mbuf->data, priv->sndbuf, priv->sndbuf_len); 390 + sb->mbuf->datalen = (u16) priv->sndbuf_len; 391 + sb->msg.length = MSG_SIZE(sb->mbuf->datalen); 360 392 361 393 list_add_tail(&sb->list, &priv->tty_outqueue); 362 394 363 395 rc = __iucv_message_send(priv->path, &sb->msg, 0, 0, 364 396 (void *) sb->mbuf, sb->msg.length); 365 397 if (rc) { 398 + /* drop the message here; however we might want to handle 399 + * 0x03 (msg limit reached) by trying again... */ 366 400 list_del(&sb->list); 367 401 destroy_tty_buffer(sb); 368 - len = 0; 369 402 } 403 + len = priv->sndbuf_len; 404 + priv->sndbuf_len = 0; 370 405 371 406 return len; 407 + } 408 + 409 + /** 410 + * hvc_iucv_sndbuf_work() - Send buffered data over IUCV 411 + * @work: Work structure. 412 + * 413 + * This work queue function sends buffered output data over IUCV and, 414 + * if not all buffered data could be sent, reschedules itself. 415 + */ 416 + static void hvc_iucv_sndbuf_work(struct work_struct *work) 417 + { 418 + struct hvc_iucv_private *priv; 419 + 420 + priv = container_of(work, struct hvc_iucv_private, sndbuf_work.work); 421 + if (!priv) 422 + return; 423 + 424 + spin_lock_bh(&priv->lock); 425 + hvc_iucv_send(priv); 426 + spin_unlock_bh(&priv->lock); 372 427 } 373 428 374 429 /** ··· 435 374 * @buf: Pointer to an buffer to read data from 436 375 * @count: Size of buffer available for reading 437 376 * 438 - * The hvc_console thread calls this method to write characters from 439 - * to the terminal backend. 440 - * The function calls hvc_iucv_send() under the lock of the 441 - * struct hvc_iucv_private instance that corresponds to the tty @vtermno. 377 + * The HVC thread calls this method to write characters to the back-end. 378 + * The function calls hvc_iucv_queue() to queue terminal data for sending. 442 379 * 443 380 * Locking: The method gets called under an irqsave() spinlock; and 444 381 * locks struct hvc_iucv_private->lock. ··· 444 385 static int hvc_iucv_put_chars(uint32_t vtermno, const char *buf, int count) 445 386 { 446 387 struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno); 447 - int sent; 388 + int queued; 448 389 449 390 if (count <= 0) 450 391 return 0; ··· 453 394 return -ENODEV; 454 395 455 396 spin_lock(&priv->lock); 456 - sent = hvc_iucv_send(priv, buf, count); 397 + queued = hvc_iucv_queue(priv, buf, count); 457 398 spin_unlock(&priv->lock); 458 399 459 - return sent; 400 + return queued; 460 401 } 461 402 462 403 /** ··· 465 406 * @id: Additional data (originally passed to hvc_alloc): the index of an struct 466 407 * hvc_iucv_private instance. 467 408 * 468 - * The function sets the tty state to TTY_OPEN for the struct hvc_iucv_private 409 + * The function sets the tty state to TTY_OPENED for the struct hvc_iucv_private 469 410 * instance that is derived from @id. Always returns 0. 470 411 * 471 412 * Locking: struct hvc_iucv_private->lock, spin_lock_bh ··· 486 427 } 487 428 488 429 /** 489 - * hvc_iucv_cleanup() - Clean up function if the tty portion is finally closed. 430 + * hvc_iucv_cleanup() - Clean up and reset a z/VM IUCV HVC instance. 490 431 * @priv: Pointer to the struct hvc_iucv_private instance. 491 - * 492 - * The functions severs the established IUCV communication path (if any), and 493 - * destroy struct iucv_tty_buffer elements from the in- and outqueue. Finally, 494 - * the functions resets the states to TTY_CLOSED and IUCV_DISCONN. 495 432 */ 496 433 static void hvc_iucv_cleanup(struct hvc_iucv_private *priv) 497 434 { ··· 496 441 497 442 priv->tty_state = TTY_CLOSED; 498 443 priv->iucv_state = IUCV_DISCONN; 444 + 445 + priv->sndbuf_len = 0; 499 446 } 500 447 501 448 /** 502 - * hvc_iucv_notifier_hangup() - HVC notifier for tty hangups. 503 - * @hp: Pointer to the HVC device (struct hvc_struct) 504 - * @id: Additional data (originally passed to hvc_alloc): the index of an struct 505 - * hvc_iucv_private instance. 449 + * tty_outqueue_empty() - Test if the tty outq is empty 450 + * @priv: Pointer to struct hvc_iucv_private instance. 451 + */ 452 + static inline int tty_outqueue_empty(struct hvc_iucv_private *priv) 453 + { 454 + int rc; 455 + 456 + spin_lock_bh(&priv->lock); 457 + rc = list_empty(&priv->tty_outqueue); 458 + spin_unlock_bh(&priv->lock); 459 + 460 + return rc; 461 + } 462 + 463 + /** 464 + * flush_sndbuf_sync() - Flush send buffer and wait for completion 465 + * @priv: Pointer to struct hvc_iucv_private instance. 506 466 * 507 - * This routine notifies the HVC backend that a tty hangup (carrier loss, 467 + * The routine cancels a pending sndbuf work, calls hvc_iucv_send() 468 + * to flush any buffered terminal output data and waits for completion. 469 + */ 470 + static void flush_sndbuf_sync(struct hvc_iucv_private *priv) 471 + { 472 + int sync_wait; 473 + 474 + cancel_delayed_work_sync(&priv->sndbuf_work); 475 + 476 + spin_lock_bh(&priv->lock); 477 + hvc_iucv_send(priv); /* force sending buffered data */ 478 + sync_wait = !list_empty(&priv->tty_outqueue); /* anything queued ? */ 479 + spin_unlock_bh(&priv->lock); 480 + 481 + if (sync_wait) 482 + wait_event_timeout(priv->sndbuf_waitq, 483 + tty_outqueue_empty(priv), HZ); 484 + } 485 + 486 + /** 487 + * hvc_iucv_notifier_hangup() - HVC notifier for TTY hangups. 488 + * @hp: Pointer to the HVC device (struct hvc_struct) 489 + * @id: Additional data (originally passed to hvc_alloc): 490 + * the index of an struct hvc_iucv_private instance. 491 + * 492 + * This routine notifies the HVC back-end that a tty hangup (carrier loss, 508 493 * virtual or otherwise) has occured. 509 - * 510 - * The HVC backend for z/VM IUCV ignores virtual hangups (vhangup()), to keep 511 - * an existing IUCV communication path established. 494 + * The z/VM IUCV HVC device driver ignores virtual hangups (vhangup()) 495 + * to keep an existing IUCV communication path established. 512 496 * (Background: vhangup() is called from user space (by getty or login) to 513 497 * disable writing to the tty by other applications). 514 - * 515 - * If the tty has been opened (e.g. getty) and an established IUCV path has been 516 - * severed (we caused the tty hangup in that case), then the functions invokes 517 - * hvc_iucv_cleanup() to clean up. 498 + * If the tty has been opened and an established IUCV path has been severed 499 + * (we caused the tty hangup), the function calls hvc_iucv_cleanup(). 518 500 * 519 501 * Locking: struct hvc_iucv_private->lock 520 502 */ ··· 563 471 if (!priv) 564 472 return; 565 473 474 + flush_sndbuf_sync(priv); 475 + 566 476 spin_lock_bh(&priv->lock); 567 477 /* NOTE: If the hangup was scheduled by ourself (from the iucv 568 - * path_servered callback [IUCV_SEVERED]), then we have to 569 - * finally clean up the tty backend structure and set state to 570 - * TTY_CLOSED. 571 - * 478 + * path_servered callback [IUCV_SEVERED]), we have to clean up 479 + * our structure and to set state to TTY_CLOSED. 572 480 * If the tty was hung up otherwise (e.g. vhangup()), then we 573 481 * ignore this hangup and keep an established IUCV path open... 574 482 * (...the reason is that we are not able to connect back to the ··· 586 494 * @id: Additional data (originally passed to hvc_alloc): 587 495 * the index of an struct hvc_iucv_private instance. 588 496 * 589 - * This routine notifies the HVC backend that the last tty device file 590 - * descriptor has been closed. 591 - * The function calls hvc_iucv_cleanup() to clean up the struct hvc_iucv_private 592 - * instance. 497 + * This routine notifies the HVC back-end that the last tty device fd has been 498 + * closed. The function calls hvc_iucv_cleanup() to clean up the struct 499 + * hvc_iucv_private instance. 593 500 * 594 501 * Locking: struct hvc_iucv_private->lock 595 502 */ ··· 600 509 priv = hvc_iucv_get_private(id); 601 510 if (!priv) 602 511 return; 512 + 513 + flush_sndbuf_sync(priv); 603 514 604 515 spin_lock_bh(&priv->lock); 605 516 path = priv->path; /* save reference to IUCV path */ ··· 620 527 /** 621 528 * hvc_iucv_path_pending() - IUCV handler to process a connection request. 622 529 * @path: Pending path (struct iucv_path) 623 - * @ipvmid: Originator z/VM system identifier 530 + * @ipvmid: z/VM system identifier of originator 624 531 * @ipuser: User specified data for this path 625 532 * (AF_IUCV: port/service name and originator port) 626 533 * 627 - * The function uses the @ipuser data to check to determine if the pending 628 - * path belongs to a terminal managed by this HVC backend. 629 - * If the check is successful, then an additional check is done to ensure 630 - * that a terminal cannot be accessed multiple times (only one connection 631 - * to a terminal is allowed). In that particular case, the pending path is 632 - * severed. If it is the first connection, the pending path is accepted and 633 - * associated to the struct hvc_iucv_private. The iucv state is updated to 634 - * reflect that a communication path has been established. 534 + * The function uses the @ipuser data to determine if the pending path belongs 535 + * to a terminal managed by this device driver. 536 + * If the path belongs to this driver, ensure that the terminal is not accessed 537 + * multiple times (only one connection to a terminal is allowed). 538 + * If the terminal is not yet connected, the pending path is accepted and is 539 + * associated to the appropriate struct hvc_iucv_private instance. 635 540 * 636 - * Returns 0 if the path belongs to a terminal managed by the this HVC backend; 541 + * Returns 0 if @path belongs to a terminal managed by the this device driver; 637 542 * otherwise returns -ENODEV in order to dispatch this path to other handlers. 638 543 * 639 544 * Locking: struct hvc_iucv_private->lock ··· 650 559 priv = hvc_iucv_table[i]; 651 560 break; 652 561 } 653 - 654 562 if (!priv) 655 563 return -ENODEV; 656 564 ··· 678 588 priv->path = path; 679 589 priv->iucv_state = IUCV_CONNECTED; 680 590 591 + /* flush buffered output data... */ 592 + schedule_delayed_work(&priv->sndbuf_work, 5); 593 + 681 594 out_path_handled: 682 595 spin_unlock(&priv->lock); 683 596 return 0; ··· 696 603 * sets the iucv state to IUCV_SEVERED for the associated struct 697 604 * hvc_iucv_private instance. Later, the IUCV_SEVERED state triggers a tty 698 605 * hangup (hvc_iucv_get_chars() / hvc_iucv_write()). 699 - * 700 - * If tty portion of the HVC is closed then clean up the outqueue in addition. 606 + * If tty portion of the HVC is closed, clean up the outqueue. 701 607 * 702 608 * Locking: struct hvc_iucv_private->lock 703 609 */ ··· 707 615 spin_lock(&priv->lock); 708 616 priv->iucv_state = IUCV_SEVERED; 709 617 710 - /* NOTE: If the tty has not yet been opened by a getty program 711 - * (e.g. to see console messages), then cleanup the 712 - * hvc_iucv_private structure to allow re-connects. 618 + /* If the tty has not yet been opened, clean up the hvc_iucv_private 619 + * structure to allow re-connects. 620 + * This is also done for our console device because console hangups 621 + * are handled specially and no notifier is called by HVC. 622 + * The tty session is active (TTY_OPEN) and ready for re-connects... 713 623 * 714 - * If the tty has been opened, the get_chars() callback returns 715 - * -EPIPE to signal the hvc console layer to hang up the tty. */ 624 + * If it has been opened, let get_chars() return -EPIPE to signal the 625 + * HVC layer to hang up the tty. 626 + * If so, we need to wake up the HVC thread to call get_chars()... 627 + */ 716 628 priv->path = NULL; 717 629 if (priv->tty_state == TTY_CLOSED) 718 630 hvc_iucv_cleanup(priv); 631 + else 632 + if (priv->is_console) { 633 + hvc_iucv_cleanup(priv); 634 + priv->tty_state = TTY_OPENED; 635 + } else 636 + hvc_kick(); 719 637 spin_unlock(&priv->lock); 720 638 721 639 /* finally sever path (outside of priv->lock due to lock ordering) */ ··· 738 636 * @path: Pending path (struct iucv_path) 739 637 * @msg: Pointer to the IUCV message 740 638 * 741 - * The function stores an incoming message on the input queue for later 639 + * The function puts an incoming message on the input queue for later 742 640 * processing (by hvc_iucv_get_chars() / hvc_iucv_write()). 743 - * However, if the tty has not yet been opened, the message is rejected. 641 + * If the tty has not yet been opened, the message is rejected. 744 642 * 745 643 * Locking: struct hvc_iucv_private->lock 746 644 */ ··· 750 648 struct hvc_iucv_private *priv = path->private; 751 649 struct iucv_tty_buffer *rb; 752 650 651 + /* reject messages that exceed max size of iucv_tty_msg->datalen */ 652 + if (msg->length > MSG_SIZE(MSG_MAX_DATALEN)) { 653 + iucv_message_reject(path, msg); 654 + return; 655 + } 656 + 753 657 spin_lock(&priv->lock); 754 658 755 659 /* reject messages if tty has not yet been opened */ ··· 764 656 goto unlock_return; 765 657 } 766 658 767 - /* allocate buffer an empty buffer element */ 659 + /* allocate tty buffer to save iucv msg only */ 768 660 rb = alloc_tty_buffer(0, GFP_ATOMIC); 769 661 if (!rb) { 770 662 iucv_message_reject(path, msg); ··· 774 666 775 667 list_add_tail(&rb->list, &priv->tty_inqueue); 776 668 777 - hvc_kick(); /* wakup hvc console thread */ 669 + hvc_kick(); /* wake up hvc thread */ 778 670 779 671 unlock_return: 780 672 spin_unlock(&priv->lock); ··· 785 677 * @path: Pending path (struct iucv_path) 786 678 * @msg: Pointer to the IUCV message 787 679 * 788 - * The function is called upon completion of message delivery and the 789 - * message is removed from the outqueue. Additional delivery information 790 - * can be found in msg->audit: rejected messages (0x040000 (IPADRJCT)) and 791 - * purged messages (0x010000 (IPADPGNR)). 680 + * The function is called upon completion of message delivery to remove the 681 + * message from the outqueue. Additional delivery information can be found 682 + * msg->audit: rejected messages (0x040000 (IPADRJCT)), and 683 + * purged messages (0x010000 (IPADPGNR)). 792 684 * 793 685 * Locking: struct hvc_iucv_private->lock 794 686 */ ··· 805 697 list_move(&ent->list, &list_remove); 806 698 break; 807 699 } 700 + wake_up(&priv->sndbuf_waitq); 808 701 spin_unlock(&priv->lock); 809 702 destroy_tty_buffer_list(&list_remove); 810 703 } ··· 822 713 823 714 /** 824 715 * hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance 825 - * @id: hvc_iucv_table index 716 + * @id: hvc_iucv_table index 717 + * @is_console: Flag if the instance is used as Linux console 826 718 * 827 - * This function allocates a new hvc_iucv_private struct and put the 828 - * instance into hvc_iucv_table at index @id. 719 + * This function allocates a new hvc_iucv_private structure and stores 720 + * the instance in hvc_iucv_table at index @id. 829 721 * Returns 0 on success; otherwise non-zero. 830 722 */ 831 - static int __init hvc_iucv_alloc(int id) 723 + static int __init hvc_iucv_alloc(int id, unsigned int is_console) 832 724 { 833 725 struct hvc_iucv_private *priv; 834 726 char name[9]; ··· 842 732 spin_lock_init(&priv->lock); 843 733 INIT_LIST_HEAD(&priv->tty_outqueue); 844 734 INIT_LIST_HEAD(&priv->tty_inqueue); 735 + INIT_DELAYED_WORK(&priv->sndbuf_work, hvc_iucv_sndbuf_work); 736 + init_waitqueue_head(&priv->sndbuf_waitq); 845 737 846 - /* Finally allocate hvc */ 847 - priv->hvc = hvc_alloc(HVC_IUCV_MAGIC + id, 848 - HVC_IUCV_MAGIC + id, &hvc_iucv_ops, PAGE_SIZE); 738 + priv->sndbuf = (void *) get_zeroed_page(GFP_KERNEL); 739 + if (!priv->sndbuf) { 740 + kfree(priv); 741 + return -ENOMEM; 742 + } 743 + 744 + /* set console flag */ 745 + priv->is_console = is_console; 746 + 747 + /* finally allocate hvc */ 748 + priv->hvc = hvc_alloc(HVC_IUCV_MAGIC + id, /* PAGE_SIZE */ 749 + HVC_IUCV_MAGIC + id, &hvc_iucv_ops, 256); 849 750 if (IS_ERR(priv->hvc)) { 850 751 rc = PTR_ERR(priv->hvc); 752 + free_page((unsigned long) priv->sndbuf); 851 753 kfree(priv); 852 754 return rc; 853 755 } 854 756 757 + /* notify HVC thread instead of using polling */ 758 + priv->hvc->irq_requested = 1; 759 + 855 760 /* setup iucv related information */ 856 - snprintf(name, 9, "ihvc%-4d", id); 761 + snprintf(name, 9, "lnxhvc%-2d", id); 857 762 memcpy(priv->srv_name, name, 8); 858 763 ASCEBC(priv->srv_name, 8); 859 764 ··· 877 752 } 878 753 879 754 /** 880 - * hvc_iucv_init() - Initialization of HVC backend for z/VM IUCV 755 + * hvc_iucv_init() - z/VM IUCV HVC device driver initialization 881 756 */ 882 757 static int __init hvc_iucv_init(void) 883 758 { 884 - int rc, i; 759 + int rc; 760 + unsigned int i; 885 761 886 762 if (!MACHINE_IS_VM) { 887 - pr_warning("The z/VM IUCV Hypervisor console cannot be " 888 - "used without z/VM.\n"); 763 + pr_info("The z/VM IUCV HVC device driver cannot " 764 + "be used without z/VM\n"); 889 765 return -ENODEV; 890 766 } 891 767 ··· 900 774 sizeof(struct iucv_tty_buffer), 901 775 0, 0, NULL); 902 776 if (!hvc_iucv_buffer_cache) { 903 - pr_err("Not enough memory for driver initialization " 904 - "(rs=%d).\n", 1); 777 + pr_err("Allocating memory failed with reason code=%d\n", 1); 905 778 return -ENOMEM; 906 779 } 907 780 908 781 hvc_iucv_mempool = mempool_create_slab_pool(MEMPOOL_MIN_NR, 909 782 hvc_iucv_buffer_cache); 910 783 if (!hvc_iucv_mempool) { 911 - pr_err("Not enough memory for driver initialization " 912 - "(rs=%d).\n", 2); 784 + pr_err("Allocating memory failed with reason code=%d\n", 2); 913 785 kmem_cache_destroy(hvc_iucv_buffer_cache); 914 786 return -ENOMEM; 915 787 } 916 788 789 + /* register the first terminal device as console 790 + * (must be done before allocating hvc terminal devices) */ 791 + rc = hvc_instantiate(HVC_IUCV_MAGIC, IUCV_HVC_CON_IDX, &hvc_iucv_ops); 792 + if (rc) { 793 + pr_err("Registering HVC terminal device as " 794 + "Linux console failed\n"); 795 + goto out_error_memory; 796 + } 797 + 917 798 /* allocate hvc_iucv_private structs */ 918 799 for (i = 0; i < hvc_iucv_devices; i++) { 919 - rc = hvc_iucv_alloc(i); 800 + rc = hvc_iucv_alloc(i, (i == IUCV_HVC_CON_IDX) ? 1 : 0); 920 801 if (rc) { 921 - pr_err("Could not create new z/VM IUCV HVC backend " 922 - "rc=%d.\n", rc); 802 + pr_err("Creating a new HVC terminal device " 803 + "failed with error code=%d\n", rc); 923 804 goto out_error_hvc; 924 805 } 925 806 } ··· 934 801 /* register IUCV callback handler */ 935 802 rc = iucv_register(&hvc_iucv_handler, 0); 936 803 if (rc) { 937 - pr_err("Could not register iucv handler (rc=%d).\n", rc); 804 + pr_err("Registering IUCV handlers failed with error code=%d\n", 805 + rc); 938 806 goto out_error_iucv; 939 807 } 940 808 ··· 950 816 hvc_remove(hvc_iucv_table[i]->hvc); 951 817 kfree(hvc_iucv_table[i]); 952 818 } 819 + out_error_memory: 953 820 mempool_destroy(hvc_iucv_mempool); 954 821 kmem_cache_destroy(hvc_iucv_buffer_cache); 955 822 return rc; 956 - } 957 - 958 - /** 959 - * hvc_iucv_console_init() - Early console initialization 960 - */ 961 - static int __init hvc_iucv_console_init(void) 962 - { 963 - if (!MACHINE_IS_VM || !hvc_iucv_devices) 964 - return -ENODEV; 965 - return hvc_instantiate(HVC_IUCV_MAGIC, 0, &hvc_iucv_ops); 966 823 } 967 824 968 825 /** ··· 966 841 } 967 842 968 843 969 - module_init(hvc_iucv_init); 970 - console_initcall(hvc_iucv_console_init); 844 + device_initcall(hvc_iucv_init); 971 845 __setup("hvc_iucv=", hvc_iucv_config); 972 - 973 - MODULE_LICENSE("GPL"); 974 - MODULE_DESCRIPTION("HVC back-end for z/VM IUCV."); 975 - MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>");
+20 -1
drivers/s390/block/dasd.c
··· 336 336 dasd_state_ready_to_online(struct dasd_device * device) 337 337 { 338 338 int rc; 339 + struct gendisk *disk; 340 + struct disk_part_iter piter; 341 + struct hd_struct *part; 339 342 340 343 if (device->discipline->ready_to_online) { 341 344 rc = device->discipline->ready_to_online(device); ··· 346 343 return rc; 347 344 } 348 345 device->state = DASD_STATE_ONLINE; 349 - if (device->block) 346 + if (device->block) { 350 347 dasd_schedule_block_bh(device->block); 348 + disk = device->block->bdev->bd_disk; 349 + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); 350 + while ((part = disk_part_iter_next(&piter))) 351 + kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); 352 + disk_part_iter_exit(&piter); 353 + } 351 354 return 0; 352 355 } 353 356 ··· 363 354 static int dasd_state_online_to_ready(struct dasd_device *device) 364 355 { 365 356 int rc; 357 + struct gendisk *disk; 358 + struct disk_part_iter piter; 359 + struct hd_struct *part; 366 360 367 361 if (device->discipline->online_to_ready) { 368 362 rc = device->discipline->online_to_ready(device); ··· 373 361 return rc; 374 362 } 375 363 device->state = DASD_STATE_READY; 364 + if (device->block) { 365 + disk = device->block->bdev->bd_disk; 366 + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); 367 + while ((part = disk_part_iter_next(&piter))) 368 + kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); 369 + disk_part_iter_exit(&piter); 370 + } 376 371 return 0; 377 372 } 378 373
+48
drivers/s390/block/dasd_devmap.c
··· 206 206 features |= DASD_FEATURE_USEDIAG; 207 207 else if (len == 6 && !strncmp(str, "erplog", 6)) 208 208 features |= DASD_FEATURE_ERPLOG; 209 + else if (len == 8 && !strncmp(str, "failfast", 8)) 210 + features |= DASD_FEATURE_FAILFAST; 209 211 else { 210 212 MESSAGE(KERN_WARNING, 211 213 "unsupported feature: %*s, " ··· 669 667 */ 670 668 671 669 /* 670 + * failfast controls the behaviour, if no path is available 671 + */ 672 + static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, 673 + char *buf) 674 + { 675 + struct dasd_devmap *devmap; 676 + int ff_flag; 677 + 678 + devmap = dasd_find_busid(dev->bus_id); 679 + if (!IS_ERR(devmap)) 680 + ff_flag = (devmap->features & DASD_FEATURE_FAILFAST) != 0; 681 + else 682 + ff_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_FAILFAST) != 0; 683 + return snprintf(buf, PAGE_SIZE, ff_flag ? "1\n" : "0\n"); 684 + } 685 + 686 + static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, 687 + const char *buf, size_t count) 688 + { 689 + struct dasd_devmap *devmap; 690 + int val; 691 + char *endp; 692 + 693 + devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); 694 + if (IS_ERR(devmap)) 695 + return PTR_ERR(devmap); 696 + 697 + val = simple_strtoul(buf, &endp, 0); 698 + if (((endp + 1) < (buf + count)) || (val > 1)) 699 + return -EINVAL; 700 + 701 + spin_lock(&dasd_devmap_lock); 702 + if (val) 703 + devmap->features |= DASD_FEATURE_FAILFAST; 704 + else 705 + devmap->features &= ~DASD_FEATURE_FAILFAST; 706 + if (devmap->device) 707 + devmap->device->features = devmap->features; 708 + spin_unlock(&dasd_devmap_lock); 709 + return count; 710 + } 711 + 712 + static DEVICE_ATTR(failfast, 0644, dasd_ff_show, dasd_ff_store); 713 + 714 + /* 672 715 * readonly controls the readonly status of a dasd 673 716 */ 674 717 static ssize_t ··· 1067 1020 &dev_attr_use_diag.attr, 1068 1021 &dev_attr_eer_enabled.attr, 1069 1022 &dev_attr_erplog.attr, 1023 + &dev_attr_failfast.attr, 1070 1024 NULL, 1071 1025 }; 1072 1026
+2 -1
drivers/s390/block/dasd_diag.c
··· 544 544 } 545 545 cqr->retries = DIAG_MAX_RETRIES; 546 546 cqr->buildclk = get_clock(); 547 - if (blk_noretry_request(req)) 547 + if (blk_noretry_request(req) || 548 + block->base->features & DASD_FEATURE_FAILFAST) 548 549 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 549 550 cqr->startdev = memdev; 550 551 cqr->memdev = memdev;
+2 -1
drivers/s390/block/dasd_eckd.c
··· 1700 1700 recid++; 1701 1701 } 1702 1702 } 1703 - if (blk_noretry_request(req)) 1703 + if (blk_noretry_request(req) || 1704 + block->base->features & DASD_FEATURE_FAILFAST) 1704 1705 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 1705 1706 cqr->startdev = startdev; 1706 1707 cqr->memdev = startdev;
+2 -1
drivers/s390/block/dasd_fba.c
··· 355 355 recid++; 356 356 } 357 357 } 358 - if (blk_noretry_request(req)) 358 + if (blk_noretry_request(req) || 359 + block->base->features & DASD_FEATURE_FAILFAST) 359 360 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); 360 361 cqr->startdev = memdev; 361 362 cqr->memdev = memdev;
+1 -1
drivers/s390/char/Kconfig
··· 100 100 101 101 config S390_TAPE_BLOCK 102 102 bool "Support for tape block devices" 103 - depends on S390_TAPE 103 + depends on S390_TAPE && BLOCK 104 104 help 105 105 Select this option if you want to access your channel-attached tape 106 106 devices using the block device interface. This interface is similar
+2
drivers/s390/cio/qdio_debug.c
··· 169 169 q->nr); 170 170 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, 171 171 debugfs_root, q, &debugfs_fops); 172 + if (IS_ERR(debugfs_queues[i])) 173 + debugfs_queues[i] = NULL; 172 174 } 173 175 174 176 void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev)