aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2009-12-18 11:43:23 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-12-18 11:43:32 -0500
commitd302e1a5dbe1677a495033a2d310656a55139cdf (patch)
treebcf2403ce1f031a576c3166eec62c5e47abab058 /drivers/s390
parent83e56d0b23f91b70a7e708ce0979a57b6c6a1507 (diff)
[S390] cio: fix channel path vary
Channel path vary is currently broken: channel paths which are varied offline are still used by Linux. The reason for this is that: * the path mask indicating which paths of an I/O device can be used is reset by each internal I/O request * the logic that checks if a path group is already in its designated target state incorrectly interprets the result "is correctly set" as "is correctly set and available" Fix this by resetting the path mask only for internal I/O requests which affect the path mask and by correcting the pgid check logic. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/ccwreq.c3
-rw-r--r--drivers/s390/cio/device_pgid.c29
-rw-r--r--drivers/s390/cio/io_sch.h1
3 files changed, 19 insertions, 14 deletions
diff --git a/drivers/s390/cio/ccwreq.c b/drivers/s390/cio/ccwreq.c
index 9509e3860934..7a28a3029a3f 100644
--- a/drivers/s390/cio/ccwreq.c
+++ b/drivers/s390/cio/ccwreq.c
@@ -49,7 +49,6 @@ static u16 ccwreq_next_path(struct ccw_device *cdev)
49 */ 49 */
50static void ccwreq_stop(struct ccw_device *cdev, int rc) 50static void ccwreq_stop(struct ccw_device *cdev, int rc)
51{ 51{
52 struct subchannel *sch = to_subchannel(cdev->dev.parent);
53 struct ccw_request *req = &cdev->private->req; 52 struct ccw_request *req = &cdev->private->req;
54 53
55 if (req->done) 54 if (req->done)
@@ -57,7 +56,6 @@ static void ccwreq_stop(struct ccw_device *cdev, int rc)
57 req->done = 1; 56 req->done = 1;
58 ccw_device_set_timeout(cdev, 0); 57 ccw_device_set_timeout(cdev, 0);
59 memset(&cdev->private->irb, 0, sizeof(struct irb)); 58 memset(&cdev->private->irb, 0, sizeof(struct irb));
60 sch->lpm = sch->schib.pmcw.pam;
61 if (rc && rc != -ENODEV && req->drc) 59 if (rc && rc != -ENODEV && req->drc)
62 rc = req->drc; 60 rc = req->drc;
63 req->callback(cdev, req->data, rc); 61 req->callback(cdev, req->data, rc);
@@ -80,7 +78,6 @@ static void ccwreq_do(struct ccw_device *cdev)
80 continue; 78 continue;
81 } 79 }
82 /* Perform start function. */ 80 /* Perform start function. */
83 sch->lpm = 0xff;
84 memset(&cdev->private->irb, 0, sizeof(struct irb)); 81 memset(&cdev->private->irb, 0, sizeof(struct irb));
85 rc = cio_start(sch, cp, (u8) req->mask); 82 rc = cio_start(sch, cp, (u8) req->mask);
86 if (rc == 0) { 83 if (rc == 0) {
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index aad188e43b4f..6facb5499a65 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -142,7 +142,7 @@ static void spid_do(struct ccw_device *cdev)
142 u8 fn; 142 u8 fn;
143 143
144 /* Use next available path that is not already in correct state. */ 144 /* Use next available path that is not already in correct state. */
145 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam & ~sch->vpm); 145 req->lpm = lpm_adjust(req->lpm, cdev->private->pgid_todo_mask);
146 if (!req->lpm) 146 if (!req->lpm)
147 goto out_nopath; 147 goto out_nopath;
148 /* Channel program setup. */ 148 /* Channel program setup. */
@@ -254,15 +254,15 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p,
254 *p = first; 254 *p = first;
255} 255}
256 256
257static u8 pgid_to_vpm(struct ccw_device *cdev) 257static u8 pgid_to_donepm(struct ccw_device *cdev)
258{ 258{
259 struct subchannel *sch = to_subchannel(cdev->dev.parent); 259 struct subchannel *sch = to_subchannel(cdev->dev.parent);
260 struct pgid *pgid; 260 struct pgid *pgid;
261 int i; 261 int i;
262 int lpm; 262 int lpm;
263 u8 vpm = 0; 263 u8 donepm = 0;
264 264
265 /* Set VPM bits for paths which are already in the target state. */ 265 /* Set bits for paths which are already in the target state. */
266 for (i = 0; i < 8; i++) { 266 for (i = 0; i < 8; i++) {
267 lpm = 0x80 >> i; 267 lpm = 0x80 >> i;
268 if ((cdev->private->pgid_valid_mask & lpm) == 0) 268 if ((cdev->private->pgid_valid_mask & lpm) == 0)
@@ -282,10 +282,10 @@ static u8 pgid_to_vpm(struct ccw_device *cdev)
282 if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH) 282 if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH)
283 continue; 283 continue;
284 } 284 }
285 vpm |= lpm; 285 donepm |= lpm;
286 } 286 }
287 287
288 return vpm; 288 return donepm;
289} 289}
290 290
291static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid) 291static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid)
@@ -307,6 +307,7 @@ static void snid_done(struct ccw_device *cdev, int rc)
307 int mismatch = 0; 307 int mismatch = 0;
308 int reserved = 0; 308 int reserved = 0;
309 int reset = 0; 309 int reset = 0;
310 u8 donepm;
310 311
311 if (rc) 312 if (rc)
312 goto out; 313 goto out;
@@ -316,18 +317,20 @@ static void snid_done(struct ccw_device *cdev, int rc)
316 else if (mismatch) 317 else if (mismatch)
317 rc = -EOPNOTSUPP; 318 rc = -EOPNOTSUPP;
318 else { 319 else {
319 sch->vpm = pgid_to_vpm(cdev); 320 donepm = pgid_to_donepm(cdev);
321 sch->vpm = donepm & sch->opm;
322 cdev->private->pgid_todo_mask &= ~donepm;
320 pgid_fill(cdev, pgid); 323 pgid_fill(cdev, pgid);
321 } 324 }
322out: 325out:
323 CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " 326 CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x "
324 "mism=%d rsvd=%d reset=%d\n", id->ssid, id->devno, rc, 327 "todo=%02x mism=%d rsvd=%d reset=%d\n", id->ssid,
325 cdev->private->pgid_valid_mask, sch->vpm, mismatch, 328 id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm,
326 reserved, reset); 329 cdev->private->pgid_todo_mask, mismatch, reserved, reset);
327 switch (rc) { 330 switch (rc) {
328 case 0: 331 case 0:
329 /* Anything left to do? */ 332 /* Anything left to do? */
330 if (sch->vpm == sch->schib.pmcw.pam) { 333 if (cdev->private->pgid_todo_mask == 0) {
331 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0); 334 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0);
332 return; 335 return;
333 } 336 }
@@ -411,6 +414,7 @@ static void verify_start(struct ccw_device *cdev)
411 struct ccw_dev_id *devid = &cdev->private->dev_id; 414 struct ccw_dev_id *devid = &cdev->private->dev_id;
412 415
413 sch->vpm = 0; 416 sch->vpm = 0;
417 sch->lpm = sch->schib.pmcw.pam;
414 /* Initialize request data. */ 418 /* Initialize request data. */
415 memset(req, 0, sizeof(*req)); 419 memset(req, 0, sizeof(*req));
416 req->timeout = PGID_TIMEOUT; 420 req->timeout = PGID_TIMEOUT;
@@ -442,11 +446,14 @@ static void verify_start(struct ccw_device *cdev)
442 */ 446 */
443void ccw_device_verify_start(struct ccw_device *cdev) 447void ccw_device_verify_start(struct ccw_device *cdev)
444{ 448{
449 struct subchannel *sch = to_subchannel(cdev->dev.parent);
450
445 CIO_TRACE_EVENT(4, "vrfy"); 451 CIO_TRACE_EVENT(4, "vrfy");
446 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); 452 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id));
447 /* Initialize PGID data. */ 453 /* Initialize PGID data. */
448 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid)); 454 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid));
449 cdev->private->pgid_valid_mask = 0; 455 cdev->private->pgid_valid_mask = 0;
456 cdev->private->pgid_todo_mask = sch->schib.pmcw.pam;
450 /* 457 /*
451 * Initialize pathgroup and multipath state with target values. 458 * Initialize pathgroup and multipath state with target values.
452 * They may change in the course of path verification. 459 * They may change in the course of path verification.
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index d72ae4c93af9..b9ce712a7f25 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -150,6 +150,7 @@ struct ccw_device_private {
150 struct ccw_request req; /* internal I/O request */ 150 struct ccw_request req; /* internal I/O request */
151 int iretry; 151 int iretry;
152 u8 pgid_valid_mask; /* mask of valid PGIDs */ 152 u8 pgid_valid_mask; /* mask of valid PGIDs */
153 u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */
153 struct { 154 struct {
154 unsigned int fast:1; /* post with "channel end" */ 155 unsigned int fast:1; /* post with "channel end" */
155 unsigned int repall:1; /* report every interrupt status */ 156 unsigned int repall:1; /* report every interrupt status */