s390 (2/5): common i/o layer.
Subsystems (6)
PATCH 1/1 s390 (2/5): common i/o layer.
Common i/o layer fixes:
- Remove documentation entry for non-existent cio_notoper_msg parameter.
- Add documentation for availability attritube.
- Replace function of the steal_lock attribute by "echo force" to the online attribute.
- Trigger device sensing in the online function for unknown devices.
- Always try to get devices online even if they are marked reserved. Someone could have released the device while it was offline.
- Add try_module_get/module_put pairs to the online function of ccw devices and ccwgroup devices.
- Add owner field to ccwgroup driver structure. Set owner field in ctc, lcs and qeth.
- Fix alignment problems in channel measurement block interface.
diffstat:
Documentation/s390/CommonIO | 9 -- Documentation/s390/driver-model.txt | 3 drivers/s390/block/dasd_eckd.c | 4 - drivers/s390/cio/ccwgroup.c | 16 +++- drivers/s390/cio/cmf.c | 34 ++++++--- drivers/s390/cio/css.h | 1 drivers/s390/cio/device.c | 124 ++++++++++++------------------------ drivers/s390/cio/device.h | 1 drivers/s390/cio/device_fsm.c | 36 +++------- drivers/s390/cio/device_ops.c | 4 + drivers/s390/net/ctcmain.c | 7 +- drivers/s390/net/lcs.c | 5 - drivers/s390/net/qeth.c | 1 include/asm-s390/ccwdev.h | 2 include/asm-s390/ccwgroup.h | 1 15 files changed, 112 insertions(+), 136 deletions(-)
Documentation/s390/CommonIO +0 -9
@@ -14,15 +14,6 @@ Default is off. -* cio_notoper_msg = yes | no - - Determines whether messages of the type "Device 0.0.4711 became 'not - operational'" should be shown during startup; after startup, they will always - be shown. - - Default is on. - - * cio_ignore = {all} | {<device> | <range of devices>} | {!<device> | !<range of devices>}
Documentation/s390/driver-model.txt +3 -0
@@ -31,6 +31,9 @@ devtype: The device type / model, if applicable. +availability: Can be 'good' or 'boxed'; 'no path' or 'no device' for + disconnected devices. + online: An interface to set the device online and offline. In the special case of the device being disconnected (see the notify function under 1.2), piping 0 to online will focibly delete
drivers/s390/block/dasd_eckd.c +2 -2
@@ -7,7 +7,7 @@* Bugreports.to..: <[email protected]> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * -* $Revision: 1.50 $ +* $Revision: 1.51 $ */ #include <linux/config.h>
@@ -85,7 +85,7 @@ ret =dasd_generic_probe (cdev, &dasd_eckd_discipline);if (ret)return ret; -ccw_device_set_options (cdev,CCWDEV_DO_PATHGROUP ); +ccw_device_set_options (cdev,CCWDEV_DO_PATHGROUP |CCWDEV_ALLOW_FORCE );return 0 ; }
drivers/s390/cio/ccwgroup.c +11 -5
@@ -1,7 +1,7 @@/* * drivers/s390/cio/ccwgroup.c * bus driver for ccwgroup -* $Revision: 1.23 $ +* $Revision: 1.24 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation
@@ -293,22 +293,28 @@ ccwgroup_online_store (struct device *dev, const char *buf, size_t count) { struct ccwgroup_device *gdev; +struct ccwgroup_driver *gdrv;unsigned int value; +int ret; gdev =to_ccwgroupdev (dev);if (!dev->driver)return count; - value =simple_strtoul (buf,0 ,0 ); + gdrv =to_ccwgroupdrv (gdev->dev.driver); +if (!try_module_get (gdrv->owner)) +return -EINVAL ; + value =simple_strtoul (buf,0 ,0 ); + ret = count;if (value ==1 )ccwgroup_set_online (gdev);else if (value ==0 )ccwgroup_set_offline (gdev);else -return -EINVAL ; - -return count; + ret = -EINVAL ; +module_put (gdrv->owner); +return ret; } static ssize_t
drivers/s390/cio/cmf.c +24 -10
@@ -1,5 +1,5 @@/* -* linux/drivers/s390/cio/cmf.c ($Revision: 1.11 $) +* linux/drivers/s390/cio/cmf.c ($Revision: 1.13 $) * * Linux on zSeries Channel Measurement Facility support *
@@ -138,7 +138,7 @@if (count ==0 )return 0 ; -/* value comes in units of 128 5sec */ +/* value comes in units of 128 µsec */ ret =time_to_nsec (value);do_div (ret, count);
@@ -390,12 +390,13 @@WARN_ON (!list_empty (&cmb_area.list));spin_unlock (&cmb_area.lock); - mem =kmalloc (size,GFP_KERNEL |GFP_DMA ); + mem = (void *)__get_free_pages (GFP_KERNEL |GFP_DMA , +get_order (size));spin_lock (&cmb_area.lock);if (cmb_area.mem) {/* ok, another thread was faster */ -kfree (mem); +free_pages ((unsigned long )mem,get_order (size)); }else if (!mem) {/* no luck */ ret = -ENOMEM ;
@@ -435,8 +436,10 @@list_del_init (&priv->cmb_list);if (list_empty (&cmb_area.list)) { +ssize_t size; + size =sizeof (struct cmb ) * cmb_area.num_channels;cmf_activate (NULL ,0 ); -kfree (cmb_area.mem); +free_pages ((unsigned long )cmb_area.mem,get_order (size)); cmb_area.mem =NULL ; } out:
@@ -595,11 +598,22 @@u32 reserved[7 ]; }; +/* kmalloc only guarantees 8 byte alignment, but we need cmbe +* pointers to be naturally aligned. Make sure to allocate +* enough space for two cmbes */ +static inline struct cmbe *cmbe_align (struct cmbe *c) +{ +unsigned long addr; + addr = ((unsigned long )c +sizeof (struct cmbe ) -sizeof (long )) & + ~(sizeof (struct cmbe ) -sizeof (long )); +return (struct cmbe *)addr; +} +static int alloc_cmbe (struct ccw_device *cdev) {struct cmbe *cmbe; - cmbe =kmalloc (sizeof (*cmbe),GFP_KERNEL /* | GFP_DMA ? */ ); + cmbe =kmalloc (sizeof (*cmbe) *2 ,GFP_KERNEL );if (!cmbe)return -ENOMEM ;
@@ -647,7 +661,7 @@if (!cdev->private->cmb)return -EINVAL ; - mba = mme ? (unsigned long )cdev->private->cmb :0 ; + mba = mme ? (unsigned long )cmbe_align (cdev->private->cmb) :0 ;return set_schib_wait (cdev, mme,1 , mba); }
@@ -669,7 +683,7 @@return 0 ; } - cmb = *(struct cmbe *)cdev->private->cmb; + cmb = *cmbe_align (cdev->private->cmb);spin_unlock_irqrestore (cdev->ccwlock, flags);switch (index) {
@@ -720,7 +734,7 @@return -ENODEV ; } - cmb = *(struct cmbe *)cdev->private->cmb; + cmb = *cmbe_align (cdev->private->cmb); time =get_clock () - cdev->private->cmb_start_time;spin_unlock_irqrestore (cdev->ccwlock, flags);
@@ -760,7 +774,7 @@ {struct cmbe *cmb;spin_lock_irq (cdev->ccwlock); - cmb = cdev->private->cmb; + cmb =cmbe_align (cdev->private->cmb);if (cmb)memset (cmb,0 ,sizeof (*cmb)); cdev->private->cmb_start_time =get_clock ();
drivers/s390/cio/css.h +1 -0
@@ -74,6 +74,7 @@ unsigned int fast:1; /* post with "channel end" */ unsigned int repall:1; /* report every interrupt status */ unsigned int pgroup:1; /* do path grouping */ + unsigned int force:1; /* allow forced online */ } __attribute__ ((packed)) options;struct {unsigned int pgid_single:1 ;/* use single path for Set PGID */
drivers/s390/cio/device.c +43 -81
195 lines not on this page · raw message
drivers/s390/cio/device.h +0 -1
@@ -102,7 +102,6 @@int ccw_device_call_handler (struct ccw_device *); -void ccw_device_add_stlck (void *);int ccw_device_stlck (struct ccw_device *);/* qdio needs this. */
drivers/s390/cio/device_fsm.c +13 -23
@@ -317,14 +317,10 @@ cdev->private->state = state; -if (state ==DEV_STATE_BOXED ) { +if (state ==DEV_STATE_BOXED )CIO_DEBUG (KERN_WARNING ,2 ,"Boxed device %04x on subchannel %04x\n" , cdev->private->devno, sch->irq); -INIT_WORK (&cdev->private->kick_work, - ccw_device_add_stlck, (void *) cdev); -queue_work (ccw_device_work, &cdev->private->kick_work); - }if (cdev->private->flags.donotify) { cdev->private->flags.donotify =0 ;
@@ -377,7 +373,8 @@struct subchannel *sch;int ret; -if (cdev->private->state !=DEV_STATE_NOT_OPER ) +if ((cdev->private->state !=DEV_STATE_NOT_OPER ) && + (cdev->private->state !=DEV_STATE_BOXED ))return -EINVAL ; sch =to_subchannel (cdev->dev.parent); ret =cio_enable_subchannel (sch, sch->schib.pmcw.isc);
@@ -492,7 +489,8 @@struct subchannel *sch;int ret; -if (cdev->private->state !=DEV_STATE_OFFLINE ) +if ((cdev->private->state !=DEV_STATE_OFFLINE ) && + (cdev->private->state !=DEV_STATE_BOXED ))return -EINVAL ; sch =to_subchannel (cdev->dev.parent);if (css_init_done && !get_device (&cdev->dev))
@@ -615,6 +613,13 @@struct subchannel *sch; sch =to_subchannel (cdev->dev.parent); +if (sch->driver->notify && + sch->driver->notify (&sch->dev, sch->lpm ?CIO_GONE :CIO_NO_PATH )) { +ccw_device_set_timeout (cdev,0 ); + cdev->private->state =DEV_STATE_DISCONNECTED ; +wake_up (&cdev->private->wait_q); +return ; + } cdev->private->state =DEV_STATE_NOT_OPER ;cio_disable_subchannel (sch);if (sch->schib.scsw.actl !=0 ) {
@@ -627,21 +632,6 @@wake_up (&cdev->private->wait_q); } -static void -ccw_device_disconnected_notoper (struct ccw_device *cdev, -enum dev_event dev_event) -{ -struct subchannel *sch; - - sch =to_subchannel (cdev->dev.parent); - cdev->private->state =DEV_STATE_NOT_OPER ; -cio_disable_subchannel (sch); -device_unregister (&sch->dev); - sch->schib.pmcw.intparm =0 ; -cio_modify (sch); -wake_up (&cdev->private->wait_q); -} -/* * Handle path verification event. */
@@ -1103,7 +1093,7 @@ }, /* special states for devices gone not operational */ [DEV_STATE_DISCONNECTED] { - [DEV_EVENT_NOTOPER] ccw_device_disconnected_notoper, + [DEV_EVENT_NOTOPER] ccw_device_nop, [DEV_EVENT_INTERRUPT] ccw_device_start_id, [DEV_EVENT_TIMEOUT] ccw_device_bug, [DEV_EVENT_VERIFY] ccw_device_nop,
drivers/s390/cio/device_ops.c +4 -0
@@ -38,6 +38,7 @@ cdev->private->options.fast = (flags &CCWDEV_EARLY_NOTIFICATION ) !=0 ; cdev->private->options.repall = (flags &CCWDEV_REPORT_ALL ) !=0 ; cdev->private->options.pgroup = (flags &CCWDEV_DO_PATHGROUP ) !=0 ; + cdev->private->options.force = (flags &CCWDEV_ALLOW_FORCE ) !=0 ;return 0 ; }
@@ -453,6 +454,9 @@if (!cdev)return -ENODEV ; +if (cdev->drv && !cdev->private->options.force) +return -EINVAL ; + sch =to_subchannel (cdev->dev.parent);CIO_TRACE_EVENT (2 ,"stl lock" );
drivers/s390/net/ctcmain.c +4 -3
@@ -1,5 +1,5 @@/* -* $Id: ctcmain.c,v 1.54 2004/02/18 12:35:59 ptiedem Exp $ +* $Id: ctcmain.c,v 1.56 2004/02/27 17:53:26 mschwide Exp $ * * CTC / ESCON network driver *
@@ -36,7 +36,7 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * -* RELEASE-TAG: CTC/ESCON network driver $Revision: 1.54 $ +* RELEASE-TAG: CTC/ESCON network driver $Revision: 1.56 $ * */
@@ -319,7 +319,7 @@print_banner (void) {static int printed =0 ; -char vbuf[] ="$Revision: 1.54 $" ; +char vbuf[] ="$Revision: 1.56 $" ;char *version = vbuf;if (printed)
@@ -3161,6 +3161,7 @@ }static struct ccwgroup_driver ctc_group_driver = { + .owner =THIS_MODULE , .name ="ctc" , .max_slaves =2 , .driver_id =0xC3E3C3 ,
drivers/s390/net/lcs.c +3 -2
@@ -11,7 +11,7 @@* Frank Pavlic ([email protected]) and * Martin Schwidefsky <[email protected]> * -* $Revision: 1.66 $ $Date: 2004/02/19 13:46:01 $ +* $Revision: 1.67 $ $Date: 2004/02/26 18:26:50 $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@/** * initialization string for output */ -#define VERSION_LCS_C "$Revision: 1.66 $" +#define VERSION_LCS_C "$Revision: 1.67 $"static char version[]__initdata ="LCS driver (" VERSION_LCS_C "/" VERSION_LCS_H ")" ;
@@ -1926,6 +1926,7 @@* LCS ccwgroup driver registration */ static struct ccwgroup_driver lcs_group_driver = { + .owner =THIS_MODULE , .name ="lcs" , .max_slaves =2 , .driver_id =0xD3C3E2 ,
drivers/s390/net/qeth.c +1 -0
@@ -10773,6 +10773,7 @@ }static struct ccwgroup_driver qeth_ccwgroup_driver = { + .owner =THIS_MODULE , .name ="qeth" , .driver_id =0xD8C5E3C8 , .probe = qeth_probe_device,
include/asm-s390/ccwdev.h +2 -0
@@ -118,6 +118,8 @@#define CCWDEV_REPORT_ALL 0x0002/* Try to perform path grouping. */ #define CCWDEV_DO_PATHGROUP 0x0004 +/* Allow forced onlining of boxed devices. */ +#define CCWDEV_ALLOW_FORCE 0x0008/* * ccw_device_start()
include/asm-s390/ccwgroup.h +1 -0
@@ -17,6 +17,7 @@ };struct ccwgroup_driver { +struct module *owner;char *name;int max_slaves;unsigned long driver_id;