summaryrefslogtreecommitdiff
path: root/drivers/s390/cio/device_fsm.c
AgeCommit message (Collapse)Author
2010-10-25[S390] cio: fix I/O cancel functionPeter Oberparleiter
Function ccw_device_cancel_halt_clear may cause an unexpected kernel panic if a clear function is currently active at the subchannel for which it is called. In that case, the iretry counter used to determine the number of retries is never initialized, leading to an immediate failure of the function which results in a kernel panic. Fix this by initializing the iretry counter when the function is first called. Also replace the kernel panic with a return code: a single malfunctioning I/O device should not automatically cause a system-wide kernel panic. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2010-10-25[S390] cio: notify drivers of channel path eventsSebastian Ott
This patch adds a notification mechanism to inform ccw drivers about changes to channel paths, which occured while the device is online. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2010-04-22[S390] cio: use exception-save stschSebastian Ott
Using stsch on schids with ssid != 0 can lead to an operand exception. Use stsch_err to handle potential exceptions if we fail to reenable mss after hibernation. Cc: <stable@kernel.org> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2010-02-26[S390] Cleanup struct _lowcore usage and defines.Heiko Carstens
Use asm offsets to make sure the offset defines to struct _lowcore and its layout don't get out of sync. Also add a BUILD_BUG_ON() which checks that the size of the structure is sane. And while being at it change those sites which use odd casts to access the current lowcore. These should use S390_lowcore instead. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2010-02-26[S390] ccw_device_notify: improve return codesSebastian Ott
Callers of ccw_device_notify could not distinguish between a driver who has no notifier registered and a driver who doesn't want to keep a device after a certain event. Change this by adding proper return codes. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: handle failed disable_subchannel after device recognitionSebastian Ott
Handle a failing cio_disable_subchannel at the end of our device recognition as if the recognition itself failed. This way subsequent registration steps do not need to handle enabled subchannels. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: fix quiesce stateSebastian Ott
DEV_STATE_QUIESCE is used to stop all IO on a busy subchannel. This patch fixes the following problems related to the QUIESCE state: * Fix a potential race condition which could occur when the resulting state was DEV_STATE_OFFLINE. * Add missing locking around cio_disable_subchannel, ccw_device_cancel_halt_clear and the cdev's handler. * Loop until we know for sure that the subchannel is disabled. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: make steal lock procedure more robustPeter Oberparleiter
An Unconditional Reserve + Release operation (steal lock) for a boxed device may fail when encountering special error cases (e.g. unit checks or path errors). Fix this by using the more robust ccw_request infrastructure for performing the steal lock CCW program. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: use sense-pgid operation for path verificationPeter Oberparleiter
Set-pgid operations fail for some device types under z/VM for which the hypervisor has already set the pgid. Also reserved devices or changed pgids are not correctly recognized. Fix these problems by using a combination of sense-pgid and set-pgid and by also accepting pre-defined pgid settings. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: split PGID settings and statusPeter Oberparleiter
Split setting (driver wants feature enabled) and status (feature setup was successful) for PGID related ccw device features so that setup errors can be detected. Previously, incorrectly handled setup errors could in rare cases lead to erratic I/O behavior and permanently unusuable devices. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: remove intretry flagPeter Oberparleiter
After changing all internal I/O functions to use the newly introduced ccw request infrastructure, retries are handled automatically after a clear operation. Therefore remove the internal retry flag and associated code. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: use ccw request infrastructure for pgidPeter Oberparleiter
Use the newly introduced ccw request infrastructure to implement pgid related operations: sense pgid, set pgid and disband pg. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: use ccw request infrastructure for sense idPeter Oberparleiter
Use the newly introduced ccw request infrastructure to implement the sense id operation. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: dont panic in non-fatal conditionsPeter Oberparleiter
Remove the call to BUG() for situations which are unexpected but do not cause actual problems. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: handle error during path verification consistentlyPeter Oberparleiter
Handle verification errors consistently through the existing callback ccw_device_done to reduce cleanup code duplication. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: handle error during device recognition consistentlyPeter Oberparleiter
Remove the return code from ccw_device_recognition and handle recognition errors through the existing callback ccw_device_recog_done to reduce cleanup code duplication. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: introduce ccw device todosPeter Oberparleiter
Introduce a central mechanism for performing delayed ccw device work to ensure that different types of work do not overwrite each other. Prioritization ensures that the most important work is always performed while less important tasks are either obsoleted or repeated later. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-12-07[S390] cio: introduce parent-initiated device movePeter Oberparleiter
Change the initiative to update subchannel-ccw device associations to the subchannel: when there is an indication that the internal association no longer reflects the current hardware state, mark each affected subchannel as requiring attention. Once processing reaches a subchannel, determine the correct association for that subchannel at that time and perform the necessary device_move operations. This change fixes problems with the previous approach which would leave devices in an inconsistent state when a new hardware change occurred while a device_move was already scheduled. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06[S390] cio: allow setting boxed devices offlinePeter Oberparleiter
Allow users to set boxed devices offline. After setting them offline, the device state will still be boxed. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06[S390] cio: make not operational handling consistentPeter Oberparleiter
When a ccw device appears not operational, inform the associated device driver and act according to the response: if the driver wants to keep the device, put it into the disconnected state. If not, or if there is no driver or if the device is not online, unregister it. This approach is consistent with no-path event handling. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06[S390] cio: make disconnected handling consistentPeter Oberparleiter
When there is no path left to a ccw device, inform the associated device driver and act according to the response: if the driver wants to keep the device, put it into the disconnected state. If not, or if there is no driver or if the device is not online, unregister it. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-09-11[S390] cio: failing set online/offline processing.Michael Ernst
When unit checks trigger sensing the device state is set to W4SENSE until sense completion; then the device state is set back to ONLINE. If a unit check occurs while set online or set offline requests are processed then it might happen that the device's temporary W4SENSE state causes these functions to terminate, leaving the device in an inconsistent state when the state is set back to ONLINE later on so that the device cannot be set online or offline any longer. To solve this, set online/offline and related rollback or error routines are processed only if the device is in a final or DISCONNECTED state. Signed-off-by: Michael Ernst <mernst@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-09-11[S390] cio: fix not oper handling after failed [on|off]line processingSebastian Ott
If online/offline processing of a ccw device fails, resulting in not operational state, notify the driver and unregister the device in case the driver dosn't want to keep it. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-09-11[S390] cio: fix ineffective verify eventPeter Oberparleiter
Path verification events occurring for offline devices are currently ignored. As a result, offline devices are not removed, even though they might no longer be accessible (for example because the last path to the device was varied offline). Fix this by scheduling a status evaluation for the affected subchannel when a path verification event occurs. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-06-16[S390] pm: ccw bus power management callbacksSebastian Ott
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-31[S390] cio: introduce notifier for boxed stateSebastian Ott
If a ccw device did not respond in time during internal io, we set it into boxed state. With this patch we have the following behaviour: * the ccw driver will get a notification if the device was online and goes into the boxed state * if the device was disconnected and got boxed nothing special is to be done (it will be handled in reprobing later) * if the device got boxed while initial sensing it will be unregistered Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-31[S390] cio: wake up on failed recognitionSebastian Ott
Wake up even on failed device recognition, since this may be triggered from a user trying to force a device online. With this patch a write to the online sysfs attribute will not block for ever but return with -EAGAIN in this case. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26[S390] cio: Use ccw_device_set_notoper().Cornelia Huck
Use ccw_device_set_notoper() (which also deletes the device timer and disables the subchannel) instead of simply setting the state to DEV_STATE_NOT_OPER in the generic not operational handling code. This prevents unexpected interrupts popping up for devices that are deemed not operational. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26[S390] cio: Try harder to disable subchannel.Cornelia Huck
Acting upon the assumption that cio_disable_subchannel() is only called when we really want to disable the subchannel (a) remove the check for activity (it is already done in ccw_device_offline(), which is the place where it matters) (b) collect pending status via tsch() and ignore it (it can't matter anymore since the subchannel will be disabled). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26[S390] cio: Use unbind/bind instead of unregister/register.Cornelia Huck
The common I/O layer may encounter a situation where the device number of a ccw device has changed or a device driver doesn't want to keep a formerly disconnected device becoming operational again. Instead of using device_del()/ device_add() as now, we can just unbind the driver from the device and rebind it to get the desired effect (rebinding) with less overhead. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-12-25[S390] cio: commit all pmcw changes.Sebastian Ott
Sometimes we change the pmcw configuration but don't call msch to transmit these changes to the channel subsystem. The patch fixes this by calling cio_commit_config in such cases. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-12-25[S390] cio: introduce cio_commit_configSebastian Ott
To change the configuration of a subchannel we alter the modifiable bits of the subchannel's schib field and issue a modify subchannel. There can be the case that not all changes were applied -or worse- quietly overwritten by the hardware. With the next store subchannel we obtain the current state of the hardware but lose our target configuration. With this patch we introduce a subchannel_config structure which contains the target subchannel configuration. Additionally the msch wrapper cio_modify is replaced with cio_commit_config which copies the desired changes to a temporary schib. msch is then called with the temporary schib. This schib is only written back to the subchannel if all changes were applied. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-12-25[S390] cio: introduce cio_update_schibSebastian Ott
There is the chance that we get condition code 0 for a stsch but the resulting schib is not vaild. In the current code there are 2 cases: * we do a check for validity of the schib after stsch, but at this time we have already stored the invaild schib in the subchannel structure. This may lead to problems. * we don't do a check for validity, which is not that good either. The patch addresses both issues by introducing the stsch wrapper cio_update_schib which performs stsch on a local schib. This schib is only written back to the subchannel if it's valid. side note: For some functions (chp_events) the return codes are different now (-ENXIO vs -ENODEV) but this shouldn't do harm since the caller doesn't check for _specific_ errors. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-12-25[S390] cio: Fix reference counting for online/offline.Cornelia Huck
The current code attempts to get an extra reference count for online devices by doing a get_device() in ccw_device_online() and a put_device() in ccw_device_done(). However, this - incorrectly obtains an extra reference for disconnected devices becoming available again (since they are already online) - needs special checks for css_init_done in order to handle the console device - is not obvious and - may incorretly drop a reference count in ccw_device_done() if that function is called after path verification for a device that just became not operational. So let's just get the reference in ccw_device_set_online() and drop it in ccw_device_set_offline(). (Unfortunately, we still need the special case in io_subchannel_probe().) Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-10-10[S390] bus_id -> dev_name conversionsKay Sievers
bus_id -> dev_name() conversions in s390 code. [cornelia.huck@de.ibm.com: minor adaptions] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-09-09[S390] cio: allow offline processing for disconnected devicesPeter Oberparleiter
When disconnected ccw devices are removed, the device has to be set offline, otherwise there will be side effects including a reference count imbalance. This patch modifies ccw_device_offline to work for devices in disconnecte/not operational state. ccw_device_offline is called by cio for devices which are online during device removal. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-08-21[S390] cio: call ccw driver notify function with lock heldPeter Oberparleiter
Calling a ccw driver's notify function without the ccw device lock held opens up a race window between discovery and handling of a change in the device operational state. As a result, the device driver may encounter unexpected device malfunction, leading to out-of-retry situations or similar. Remove race by extending the ccw device lock from state change discovery to the calling of the notify function. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-07-14[S390] cio: remove lock from ccw_device_oper_notify.Sebastian Ott
Remove unnecessary ccw device locking inside ccw_device_oper_notify. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-07-14[S390] cio: provide functions for fcx enabled I/OPeter Oberparleiter
Provide functions for assembling and starting fcx enabled I/O request blocks. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-07-14[S390] cio: introduce fcx enabled scsw formatPeter Oberparleiter
Extend the scsw data structure to the format required by fcx. Also provide helper functions for easier access to fields which are present in both the traditional as well as the modified format. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-07-14[S390] cio: Rework css driver.Cornelia Huck
Rework the css driver methods to provide sane callbacks for subchannels of all types. As a bonus, this cleans up and simplyfies the machine check handling for I/O subchannels a lot. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-05-07[S390] cio: Remove cio_msg kernel parameter.Michael Ernst
The only sporadically used CIO_DEBUG messages are replaced by ordinary CIO_MSG_EVENT messages. The CIO_MSG_EVENT messages debug levels are consolidated. Signed-off-by: Michael Ernst <mernst@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-04-30[S390] cio: Make isc handling more robust.Cornelia Huck
Introduce an ->isc field in the subchannel to store the desired interruption subclass, since sch->schib.pmcw.isc may be overwritten by the hardware on stsch() after machine checks. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: introduce timed recovery procedurePeter Oberparleiter
Add a timed recovery procedure to reactivate ccw devices in cases where HW/VM events are not sufficient to allow for proper recovery of reappearing channel paths. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: Delete timer in ccw_device_verify_done().Cornelia Huck
Make sure pending timers are always deleted, even if we don't go through ccw_device_done(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: Use dev_{g,s}et_drvdata().Cornelia Huck
Also define helpers sch_{g,s}et_cdev() to make the intention more clear. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: I/O subchannel specific fields.Cornelia Huck
Some fields may be !0 only for I/O subchannels. Add some checks where required. Also adapt cio_enable_subchannel() to make the caller specify the intparm, which makes it more generic. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: Introduce subchannel->private.Cornelia Huck
Introduce a private pointer in struct subchannel to store per-subchannel type data (cannot use dev->priv since this is already used for something else). Create a new header io_sch.h for I/O subchannel specific structures and instructions. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: Cleanup debug feature usage.Cornelia Huck
Cleanup cio_debug.h. Also make CIO_DEBUG add the "cio:" prefix to the printk string so that it isn't needed for the debug feature. Fix outdated comments for cio_debug_init() and clean it up. Enlarge cio_crw to the same size as cio_msg so we may actually find some relevant information there. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] cio: css_driver: Use consistent parameters.Cornelia Huck
Make all callbacks in css_driver take a struct subchannel (and not a struct device). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>