diff options
Diffstat (limited to 'drivers/s390')
35 files changed, 557 insertions, 340 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 0595c763daf..29225e1c159 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -349,6 +349,16 @@ static int dasd_state_basic_to_ready(struct dasd_device *device) return rc; } +static inline +int _wait_for_empty_queues(struct dasd_device *device) +{ + if (device->block) + return list_empty(&device->ccw_queue) && + list_empty(&device->block->ccw_queue); + else + return list_empty(&device->ccw_queue); +} + /* * Remove device from block device layer. Destroy dirty buffers. * Forget format information. Check if the target level is basic @@ -1841,6 +1851,13 @@ static void __dasd_device_check_expire(struct dasd_device *device) cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); if ((cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) && (time_after_eq(jiffies, cqr->expires + cqr->starttime))) { + if (test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { + /* + * IO in safe offline processing should not + * run out of retries + */ + cqr->retries++; + } if (device->discipline->term_IO(cqr) != 0) { /* Hmpf, try again in 5 sec */ dev_err(&device->cdev->dev, @@ -3024,11 +3041,11 @@ void dasd_generic_remove(struct ccw_device *cdev) cdev->handler = NULL; - dasd_remove_sysfs_files(cdev); device = dasd_device_from_cdev(cdev); if (IS_ERR(device)) return; - if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags)) { + if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) && + !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { /* Already doing offline processing */ dasd_put_device(device); return; @@ -3048,6 +3065,8 @@ void dasd_generic_remove(struct ccw_device *cdev) */ if (block) dasd_free_block(block); + + dasd_remove_sysfs_files(cdev); } /* @@ -3126,16 +3145,13 @@ int dasd_generic_set_offline(struct ccw_device *cdev) { struct dasd_device *device; struct dasd_block *block; - int max_count, open_count; + int max_count, open_count, rc; + rc = 0; device = dasd_device_from_cdev(cdev); if (IS_ERR(device)) return PTR_ERR(device); - if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags)) { - /* Already doing offline processing */ - dasd_put_device(device); - return 0; - } + /* * We must make sure that this device is currently not in use. * The open_count is increased for every opener, that includes @@ -3159,6 +3175,54 @@ int dasd_generic_set_offline(struct ccw_device *cdev) return -EBUSY; } } + + if (test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { + /* + * safe offline allready running + * could only be called by normal offline so safe_offline flag + * needs to be removed to run normal offline and kill all I/O + */ + if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags)) { + /* Already doing normal offline processing */ + dasd_put_device(device); + return -EBUSY; + } else + clear_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); + + } else + if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { + /* Already doing offline processing */ + dasd_put_device(device); + return -EBUSY; + } + + /* + * if safe_offline called set safe_offline_running flag and + * clear safe_offline so that a call to normal offline + * can overrun safe_offline processing + */ + if (test_and_clear_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags) && + !test_and_set_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { + /* + * If we want to set the device safe offline all IO operations + * should be finished before continuing the offline process + * so sync bdev first and then wait for our queues to become + * empty + */ + /* sync blockdev and partitions */ + rc = fsync_bdev(device->block->bdev); + if (rc != 0) + goto interrupted; + + /* schedule device tasklet and wait for completion */ + dasd_schedule_device_bh(device); + rc = wait_event_interruptible(shutdown_waitq, + _wait_for_empty_queues(device)); + if (rc != 0) + goto interrupted; + } + + set_bit(DASD_FLAG_OFFLINE, &device->flags); dasd_set_target_state(device, DASD_STATE_NEW); /* dasd_delete_device destroys the device reference. */ block = device->block; @@ -3170,6 +3234,14 @@ int dasd_generic_set_offline(struct ccw_device *cdev) if (block) dasd_free_block(block); return 0; + +interrupted: + /* interrupted by signal */ + clear_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); + clear_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags); + clear_bit(DASD_FLAG_OFFLINE, &device->flags); + dasd_put_device(device); + return rc; } int dasd_generic_last_path_gone(struct dasd_device *device) @@ -3489,15 +3561,6 @@ char *dasd_get_sense(struct irb *irb) } EXPORT_SYMBOL_GPL(dasd_get_sense); -static inline int _wait_for_empty_queues(struct dasd_device *device) -{ - if (device->block) - return list_empty(&device->ccw_queue) && - list_empty(&device->block->ccw_queue); - else - return list_empty(&device->ccw_queue); -} - void dasd_generic_shutdown(struct ccw_device *cdev) { struct dasd_device *device; diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index b2b8c18eece..c196827c228 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -952,6 +952,39 @@ static DEVICE_ATTR(raw_track_access, 0644, dasd_use_raw_show, dasd_use_raw_store); static ssize_t +dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ccw_device *cdev = to_ccwdev(dev); + struct dasd_device *device; + int rc; + + device = dasd_device_from_cdev(cdev); + if (IS_ERR(device)) { + rc = PTR_ERR(device); + goto out; + } + + if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || + test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { + /* Already doing offline processing */ + dasd_put_device(device); + rc = -EBUSY; + goto out; + } + + set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); + dasd_put_device(device); + + rc = ccw_device_set_offline(cdev); + +out: + return rc ? rc : count; +} + +static DEVICE_ATTR(safe_offline, 0200, NULL, dasd_safe_offline_store); + +static ssize_t dasd_discipline_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1320,6 +1353,7 @@ static struct attribute * dasd_attrs[] = { &dev_attr_expires.attr, &dev_attr_reservation_policy.attr, &dev_attr_last_known_reservation_state.attr, + &dev_attr_safe_offline.attr, NULL, }; @@ -1344,7 +1378,7 @@ dasd_get_feature(struct ccw_device *cdev, int feature) /* * Set / reset given feature. - * Flag indicates wether to set (!=0) or the reset (=0) the feature. + * Flag indicates whether to set (!=0) or the reset (=0) the feature. */ int dasd_set_feature(struct ccw_device *cdev, int feature, int flag) diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 108332b44d9..806fe912d6e 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -1026,7 +1026,7 @@ static int dasd_eckd_read_conf(struct dasd_device *device) { void *conf_data; int conf_len, conf_data_saved; - int rc; + int rc, path_err; __u8 lpm, opm; struct dasd_eckd_private *private, path_private; struct dasd_path *path_data; @@ -1037,6 +1037,7 @@ static int dasd_eckd_read_conf(struct dasd_device *device) path_data = &device->path_data; opm = ccw_device_get_path_mask(device->cdev); conf_data_saved = 0; + path_err = 0; /* get configuration data per operational path */ for (lpm = 0x80; lpm; lpm>>= 1) { if (!(lpm & opm)) @@ -1122,7 +1123,8 @@ static int dasd_eckd_read_conf(struct dasd_device *device) "the same device, path %02X leads to " "device %s instead of %s\n", lpm, print_path_uid, print_device_uid); - return -EINVAL; + path_err = -EINVAL; + continue; } path_private.conf_data = NULL; @@ -1142,7 +1144,7 @@ static int dasd_eckd_read_conf(struct dasd_device *device) kfree(conf_data); } - return 0; + return path_err; } static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm) @@ -3847,7 +3849,7 @@ dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) len = 0; while (from <= to) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " CCW %p: %08X %08X DAT:", from, ((int *) from)[0], ((int *) from)[1]); @@ -3908,23 +3910,23 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, return; } /* dump the sense data */ - len = sprintf(page, KERN_ERR PRINTK_HEADER + len = sprintf(page, PRINTK_HEADER " I/O status report for device %s:\n", dev_name(&device->cdev->dev)); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " in req: %p CC:%02X FC:%02X AC:%02X SC:%02X DS:%02X " "CS:%02X RC:%d\n", req, scsw_cc(&irb->scsw), scsw_fctl(&irb->scsw), scsw_actl(&irb->scsw), scsw_stctl(&irb->scsw), scsw_dstat(&irb->scsw), scsw_cstat(&irb->scsw), req ? req->intrc : 0); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " device %s: Failing CCW: %p\n", dev_name(&device->cdev->dev), (void *) (addr_t) irb->scsw.cmd.cpa); if (irb->esw.esw0.erw.cons) { for (sl = 0; sl < 4; sl++) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " Sense(hex) %2d-%2d:", (8 * sl), ((8 * sl) + 7)); @@ -3937,23 +3939,23 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, if (irb->ecw[27] & DASD_SENSE_BIT_0) { /* 24 Byte Sense Data */ - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " 24 Byte: %x MSG %x, " "%s MSGb to SYSOP\n", irb->ecw[7] >> 4, irb->ecw[7] & 0x0f, irb->ecw[1] & 0x10 ? "" : "no"); } else { /* 32 Byte Sense Data */ - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " 32 Byte: Format: %x " "Exception class %x\n", irb->ecw[6] & 0x0f, irb->ecw[22] >> 4); } } else { - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " SORRY - NO VALID SENSE AVAILABLE\n"); } - printk("%s", page); + printk(KERN_ERR "%s", page); if (req) { /* req == NULL for unsolicited interrupts */ @@ -3962,10 +3964,10 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, first = req->cpaddr; for (last = first; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++); to = min(first + 6, last); - len = sprintf(page, KERN_ERR PRINTK_HEADER + len = sprintf(page, PRINTK_HEADER " Related CP in req: %p\n", req); dasd_eckd_dump_ccw_range(first, to, page + len); - printk("%s", page); + printk(KERN_ERR "%s", page); /* print failing CCW area (maximum 4) */ /* scsw->cda is either valid or zero */ @@ -3975,7 +3977,7 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, irb->scsw.cmd.cpa; /* failing CCW */ if (from < fail - 2) { from = fail - 2; /* there is a gap - print header */ - len += sprintf(page, KERN_ERR PRINTK_HEADER "......\n"); + len += sprintf(page, PRINTK_HEADER "......\n"); } to = min(fail + 1, last); len += dasd_eckd_dump_ccw_range(from, to, page + len); @@ -3984,11 +3986,11 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, from = max(from, ++to); if (from < last - 1) { from = last - 1; /* there is a gap - print header */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n"); + len += sprintf(page + len, PRINTK_HEADER "......\n"); } len += dasd_eckd_dump_ccw_range(from, last, page + len); if (len > 0) - printk("%s", page); + printk(KERN_ERR "%s", page); } free_page((unsigned long) page); } @@ -4012,10 +4014,10 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, return; } /* dump the sense data */ - len = sprintf(page, KERN_ERR PRINTK_HEADER + len = sprintf(page, PRINTK_HEADER " I/O status report for device %s:\n", dev_name(&device->cdev->dev)); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " in req: %p CC:%02X FC:%02X AC:%02X SC:%02X DS:%02X " "CS:%02X fcxs:%02X schxs:%02X RC:%d\n", req, scsw_cc(&irb->scsw), scsw_fctl(&irb->scsw), @@ -4023,7 +4025,7 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, scsw_dstat(&irb->scsw), scsw_cstat(&irb->scsw), irb->scsw.tm.fcxs, irb->scsw.tm.schxs, req ? req->intrc : 0); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " device %s: Failing TCW: %p\n", dev_name(&device->cdev->dev), (void *) (addr_t) irb->scsw.tm.tcw); @@ -4035,43 +4037,42 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, (struct tcw *)(unsigned long)irb->scsw.tm.tcw); if (tsb) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->length %d\n", tsb->length); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->flags %x\n", tsb->flags); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->dcw_offset %d\n", tsb->dcw_offset); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->count %d\n", tsb->count); residual = tsb->count - 28; - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " residual %d\n", residual); switch (tsb->flags & 0x07) { case 1: /* tsa_iostat */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.iostat.dev_time %d\n", tsb->tsa.iostat.dev_time); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.iostat.def_time %d\n", tsb->tsa.iostat.def_time); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.iostat.queue_time %d\n", tsb->tsa.iostat.queue_time); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.iostat.dev_busy_time %d\n", tsb->tsa.iostat.dev_busy_time); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.iostat.dev_act_time %d\n", tsb->tsa.iostat.dev_act_time); sense = tsb->tsa.iostat.sense; break; case 2: /* ts_ddpc */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.ddpc.rc %d\n", tsb->tsa.ddpc.rc); for (sl = 0; sl < 2; sl++) { - len += sprintf(page + len, - KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " tsb->tsa.ddpc.rcq %2d-%2d: ", (8 * sl), ((8 * sl) + 7)); rcq = tsb->tsa.ddpc.rcq; @@ -4084,15 +4085,14 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, sense = tsb->tsa.ddpc.sense; break; case 3: /* tsa_intrg */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " tsb->tsa.intrg.: not supportet yet \n"); + len += sprintf(page + len, PRINTK_HEADER + " tsb->tsa.intrg.: not supportet yet\n"); break; } if (sense) { for (sl = 0; sl < 4; sl++) { - len += sprintf(page + len, - KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " Sense(hex) %2d-%2d:", (8 * sl), ((8 * sl) + 7)); for (sct = 0; sct < 8; sct++) { @@ -4104,27 +4104,27 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, if (sense[27] & DASD_SENSE_BIT_0) { /* 24 Byte Sense Data */ - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " 24 Byte: %x MSG %x, " "%s MSGb to SYSOP\n", sense[7] >> 4, sense[7] & 0x0f, sense[1] & 0x10 ? "" : "no"); } else { /* 32 Byte Sense Data */ - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " 32 Byte: Format: %x " "Exception class %x\n", sense[6] & 0x0f, sense[22] >> 4); } } else { - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " SORRY - NO VALID SENSE AVAILABLE\n"); } } else { - sprintf(page + len, KERN_ERR PRINTK_HEADER + sprintf(page + len, PRINTK_HEADER " SORRY - NO TSB DATA AVAILABLE\n"); } - printk("%s", page); + printk(KERN_ERR "%s", page); free_page((unsigned long) page); } @@ -4161,9 +4161,7 @@ static int dasd_eckd_restore_device(struct dasd_device *device) private = (struct dasd_eckd_private *) device->private; /* Read Configuration Data */ - rc = dasd_eckd_read_conf(device); - if (rc) - goto out_err; + dasd_eckd_read_conf(device); dasd_eckd_get_uid(device, &temp_uid); /* Generate device unique id */ @@ -4183,9 +4181,7 @@ static int dasd_eckd_restore_device(struct dasd_device *device) dasd_eckd_validate_server(device, DASD_CQR_FLAGS_FAILFAST); /* RE-Read Configuration Data */ - rc = dasd_eckd_read_conf(device); - if (rc) - goto out_err; + dasd_eckd_read_conf(device); /* Read Feature Codes */ dasd_eckd_read_features(device); diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index fb7f3bdc660..eb748507c7f 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -479,19 +479,19 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, "No memory to dump sense data"); return; } - len = sprintf(page, KERN_ERR PRINTK_HEADER + len = sprintf(page, PRINTK_HEADER " I/O status report for device %s:\n", dev_name(&device->cdev->dev)); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " in req: %p CS: 0x%02X DS: 0x%02X\n", req, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " device %s: Failing CCW: %p\n", dev_name(&device->cdev->dev), (void *) (addr_t) irb->scsw.cmd.cpa); if (irb->esw.esw0.erw.cons) { for (sl = 0; sl < 4; sl++) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " Sense(hex) %2d-%2d:", (8 * sl), ((8 * sl) + 7)); @@ -502,7 +502,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, len += sprintf(page + len, "\n"); } } else { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " SORRY - NO VALID SENSE AVAILABLE\n"); } printk(KERN_ERR "%s", page); @@ -512,10 +512,9 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, act = req->cpaddr; for (last = act; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++); end = min(act + 8, last); - len = sprintf(page, KERN_ERR PRINTK_HEADER - " Related CP in req: %p\n", req); + len = sprintf(page, PRINTK_HEADER " Related CP in req: %p\n", req); while (act <= end) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " CCW %p: %08X %08X DAT:", act, ((int *) act)[0], ((int *) act)[1]); for (count = 0; count < 32 && count < act->count; @@ -533,11 +532,11 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, len = 0; if (act < ((struct ccw1 *)(addr_t) irb->scsw.cmd.cpa) - 2) { act = ((struct ccw1 *)(addr_t) irb->scsw.cmd.cpa) - 2; - len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n"); + len += sprintf(page + len, PRINTK_HEADER "......\n"); } end = min((struct ccw1 *)(addr_t) irb->scsw.cmd.cpa + 2, last); while (act <= end) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " CCW %p: %08X %08X DAT:", act, ((int *) act)[0], ((int *) act)[1]); for (count = 0; count < 32 && count < act->count; @@ -552,10 +551,10 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, /* print last CCWs */ if (act < last - 2) { act = last - 2; - len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n"); + len += sprintf(page + len, PRINTK_HEADER "......\n"); } while (act <= last) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER + len += sprintf(page + len, PRINTK_HEADER " CCW %p: %08X %08X DAT:", act, ((int *) act)[0], ((int *) act)[1]); for (count = 0; count < 32 && count < act->count; diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 7ff93eea673..899e3f5a56e 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -516,6 +516,8 @@ struct dasd_block { #define DASD_FLAG_IS_RESERVED 7 /* The device is reserved */ #define DASD_FLAG_LOCK_STOLEN 8 /* The device lock was stolen */ #define DASD_FLAG_SUSPENDED 9 /* The device was suspended */ +#define DASD_FLAG_SAFE_OFFLINE 10 /* safe offline processing requested*/ +#define DASD_FLAG_SAFE_OFFLINE_RUNNING 11 /* safe offline running */ void dasd_put_device_wake(struct dasd_device *); diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 8252f37d04e..03c0e044455 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -19,6 +19,7 @@ #include <linux/slab.h> #include <asm/compat.h> #include <asm/ccwdev.h> +#include <asm/schid.h> #include <asm/cmb.h> #include <asm/uaccess.h> @@ -308,11 +309,12 @@ static int dasd_ioctl_information(struct dasd_block *block, unsigned int cmd, void __user *argp) { struct dasd_information2_t *dasd_info; - unsigned long flags; - int rc; + struct subchannel_id sch_id; + struct ccw_dev_id dev_id; struct dasd_device *base; struct ccw_device *cdev; - struct ccw_dev_id dev_id; + unsigned long flags; + int rc; base = block->base; if (!base->discipline || !base->discipline->fill_info) @@ -330,9 +332,10 @@ static int dasd_ioctl_information(struct dasd_block *block, cdev = base->cdev; ccw_device_get_id(cdev, &dev_id); + ccw_device_get_schid(cdev, &sch_id); dasd_info->devno = dev_id.devno; - dasd_info->schid = _ccw_device_get_subchannel_number(base->cdev); + dasd_info->schid = sch_id.sch_no; dasd_info->cu_type = cdev->id.cu_type; dasd_info->cu_model = cdev->id.cu_model; dasd_info->dev_type = cdev->id.dev_type; diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 9ffb6d5f17a..40084501c31 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -44,7 +44,6 @@ #define RAW3215_NR_CCWS 3 #define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ -#define RAW3215_FIXED 1 /* 3215 console device is not be freed */ #define RAW3215_WORKING 4 /* set if a request is being worked on */ #define RAW3215_THROTTLED 8 /* set if reading is disabled */ #define RAW3215_STOPPED 16 /* set if writing is disabled */ @@ -339,8 +338,10 @@ static void raw3215_wakeup(unsigned long data) struct tty_struct *tty; tty = tty_port_tty_get(&raw->port); - tty_wakeup(tty); - tty_kref_put(tty); + if (tty) { + tty_wakeup(tty); + tty_kref_put(tty); + } } /* @@ -629,8 +630,7 @@ static void raw3215_shutdown(struct raw3215_info *raw) DECLARE_WAITQUEUE(wait, current); unsigned long flags; - if (!(raw->port.flags & ASYNC_INITIALIZED) || - (raw->flags & RAW3215_FIXED)) + if (!(raw->port.flags & ASYNC_INITIALIZED)) return; /* Wait for outstanding requests, then free irq */ spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); @@ -677,6 +677,7 @@ static void raw3215_free_info(struct raw3215_info *raw) { kfree(raw->inbuf); kfree(raw->buffer); + tty_port_destroy(&raw->port); kfree(raw); } @@ -926,8 +927,6 @@ static int __init con3215_init(void) dev_set_drvdata(&cdev->dev, raw); cdev->handler = raw3215_irq; - raw->flags |= RAW3215_FIXED; - /* Request the console irq */ if (raw3215_startup(raw) != 0) { raw3215_free_info(raw); diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h index d7e97ae9ef6..25bcd4c0ed8 100644 --- a/drivers/s390/char/sclp.h +++ b/drivers/s390/char/sclp.h @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 1999, 2009 + * Copyright IBM Corp. 1999,2012 * * Author(s): Martin Peschke <mpeschke@de.ibm.com> * Martin Schwidefsky <schwidefsky@de.ibm.com> @@ -103,6 +103,7 @@ extern u64 sclp_facilities; #define SCLP_HAS_CHP_RECONFIG (sclp_facilities & 0x2000000000000000ULL) #define SCLP_HAS_CPU_INFO (sclp_facilities & 0x0800000000000000ULL) #define SCLP_HAS_CPU_RECONFIG (sclp_facilities & 0x0400000000000000ULL) +#define SCLP_HAS_PCI_RECONFIG (sclp_facilities & 0x0000000040000000ULL) struct gds_subvector { diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 71ea923c322..c44d13f607b 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007, 2009 + * Copyright IBM Corp. 2007,2012 * * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, * Peter Oberparleiter <peter.oberparleiter@de.ibm.com> @@ -12,6 +12,7 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/err.h> +#include <linux/export.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/mm.h> @@ -19,10 +20,11 @@ #include <linux/memory.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <asm/ctl_reg.h> #include <asm/chpid.h> -#include <asm/sclp.h> #include <asm/setup.h> -#include <asm/ctl_reg.h> +#include <asm/page.h> +#include <asm/sclp.h> #include "sclp.h" @@ -400,17 +402,15 @@ out: static int sclp_assign_storage(u16 rn) { - unsigned long long start, address; + unsigned long long start; int rc; rc = do_assign_storage(0x000d0001, rn); if (rc) - goto out; - start = address = rn2addr(rn); - for (; address < start + rzm; address += PAGE_SIZE) - page_set_storage_key(address, PAGE_DEFAULT_KEY, 0); -out: - return rc; + return rc; + start = rn2addr(rn); + storage_key_init_range(start, start + rzm); + return 0; } static int sclp_unassign_storage(u16 rn) @@ -702,6 +702,67 @@ __initcall(sclp_detect_standby_memory); #endif /* CONFIG_MEMORY_HOTPLUG */ /* + * PCI I/O adapter configuration related functions. + */ +#define SCLP_CMDW_CONFIGURE_PCI 0x001a0001 +#define SCLP_CMDW_DECONFIGURE_PCI 0x001b0001 + +#define SCLP_RECONFIG_PCI_ATPYE 2 + +struct pci_cfg_sccb { + struct sccb_header header; + u8 atype; /* adapter type */ + u8 reserved1; + u16 reserved2; + u32 aid; /* adapter identifier */ +} __packed; + +static int do_pci_configure(sclp_cmdw_t cmd, u32 fid) +{ + struct pci_cfg_sccb *sccb; + int rc; + + if (!SCLP_HAS_PCI_RECONFIG) + return -EOPNOTSUPP; + + sccb = (struct pci_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); + if (!sccb) + return -ENOMEM; + + sccb->header.length = PAGE_SIZE; + sccb->atype = SCLP_RECONFIG_PCI_ATPYE; + sccb->aid = fid; + rc = do_sync_request(cmd, sccb); + if (rc) + goto out; + switch (sccb->header.response_code) { + case 0x0020: + case 0x0120: + break; + default: + pr_warn("configure PCI I/O adapter failed: cmd=0x%08x response=0x%04x\n", + cmd, sccb->header.response_code); + rc = -EIO; + break; + } +out: + free_page((unsigned long) sccb); + return rc; +} + +int sclp_pci_configure(u32 fid) +{ + return do_pci_configure(SCLP_CMDW_CONFIGURE_PCI, fid); +} +EXPORT_SYMBOL(sclp_pci_configure); + +int sclp_pci_deconfigure(u32 fid) +{ + return do_pci_configure(SCLP_CMDW_DECONFIGURE_PCI, fid); +} +EXPORT_SYMBOL(sclp_pci_deconfigure); + +/* * Channel path configuration related functions. */ diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 30ec09e3d03..877fbc37c1e 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -547,7 +547,6 @@ sclp_tty_init(void) sclp_tty_tolower = 1; } sclp_tty_chars_count = 0; - tty_port_init(&sclp_port); rc = sclp_register(&sclp_input_event); if (rc) { @@ -555,6 +554,8 @@ sclp_tty_init(void) return rc; } + tty_port_init(&sclp_port); + driver->driver_name = "sclp_line"; driver->name = "sclp_line"; driver->major = TTY_MAJOR; @@ -571,6 +572,7 @@ sclp_tty_init(void) rc = tty_register_driver(driver); if (rc) { put_tty_driver(driver); + tty_port_destroy(&sclp_port); return rc; } sclp_tty_driver = driver; diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 7e60f3d2f3f..effcc8756e0 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -615,6 +615,7 @@ static void __init __sclp_vt220_cleanup(void) return; sclp_unregister(&sclp_vt220_register); __sclp_vt220_free_pages(); + tty_port_destroy(&sclp_vt220_port); } /* Allocate buffer pages and register with sclp core. Controlled by init @@ -650,6 +651,7 @@ out: if (rc) { __sclp_vt220_free_pages(); sclp_vt220_init_count--; + tty_port_destroy(&sclp_vt220_port); } return rc; } diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 482ee028f84..43ea0593bdb 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c @@ -722,6 +722,7 @@ out_pages: while (pages--) free_pages((unsigned long) tp->freemem_pages[pages], 0); kfree(tp->freemem_pages); + tty_port_destroy(&tp->port); out_tp: kfree(tp); out_err: @@ -744,6 +745,7 @@ tty3270_free_view(struct tty3270 *tp) for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) free_pages((unsigned long) tp->freemem_pages[pages], 0); kfree(tp->freemem_pages); + tty_port_destroy(&tp->port); kfree(tp); } diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 731470e6849..84846c2b96d 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -65,10 +65,18 @@ static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev) } } -static int ccwgroup_set_online(struct ccwgroup_device *gdev) +/** + * ccwgroup_set_online() - enable a ccwgroup device + * @gdev: target ccwgroup device + * + * This function attempts to put the ccwgroup device into the online state. + * Returns: + * %0 on success and a negative error value on failure. + */ +int ccwgroup_set_online(struct ccwgroup_device *gdev) { struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); - int ret = 0; + int ret = -EINVAL; if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) return -EAGAIN; @@ -84,11 +92,20 @@ out: atomic_set(&gdev->onoff, 0); return ret; } +EXPORT_SYMBOL(ccwgroup_set_online); -static int ccwgroup_set_offline(struct ccwgroup_device *gdev) +/** + * ccwgroup_set_offline() - disable a ccwgroup device + * @gdev: target ccwgroup device + * + * This function attempts to put the ccwgroup device into the offline state. + * Returns: + * %0 on success and a negative error value on failure. + */ +int ccwgroup_set_offline(struct ccwgroup_device *gdev) { struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); - int ret = 0; + int ret = -EINVAL; if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) return -EAGAIN; @@ -104,6 +121,7 @@ out: atomic_set(&gdev->onoff, 0); return ret; } +EXPORT_SYMBOL(ccwgroup_set_offline); static ssize_t ccwgroup_online_store(struct device *dev, struct device_attribute *attr, diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 4d51a7c4eb8..68e80e2734a 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -1,7 +1,7 @@ /* * S/390 common I/O routines -- channel subsystem call * - * Copyright IBM Corp. 1999, 2010 + * Copyright IBM Corp. 1999,2012 * Author(s): Ingo Adlung (adlung@de.ibm.com) * Cornelia Huck (cornelia.huck@de.ibm.com) * Arnd Bergmann (arndb@de.ibm.com) @@ -14,6 +14,7 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/device.h> +#include <linux/pci.h> #include <asm/cio.h> #include <asm/chpid.h> @@ -260,26 +261,45 @@ __get_chpid_from_lir(void *data) return (u16) (lir->indesc[0]&0x000000ff); } -struct chsc_sei_area { - struct chsc_header request; +struct chsc_sei_nt0_area { + u8 flags; + u8 vf; /* validity flags */ + u8 rs; /* reporting source */ + u8 cc; /* content code */ + u16 fla; /* full link address */ + u16 rsid; /* reporting source id */ u32 reserved1; u32 reserved2; - u32 reserved3; - struct chsc_header response; - u32 reserved4; - u8 flags; - u8 vf; /* validity flags */ - u8 rs; /* reporting source */ - u8 cc; /* content code */ - u16 fla; /* full link address */ - u16 rsid; /* reporting source id */ - u32 reserved5; - u32 reserved6; - u8 ccdf[4096 - 16 - 24]; /* content-code dependent field */ /* ccdf has to be big enough for a link-incident record */ -} __attribute__ ((packed)); - -static void chsc_process_sei_link_incident(struct chsc_sei_area *sei_area) + u8 ccdf[PAGE_SIZE - 24 - 16]; /* content-code dependent field */ +} __packed; + +struct chsc_sei_nt2_area { + u8 flags; /* p and v bit */ + u8 reserved1; + u8 reserved2; + u8 cc; /* content code */ + u32 reserved3[13]; + u8 ccdf[PAGE_SIZE - 24 - 56]; /* content-code dependent field */ +} __packed; + +#define CHSC_SEI_NT0 0ULL +#define CHSC_SEI_NT2 (1ULL << 61) + +struct chsc_sei { + struct chsc_header request; + u32 reserved1; + u64 ntsm; /* notification type mask */ + struct chsc_header response; + u32 reserved2; + union { + struct chsc_sei_nt0_area nt0_area; + struct chsc_sei_nt2_area nt2_area; + u8 nt_area[PAGE_SIZE - 24]; + } u; +} __packed; + +static void chsc_process_sei_link_incident(struct chsc_sei_nt0_area *sei_area) { struct chp_id chpid; int id; @@ -298,7 +318,7 @@ static void chsc_process_sei_link_incident(struct chsc_sei_area *sei_area) } } -static void chsc_process_sei_res_acc(struct chsc_sei_area *sei_area) +static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area) { struct chp_link link; struct chp_id chpid; @@ -330,7 +350,7 @@ static void chsc_process_sei_res_acc(struct chsc_sei_area *sei_area) s390_process_res_acc(&link); } -static void chsc_process_sei_chp_avail(struct chsc_sei_area *sei_area) +static void chsc_process_sei_chp_avail(struct chsc_sei_nt0_area *sei_area) { struct channel_path *chp; struct chp_id chpid; @@ -366,7 +386,7 @@ struct chp_config_data { u8 pc; }; -static void chsc_process_sei_chp_config(struct chsc_sei_area *sei_area) +static void chsc_process_sei_chp_config(struct chsc_sei_nt0_area *sei_area) { struct chp_config_data *data; struct chp_id chpid; @@ -398,7 +418,7 @@ static void chsc_process_sei_chp_config(struct chsc_sei_area *sei_area) } } -static void chsc_process_sei_scm_change(struct chsc_sei_area *sei_area) +static void chsc_process_sei_scm_change(struct chsc_sei_nt0_area *sei_area) { int ret; @@ -412,13 +432,26 @@ static void chsc_process_sei_scm_change(struct chsc_sei_area *sei_area) " failed (rc=%d).\n", ret); } -static void chsc_process_sei(struct chsc_sei_area *sei_area) +static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) { - /* Check if we might have lost some information. */ - if (sei_area->flags & 0x40) { - CIO_CRW_EVENT(2, "chsc: event overflow\n"); - css_schedule_eval_all(); +#ifdef CONFIG_PCI + switch (sei_area->cc) { + case 1: + zpci_event_error(sei_area->ccdf); + break; + case 2: + zpci_event_availability(sei_area->ccdf); + break; + default: + CIO_CRW_EVENT(2, "chsc: unhandled sei content code %d\n", + sei_area->cc); + break; } +#endif +} + +static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) +{ /* which kind of information was stored? */ switch (sei_area->cc) { case 1: /* link incident*/ @@ -443,9 +476,51 @@ static void chsc_process_sei(struct chsc_sei_area *sei_area) } } +static int __chsc_process_crw(struct chsc_sei *sei, u64 ntsm) +{ + do { + memset(sei, 0, sizeof(*sei)); + sei->request.length = 0x0010; + sei->request.code = 0x000e; + sei->ntsm = ntsm; + + if (chsc(sei)) + break; + + if (sei->response.code == 0x0001) { + CIO_CRW_EVENT(2, "chsc: sei successful\n"); + + /* Check if we might have lost some information. */ + if (sei->u.nt0_area.flags & 0x40) { + CIO_CRW_EVENT(2, "chsc: event overflow\n"); + css_schedule_eval_all(); + } + + switch (sei->ntsm) { + case CHSC_SEI_NT0: + chsc_process_sei_nt0(&sei->u.nt0_area); + return 1; + case CHSC_SEI_NT2: + chsc_process_sei_nt2(&sei->u.nt2_area); + return 1; + default: + CIO_CRW_EVENT(2, "chsc: unhandled nt (nt=%08Lx)\n", + sei->ntsm); + return 0; + } + } else { + CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", + sei->response.code); + break; + } + } while (sei->u.nt0_area.flags & 0x80); + + return 0; +} + static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow) { - struct chsc_sei_area *sei_area; + struct chsc_sei *sei; if (overflow) { css_schedule_eval_all(); @@ -459,25 +534,18 @@ static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow) return; /* Access to sei_page is serialized through machine check handler * thread, so no need for locking. */ - sei_area = sei_page; + sei = sei_page; CIO_TRACE_EVENT(2, "prcss"); - do { - memset(sei_area, 0, sizeof(*sei_area)); - sei_area->request.length = 0x0010; - sei_area->request.code = 0x000e; - if (chsc(sei_area)) - break; - if (sei_area->response.code == 0x0001) { - CIO_CRW_EVENT(4, "chsc: sei successful\n"); - chsc_process_sei(sei_area); - } else { - CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", - sei_area->response.code); - break; - } - } while (sei_area->flags & 0x80); + /* + * The ntsm does not allow to select NT0 and NT2 together. We need to + * first check for NT2, than additionally for NT0... + */ +#ifdef CONFIG_PCI + if (!__chsc_process_crw(sei, CHSC_SEI_NT2)) +#endif + __chsc_process_crw(sei, CHSC_SEI_NT0); } void chsc_chp_online(struct chp_id chpid) diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index b4d572f65f0..fd00afd8b85 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -377,7 +377,11 @@ static int css_evaluate_new_subchannel(struct subchannel_id schid, int slow) /* Will be done on the slow path. */ return -EAGAIN; } - if (stsch_err(schid, &schib) || !css_sch_is_valid(&schib)) { + if (stsch_err(schid, &schib)) { + /* Subchannel is not provided. */ + return -ENXIO; + } + if (!css_sch_is_valid(&schib)) { /* Unusable - ignore. */ return 0; } @@ -536,6 +540,7 @@ static int slow_eval_unknown_fn(struct subchannel_id schid, void *data) case -ENOMEM: case -EIO: /* These should abort looping */ + idset_sch_del_subseq(slow_subchannel_set, schid); break; default: rc = 0; diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 33bb4d891e1..4af3dfe70ef 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h @@ -112,9 +112,6 @@ extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); extern void css_reiterate_subchannels(void); void css_update_ssd_info(struct subchannel *sch); -#define __MAX_SUBCHANNEL 65535 -#define __MAX_SSID 3 - struct channel_subsystem { u8 cssid; int valid; diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index fc916f5d731..6995cff4463 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1424,7 +1424,7 @@ static enum io_sch_action sch_get_action(struct subchannel *sch) } if (device_is_disconnected(cdev)) return IO_SCH_REPROBE; - if (cdev->online) + if (cdev->online && !cdev->private->flags.resuming) return IO_SCH_VERIFY; if (cdev->private->state == DEV_STATE_NOT_OPER) return IO_SCH_UNREG_ATTACH; @@ -1469,12 +1469,6 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process) rc = 0; goto out_unlock; case IO_SCH_VERIFY: - if (cdev->private->flags.resuming == 1) { - if (cio_enable_subchannel(sch, (u32)(addr_t)sch)) { - ccw_device_set_notoper(cdev); - break; - } - } /* Trigger path verification. */ io_subchannel_verify(sch); rc = 0; @@ -2042,16 +2036,6 @@ void ccw_driver_unregister(struct ccw_driver *cdriver) driver_unregister(&cdriver->driver); } -/* Helper func for qdio. */ -struct subchannel_id -ccw_device_get_subchannel_id(struct ccw_device *cdev) -{ - struct subchannel *sch; - - sch = to_subchannel(cdev->dev.parent); - return sch->schid; -} - static void ccw_device_todo(struct work_struct *work) { struct ccw_device_private *priv; @@ -2144,4 +2128,3 @@ EXPORT_SYMBOL(ccw_device_set_offline); EXPORT_SYMBOL(ccw_driver_register); EXPORT_SYMBOL(ccw_driver_unregister); EXPORT_SYMBOL(get_ccwdev_by_busid); -EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h index 6bace694239..2e575cff984 100644 --- a/drivers/s390/cio/device.h +++ b/drivers/s390/cio/device.h @@ -142,9 +142,7 @@ int ccw_device_notify(struct ccw_device *, int); void ccw_device_set_disconnected(struct ccw_device *cdev); void ccw_device_set_notoper(struct ccw_device *cdev); -/* qdio needs this. */ void ccw_device_set_timeout(struct ccw_device *, int); -extern struct subchannel_id ccw_device_get_subchannel_id(struct ccw_device *); /* Channel measurement facility related */ void retry_set_schib(struct ccw_device *cdev); diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index ec7fb6d3b47..c77b6e06bf6 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c @@ -755,14 +755,18 @@ int ccw_device_tm_intrg(struct ccw_device *cdev) } EXPORT_SYMBOL(ccw_device_tm_intrg); -// FIXME: these have to go: - -int -_ccw_device_get_subchannel_number(struct ccw_device *cdev) +/** + * ccw_device_get_schid - obtain a subchannel id + * @cdev: device to obtain the id for + * @schid: where to fill in the values + */ +void ccw_device_get_schid(struct ccw_device *cdev, struct subchannel_id *schid) { - return cdev->private->schid.sch_no; -} + struct subchannel *sch = to_subchannel(cdev->dev.parent); + *schid = sch->schid; +} +EXPORT_SYMBOL_GPL(ccw_device_get_schid); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(ccw_device_set_options_mask); @@ -777,5 +781,4 @@ EXPORT_SYMBOL(ccw_device_start_timeout_key); EXPORT_SYMBOL(ccw_device_start_key); EXPORT_SYMBOL(ccw_device_get_ciw); EXPORT_SYMBOL(ccw_device_get_path_mask); -EXPORT_SYMBOL(_ccw_device_get_subchannel_number); EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index 368368fe04b..908d287f66c 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c @@ -234,7 +234,7 @@ static int pgid_cmp(struct pgid *p1, struct pgid *p2) * Determine pathgroup state from PGID data. */ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, - int *mismatch, int *reserved, u8 *reset) + int *mismatch, u8 *reserved, u8 *reset) { struct pgid *pgid = &cdev->private->pgid[0]; struct pgid *first = NULL; @@ -248,7 +248,7 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, if ((cdev->private->pgid_valid_mask & lpm) == 0) continue; if (pgid->inf.ps.state2 == SNID_STATE2_RESVD_ELSE) - *reserved = 1; + *reserved |= lpm; if (pgid_is_reset(pgid)) { *reset |= lpm; continue; @@ -316,14 +316,14 @@ static void snid_done(struct ccw_device *cdev, int rc) struct subchannel *sch = to_subchannel(cdev->dev.parent); struct pgid *pgid; int mismatch = 0; - int reserved = 0; + u8 reserved = 0; u8 reset = 0; u8 donepm; if (rc) goto out; pgid_analyze(cdev, &pgid, &mismatch, &reserved, &reset); - if (reserved) + if (reserved == cdev->private->pgid_valid_mask) rc = -EUSERS; else if (mismatch) rc = -EOPNOTSUPP; @@ -336,7 +336,7 @@ static void snid_done(struct ccw_device *cdev, int rc) } out: CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " - "todo=%02x mism=%d rsvd=%d reset=%02x\n", id->ssid, + "todo=%02x mism=%d rsvd=%02x reset=%02x\n", id->ssid, id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm, cdev->private->pgid_todo_mask, mismatch, reserved, reset); switch (rc) { diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c index e6d5f8c4952..65d13e38803 100644 --- a/drivers/s390/cio/idset.c +++ b/drivers/s390/cio/idset.c @@ -1,9 +1,10 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2012 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> */ #include <linux/vmalloc.h> +#include <linux/bitmap.h> #include <linux/bitops.h> #include "idset.h" #include "css.h" @@ -89,6 +90,14 @@ void idset_sch_del(struct idset *set, struct subchannel_id schid) idset_del(set, schid.ssid, schid.sch_no); } +/* Clear ids starting from @schid up to end of subchannel set. */ +void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid) +{ + int pos = schid.ssid * set->num_id + schid.sch_no; + + bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no); +} + int idset_sch_contains(struct idset *set, struct subchannel_id schid) { return idset_contains(set, schid.ssid, schid.sch_no); @@ -111,20 +120,12 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid) int idset_is_empty(struct idset *set) { - int bitnum; - - bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id); - if (bitnum >= set->num_ssid * set->num_id) - return 1; - return 0; + return bitmap_empty(set->bitmap, set->num_ssid * set->num_id); } void idset_add_set(struct idset *to, struct idset *from) { - unsigned long i, len; + int len = min(to->num_ssid * to->num_id, from->num_ssid * from->num_id); - len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), - __BITOPS_WORDS(from->num_ssid * from->num_id)); - for (i = 0; i < len ; i++) - to->bitmap[i] |= from->bitmap[i]; + bitmap_or(to->bitmap, to->bitmap, from->bitmap, len); } diff --git a/drivers/s390/cio/idset.h b/drivers/s390/cio/idset.h index 3d943f03591..06d3bc01bb0 100644 --- a/drivers/s390/cio/idset.h +++ b/drivers/s390/cio/idset.h @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2012 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> */ @@ -17,6 +17,7 @@ void idset_fill(struct idset *set); struct idset *idset_sch_new(void); void idset_sch_add(struct idset *set, struct subchannel_id id); void idset_sch_del(struct idset *set, struct subchannel_id id); +void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid); int idset_sch_contains(struct idset *set, struct subchannel_id id); int idset_sch_get_first(struct idset *set, struct subchannel_id *id); int idset_is_empty(struct idset *set); diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index e06fa03ea1e..1671d3461f2 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -129,7 +129,6 @@ static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state, int rc, tmp_count = count, tmp_start = start, nr = q->nr, retried = 0; unsigned int ccq = 0; - BUG_ON(!q->irq_ptr->sch_token); qperf_inc(q, eqbs); if (!q->is_input_q) @@ -147,7 +146,6 @@ again: } if (rc == 2) { - BUG_ON(tmp_count == count); qperf_inc(q, eqbs_partial); DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS part:%02x", tmp_count); @@ -189,8 +187,6 @@ static int qdio_do_sqbs(struct qdio_q *q, unsigned char state, int start, if (!count) return 0; - - BUG_ON(!q->irq_ptr->sch_token); qperf_inc(q, sqbs); if (!q->is_input_q) @@ -199,7 +195,7 @@ again: ccq = do_sqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count); rc = qdio_check_ccq(q, ccq); if (!rc) { - WARN_ON(tmp_count); + WARN_ON_ONCE(tmp_count); return count - tmp_count; } @@ -224,9 +220,6 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr, unsigned char __state = 0; int i; - BUG_ON(bufnr > QDIO_MAX_BUFFERS_MASK); - BUG_ON(count > QDIO_MAX_BUFFERS_PER_Q); - if (is_qebsm(q)) return qdio_do_eqbs(q, state, bufnr, count, auto_ack); @@ -258,9 +251,6 @@ static inline int set_buf_states(struct qdio_q *q, int bufnr, { int i; - BUG_ON(bufnr > QDIO_MAX_BUFFERS_MASK); - BUG_ON(count > QDIO_MAX_BUFFERS_PER_Q); - if (is_qebsm(q)) return qdio_do_sqbs(q, state, bufnr, count); @@ -345,7 +335,6 @@ again: /* hipersocket busy condition */ if (unlikely(*busy_bit)) { - WARN_ON(queue_type(q) != QDIO_IQDIO_QFMT || cc != 2); retries++; if (!start_time) { @@ -559,7 +548,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q) DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in nop"); break; default: - BUG(); + WARN_ON_ONCE(1); } out: return q->first_to_check; @@ -678,12 +667,10 @@ static inline void qdio_handle_aobs(struct qdio_q *q, int start, int count) if (aob == NULL) continue; - BUG_ON(q->u.out.sbal_state == NULL); q->u.out.sbal_state[b].flags |= QDIO_OUTBUF_STATE_FLAG_PENDING; q->u.out.aobs[b] = NULL; } else if (state == SLSB_P_OUTPUT_EMPTY) { - BUG_ON(q->u.out.sbal_state == NULL); q->u.out.sbal_state[b].aob = NULL; } b = next_buf(b); @@ -703,12 +690,11 @@ static inline unsigned long qdio_aob_for_buffer(struct qdio_output_q *q, q->aobs[bufnr] = aob; } if (q->aobs[bufnr]) { - BUG_ON(q->sbal_state == NULL); q->sbal_state[bufnr].flags = QDIO_OUTBUF_STATE_FLAG_NONE; q->sbal_state[bufnr].aob = q->aobs[bufnr]; q->aobs[bufnr]->user1 = (u64) q->sbal_state[bufnr].user; phys_aob = virt_to_phys(q->aobs[bufnr]); - BUG_ON(phys_aob & 0xFF); + WARN_ON_ONCE(phys_aob & 0xFF); } out: @@ -809,8 +795,6 @@ static int get_outbound_buffer_frontier(struct qdio_q *q) goto out; switch (state) { - case SLSB_P_OUTPUT_PENDING: - BUG(); case SLSB_P_OUTPUT_EMPTY: /* the adapter got it */ DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, @@ -840,7 +824,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q) case SLSB_P_OUTPUT_HALTED: break; default: - BUG(); + WARN_ON_ONCE(1); } out: @@ -912,7 +896,7 @@ retry: static void __qdio_outbound_processing(struct qdio_q *q) { qperf_inc(q, tasklet_outbound); - BUG_ON(atomic_read(&q->nr_buf_used) < 0); + WARN_ON_ONCE(atomic_read(&q->nr_buf_used) < 0); if (qdio_outbound_q_moved(q)) qdio_kick_handler(q); @@ -1138,16 +1122,10 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, irq_ptr->perf_stat.qdio_int++; if (IS_ERR(irb)) { - switch (PTR_ERR(irb)) { - case -EIO: - DBF_ERROR("%4x IO error", irq_ptr->schid.sch_no); - qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR); - wake_up(&cdev->private->wait_q); - return; - default: - WARN_ON(1); - return; - } + DBF_ERROR("%4x IO error", irq_ptr->schid.sch_no); + qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR); + wake_up(&cdev->private->wait_q); + return; } qdio_irq_check_sense(irq_ptr, irb); cstat = irb->scsw.cmd.cstat; @@ -1173,7 +1151,7 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, case QDIO_IRQ_STATE_STOPPED: break; default: - WARN_ON(1); + WARN_ON_ONCE(1); } wake_up(&cdev->private->wait_q); } @@ -1227,7 +1205,7 @@ int qdio_shutdown(struct ccw_device *cdev, int how) if (!irq_ptr) return -ENODEV; - BUG_ON(irqs_disabled()); + WARN_ON_ONCE(irqs_disabled()); DBF_EVENT("qshutdown:%4x", cdev->private->schid.sch_no); mutex_lock(&irq_ptr->setup_mutex); @@ -1358,7 +1336,6 @@ int qdio_allocate(struct qdio_initialize *init_data) irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!irq_ptr->qdr) goto out_rel; - WARN_ON((unsigned long)irq_ptr->qdr & 0xfff); if (qdio_allocate_qs(irq_ptr, init_data->no_input_qs, init_data->no_output_qs)) @@ -1597,9 +1574,7 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags, set: count = set_buf_states(q, bufnr, SLSB_CU_INPUT_EMPTY, count); - used = atomic_add_return(count, &q->nr_buf_used) - count; - BUG_ON(used + count > QDIO_MAX_BUFFERS_PER_Q); if (need_siga_in(q)) return qdio_siga_input(q); @@ -1624,7 +1599,6 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags, count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count); used = atomic_add_return(count, &q->nr_buf_used); - BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q); if (used == QDIO_MAX_BUFFERS_PER_Q) qperf_inc(q, outbound_queue_full); @@ -1678,7 +1652,6 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags, { struct qdio_irq *irq_ptr; - if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q) return -EINVAL; @@ -1721,8 +1694,6 @@ int qdio_start_irq(struct ccw_device *cdev, int nr) return -ENODEV; q = irq_ptr->input_qs[nr]; - WARN_ON(queue_irqs_enabled(q)); - clear_nonshared_ind(irq_ptr); qdio_stop_polling(q); clear_bit(QDIO_QUEUE_IRQS_DISABLED, &q->u.in.queue_irq_state); @@ -1769,7 +1740,6 @@ int qdio_get_next_buffers(struct ccw_device *cdev, int nr, int *bufnr, if (!irq_ptr) return -ENODEV; q = irq_ptr->input_qs[nr]; - WARN_ON(queue_irqs_enabled(q)); /* * Cannot rely on automatic sync after interrupt since queues may diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c index 6c973db1498..16ecd35b8e5 100644 --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c @@ -140,10 +140,8 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, q->sl = (struct sl *)((char *)q->slib + PAGE_SIZE / 2); /* fill in sbal */ - for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) { + for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) q->sbal[j] = *sbals_array++; - BUG_ON((unsigned long)q->sbal[j] & 0xff); - } /* fill in slib */ if (i > 0) { @@ -434,9 +432,8 @@ int qdio_setup_irq(struct qdio_initialize *init_data) irq_ptr->int_parm = init_data->int_parm; irq_ptr->nr_input_qs = init_data->no_input_qs; irq_ptr->nr_output_qs = init_data->no_output_qs; - - irq_ptr->schid = ccw_device_get_subchannel_id(init_data->cdev); irq_ptr->cdev = init_data->cdev; + ccw_device_get_schid(irq_ptr->cdev, &irq_ptr->schid); setup_queues(irq_ptr, init_data); setup_qib(irq_ptr, init_data); @@ -483,7 +480,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr, char s[80]; snprintf(s, 80, "qdio: %s %s on SC %x using " - "AI:%d QEBSM:%d PCI:%d TDD:%d SIGA:%s%s%s%s%s\n", + "AI:%d QEBSM:%d PRI:%d TDD:%d SIGA:%s%s%s%s%s\n", dev_name(&cdev->dev), (irq_ptr->qib.qfmt == QDIO_QETH_QFMT) ? "OSA" : ((irq_ptr->qib.qfmt == QDIO_ZFCP_QFMT) ? "ZFCP" : "HS"), diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 2e060088fa8..bdb394b066f 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c @@ -73,7 +73,6 @@ static void put_indicator(u32 *addr) void tiqdio_add_input_queues(struct qdio_irq *irq_ptr) { mutex_lock(&tiq_list_lock); - BUG_ON(irq_ptr->nr_input_qs < 1); list_add_rcu(&irq_ptr->input_qs[0]->entry, &tiq_list); mutex_unlock(&tiq_list_lock); xchg(irq_ptr->dsci, 1 << 7); @@ -83,7 +82,6 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) { struct qdio_q *q; - BUG_ON(irq_ptr->nr_input_qs < 1); q = irq_ptr->input_qs[0]; /* if establish triggered an error */ if (!q || !q->entry.prev || !q->entry.next) diff --git a/drivers/s390/crypto/zcrypt_msgtype50.c b/drivers/s390/crypto/zcrypt_msgtype50.c index 035b6dc31b7..7c522f338bd 100644 --- a/drivers/s390/crypto/zcrypt_msgtype50.c +++ b/drivers/s390/crypto/zcrypt_msgtype50.c @@ -241,84 +241,70 @@ static int ICACRT_msg_to_type50CRT_msg(struct zcrypt_device *zdev, struct ap_message *ap_msg, struct ica_rsa_modexpo_crt *crt) { - int mod_len, short_len, long_len, long_offset, limit; + int mod_len, short_len; unsigned char *p, *q, *dp, *dq, *u, *inp; mod_len = crt->inputdatalength; short_len = mod_len / 2; - long_len = mod_len / 2 + 8; /* - * CEX2A cannot handle p, dp, or U > 128 bytes. - * If we have one of these, we need to do extra checking. - * For CEX3A the limit is 256 bytes. + * CEX2A and CEX3A w/o FW update can handle requests up to + * 256 byte modulus (2k keys). + * CEX3A with FW update and CEX4A cards are able to handle + * 512 byte modulus (4k keys). */ - if (zdev->max_mod_size == CEX3A_MAX_MOD_SIZE) - limit = 256; - else - limit = 128; - - if (long_len > limit) { - /* - * zcrypt_rsa_crt already checked for the leading - * zeroes of np_prime, bp_key and u_mult_inc. - */ - long_offset = long_len - limit; - long_len = limit; - } else - long_offset = 0; - - /* - * Instead of doing extra work for p, dp, U > 64 bytes, we'll just use - * the larger message structure. - */ - if (long_len <= 64) { + if (mod_len <= 128) { /* up to 1024 bit key size */ struct type50_crb1_msg *crb1 = ap_msg->message; memset(crb1, 0, sizeof(*crb1)); ap_msg->length = sizeof(*crb1); crb1->header.msg_type_code = TYPE50_TYPE_CODE; crb1->header.msg_len = sizeof(*crb1); crb1->keyblock_type = TYPE50_CRB1_FMT; - p = crb1->p + sizeof(crb1->p) - long_len; + p = crb1->p + sizeof(crb1->p) - short_len; q = crb1->q + sizeof(crb1->q) - short_len; - dp = crb1->dp + sizeof(crb1->dp) - long_len; + dp = crb1->dp + sizeof(crb1->dp) - short_len; dq = crb1->dq + sizeof(crb1->dq) - short_len; - u = crb1->u + sizeof(crb1->u) - long_len; + u = crb1->u + sizeof(crb1->u) - short_len; inp = crb1->message + sizeof(crb1->message) - mod_len; - } else if (long_len <= 128) { + } else if (mod_len <= 256) { /* up to 2048 bit key size */ struct type50_crb2_msg *crb2 = ap_msg->message; memset(crb2, 0, sizeof(*crb2)); ap_msg->length = sizeof(*crb2); crb2->header.msg_type_code = TYPE50_TYPE_CODE; crb2->header.msg_len = sizeof(*crb2); crb2->keyblock_type = TYPE50_CRB2_FMT; - p = crb2->p + sizeof(crb2->p) - long_len; + p = crb2->p + sizeof(crb2->p) - short_len; q = crb2->q + sizeof(crb2->q) - short_len; - dp = crb2->dp + sizeof(crb2->dp) - long_len; + dp = crb2->dp + sizeof(crb2->dp) - short_len; dq = crb2->dq + sizeof(crb2->dq) - short_len; - u = crb2->u + sizeof(crb2->u) - long_len; + u = crb2->u + sizeof(crb2->u) - short_len; inp = crb2->message + sizeof(crb2->message) - mod_len; - } else { - /* long_len >= 256 */ + } else if ((mod_len <= 512) && /* up to 4096 bit key size */ + (zdev->max_mod_size == CEX3A_MAX_MOD_SIZE)) { /* >= CEX3A */ struct type50_crb3_msg *crb3 = ap_msg->message; memset(crb3, 0, sizeof(*crb3)); ap_msg->length = sizeof(*crb3); crb3->header.msg_type_code = TYPE50_TYPE_CODE; crb3->header.msg_len = sizeof(*crb3); crb3->keyblock_type = TYPE50_CRB3_FMT; - p = crb3->p + sizeof(crb3->p) - long_len; + p = crb3->p + sizeof(crb3->p) - short_len; q = crb3->q + sizeof(crb3->q) - short_len; - dp = crb3->dp + sizeof(crb3->dp) - long_len; + dp = crb3->dp + sizeof(crb3->dp) - short_len; dq = crb3->dq + sizeof(crb3->dq) - short_len; - u = crb3->u + sizeof(crb3->u) - long_len; + u = crb3->u + sizeof(crb3->u) - short_len; inp = crb3->message + sizeof(crb3->message) - mod_len; - } + } else + return -EINVAL; - if (copy_from_user(p, crt->np_prime + long_offset, long_len) || + /* + * correct the offset of p, bp and mult_inv according zcrypt.h + * block size right aligned (skip the first byte) + */ + if (copy_from_user(p, crt->np_prime + MSGTYPE_ADJUSTMENT, short_len) || copy_from_user(q, crt->nq_prime, short_len) || - copy_from_user(dp, crt->bp_key + long_offset, long_len) || + copy_from_user(dp, crt->bp_key + MSGTYPE_ADJUSTMENT, short_len) || copy_from_user(dq, crt->bq_key, short_len) || - copy_from_user(u, crt->u_mult_inv + long_offset, long_len) || + copy_from_user(u, crt->u_mult_inv + MSGTYPE_ADJUSTMENT, short_len) || copy_from_user(inp, crt->inputdata, mod_len)) return -EFAULT; diff --git a/drivers/s390/crypto/zcrypt_msgtype50.h b/drivers/s390/crypto/zcrypt_msgtype50.h index e56dc72c773..0a66e4aeeb5 100644 --- a/drivers/s390/crypto/zcrypt_msgtype50.h +++ b/drivers/s390/crypto/zcrypt_msgtype50.h @@ -33,6 +33,8 @@ #define MSGTYPE50_CRB2_MAX_MSG_SIZE 0x390 /*sizeof(struct type50_crb2_msg)*/ #define MSGTYPE50_CRB3_MAX_MSG_SIZE 0x710 /*sizeof(struct type50_crb3_msg)*/ +#define MSGTYPE_ADJUSTMENT 0x08 /*type04 extension (not needed in type50)*/ + int zcrypt_msgtype50_init(void); void zcrypt_msgtype50_exit(void); diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index a0a4afe537d..5c70a659957 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c @@ -3018,10 +3018,8 @@ claw_remove_device(struct ccwgroup_device *cgdev) { struct claw_privbk *priv; - BUG_ON(!cgdev); CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); priv = dev_get_drvdata(&cgdev->dev); - BUG_ON(!priv); dev_info(&cgdev->dev, " will be removed.\n"); if (cgdev->state == CCWGROUP_ONLINE) claw_shutdown_device(cgdev); diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 98ea9cc6f1a..817b68925dd 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -1691,8 +1691,6 @@ static void ctcm_remove_device(struct ccwgroup_device *cgdev) { struct ctcm_priv *priv = dev_get_drvdata(&cgdev->dev); - BUG_ON(priv == NULL); - CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "removing device %p, proto : %d", cgdev, priv->protocol); diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 05b734a2b5b..2dbc77b5137 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c @@ -1367,7 +1367,6 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) struct mpc_group *grp; struct channel *wch; - BUG_ON(dev == NULL); CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); priv = dev->ml_priv; @@ -1472,8 +1471,6 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) struct channel *wch; struct channel *rch; - BUG_ON(dev == NULL); - priv = dev->ml_priv; grp = priv->mpcg; wch = priv->channel[CTCM_WRITE]; diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index fa7adad6f9b..480fbeab025 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -933,6 +933,7 @@ int qeth_hdr_chk_and_bounce(struct sk_buff *, int); int qeth_configure_cq(struct qeth_card *, enum qeth_cq); int qeth_hw_trap(struct qeth_card *, enum qeth_diags_trap_action); int qeth_query_ipassists(struct qeth_card *, enum qeth_prot_versions prot); +void qeth_trace_features(struct qeth_card *); /* exports for OSN */ int qeth_osn_assist(struct net_device *, void *, int); diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 3e25d315045..638a57f4d8a 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -73,13 +73,13 @@ static inline const char *qeth_get_cardname(struct qeth_card *card) if (card->info.guestlan) { switch (card->info.type) { case QETH_CARD_TYPE_OSD: - return " Guest LAN QDIO"; + return " Virtual NIC QDIO"; case QETH_CARD_TYPE_IQD: - return " Guest LAN Hiper"; + return " Virtual NIC Hiper"; case QETH_CARD_TYPE_OSM: - return " Guest LAN QDIO - OSM"; + return " Virtual NIC QDIO - OSM"; case QETH_CARD_TYPE_OSX: - return " Guest LAN QDIO - OSX"; + return " Virtual NIC QDIO - OSX"; default: return " unknown"; } @@ -108,13 +108,13 @@ const char *qeth_get_cardname_short(struct qeth_card *card) if (card->info.guestlan) { switch (card->info.type) { case QETH_CARD_TYPE_OSD: - return "GuestLAN QDIO"; + return "Virt.NIC QDIO"; case QETH_CARD_TYPE_IQD: - return "GuestLAN Hiper"; + return "Virt.NIC Hiper"; case QETH_CARD_TYPE_OSM: - return "GuestLAN OSM"; + return "Virt.NIC OSM"; case QETH_CARD_TYPE_OSX: - return "GuestLAN OSX"; + return "Virt.NIC OSX"; default: return "unknown"; } @@ -383,7 +383,7 @@ static inline void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, qeth_release_skbs(c); c = f->next_pending; - BUG_ON(head->next_pending != f); + WARN_ON_ONCE(head->next_pending != f); head->next_pending = c; kmem_cache_free(qeth_qdio_outbuf_cache, f); } else { @@ -415,13 +415,12 @@ static inline void qeth_qdio_handle_aob(struct qeth_card *card, buffer = (struct qeth_qdio_out_buffer *) aob->user1; QETH_CARD_TEXT_(card, 5, "%lx", aob->user1); - BUG_ON(buffer == NULL); - if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, QETH_QDIO_BUF_IN_CQ) == QETH_QDIO_BUF_PRIMED) { notification = TX_NOTIFY_OK; } else { - BUG_ON(atomic_read(&buffer->state) != QETH_QDIO_BUF_PENDING); + WARN_ON_ONCE(atomic_read(&buffer->state) != + QETH_QDIO_BUF_PENDING); atomic_set(&buffer->state, QETH_QDIO_BUF_IN_CQ); notification = TX_NOTIFY_DELAYED_OK; } @@ -1131,7 +1130,7 @@ static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf) notify_general_error = 1; /* release may never happen from within CQ tasklet scope */ - BUG_ON(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ); + WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ); skb = skb_dequeue(&buf->skb_list); while (skb) { @@ -2280,7 +2279,6 @@ static int qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply, unsigned long data) { struct qeth_cmd_buffer *iob; - int rc = 0; QETH_DBF_TEXT(SETUP, 2, "ulpstpcb"); @@ -2296,7 +2294,7 @@ static int qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply, iob->rc = -EMLINK; } QETH_DBF_TEXT_(SETUP, 2, " rc%d", iob->rc); - return rc; + return 0; } static int qeth_ulp_setup(struct qeth_card *card) @@ -2401,7 +2399,7 @@ static int qeth_alloc_qdio_buffers(struct qeth_card *card) card->qdio.out_qs[i]->queue_no = i; /* give outbound qeth_qdio_buffers their qdio_buffers */ for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) { - BUG_ON(card->qdio.out_qs[i]->bufs[j] != NULL); + WARN_ON(card->qdio.out_qs[i]->bufs[j] != NULL); if (qeth_init_qdio_out_buf(card->qdio.out_qs[i], j)) goto out_freeoutqbufs; } @@ -2942,16 +2940,33 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, QETH_DBF_TEXT(SETUP, 2, "qipasscb"); cmd = (struct qeth_ipa_cmd *) data; + + switch (cmd->hdr.return_code) { + case IPA_RC_NOTSUPP: + case IPA_RC_L2_UNSUPPORTED_CMD: + QETH_DBF_TEXT(SETUP, 2, "ipaunsup"); + card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS; + card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS; + return -0; + default: + if (cmd->hdr.return_code) { + QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled " + "rc=%d\n", + dev_name(&card->gdev->dev), + cmd->hdr.return_code); + return 0; + } + } + if (cmd->hdr.prot_version == QETH_PROT_IPV4) { card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; - } else { + } else if (cmd->hdr.prot_version == QETH_PROT_IPV6) { card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; - } - QETH_DBF_TEXT(SETUP, 2, "suppenbl"); - QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_supported); - QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_enabled); + } else + QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected" + "\n", dev_name(&card->gdev->dev)); return 0; } @@ -3549,7 +3564,7 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev, if (queue->bufstates && (queue->bufstates[bidx].flags & QDIO_OUTBUF_STATE_FLAG_PENDING) != 0) { - BUG_ON(card->options.cq != QETH_CQ_ENABLED); + WARN_ON_ONCE(card->options.cq != QETH_CQ_ENABLED); if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, @@ -3563,7 +3578,6 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev, QETH_CARD_TEXT(queue->card, 5, "aob"); QETH_CARD_TEXT_(queue->card, 5, "%lx", virt_to_phys(buffer->aob)); - BUG_ON(bidx < 0 || bidx >= QDIO_MAX_BUFFERS_PER_Q); if (qeth_init_qdio_out_buf(queue, bidx)) { QETH_CARD_TEXT(card, 2, "outofbuf"); qeth_schedule_recovery(card); @@ -4711,6 +4725,19 @@ static void qeth_core_free_card(struct qeth_card *card) kfree(card); } +void qeth_trace_features(struct qeth_card *card) +{ + QETH_CARD_TEXT(card, 2, "features"); + QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa4.supported_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa4.enabled_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa6.supported_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa6.enabled_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->options.adp.supported_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->options.adp.enabled_funcs); + QETH_CARD_TEXT_(card, 2, "%x", card->info.diagass_support); +} +EXPORT_SYMBOL_GPL(qeth_trace_features); + static struct ccw_device_id qeth_ids[] = { {CCW_DEVICE_DEVTYPE(0x1731, 0x01, 0x1732, 0x01), .driver_info = QETH_CARD_TYPE_OSD}, diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 2db409330c2..73195553f84 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -411,7 +411,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card, unsigned int len; *done = 0; - BUG_ON(!budget); + WARN_ON_ONCE(!budget); while (budget) { skb = qeth_core_get_next_skb(card, &card->qdio.in_q->bufs[card->rx.b_index], @@ -626,10 +626,13 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) QETH_DBF_TEXT(SETUP, 2, "doL2init"); QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card)); - rc = qeth_query_setadapterparms(card); - if (rc) { - QETH_DBF_MESSAGE(2, "could not query adapter parameters on " - "device %s: x%x\n", CARD_BUS_ID(card), rc); + if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) { + rc = qeth_query_setadapterparms(card); + if (rc) { + QETH_DBF_MESSAGE(2, "could not query adapter " + "parameters on device %s: x%x\n", + CARD_BUS_ID(card), rc); + } } if (card->info.type == QETH_CARD_TYPE_IQD || @@ -676,7 +679,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) return -ERESTARTSYS; } rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); - if (!rc) + if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND)) rc = qeth_l2_send_setmac(card, addr->sa_data); return rc ? -EINVAL : 0; } @@ -970,7 +973,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) int rc = 0; enum qeth_card_states recover_flag; - BUG_ON(!card); mutex_lock(&card->discipline_mutex); mutex_lock(&card->conf_mutex); QETH_DBF_TEXT(SETUP, 2, "setonlin"); @@ -983,6 +985,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) rc = -ENODEV; goto out_remove; } + qeth_trace_features(card); if (!card->dev && qeth_l2_setup_netdev(card)) { rc = -ENODEV; @@ -1141,11 +1144,12 @@ static int qeth_l2_recover(void *ptr) dev_info(&card->gdev->dev, "Device successfully recovered!\n"); else { - rtnl_lock(); - dev_close(card->dev); - rtnl_unlock(); - dev_warn(&card->gdev->dev, "The qeth device driver " - "failed to recover an error on the device\n"); + if (rtnl_trylock()) { + dev_close(card->dev); + rtnl_unlock(); + dev_warn(&card->gdev->dev, "The qeth device driver " + "failed to recover an error on the device\n"); + } } qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 4cd310cb5bd..6e5eef01e66 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1939,7 +1939,7 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, __u16 magic; *done = 0; - BUG_ON(!budget); + WARN_ON_ONCE(!budget); while (budget) { skb = qeth_core_get_next_skb(card, &card->qdio.in_q->bufs[card->rx.b_index], @@ -3334,7 +3334,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) int rc = 0; enum qeth_card_states recover_flag; - BUG_ON(!card); mutex_lock(&card->discipline_mutex); mutex_lock(&card->conf_mutex); QETH_DBF_TEXT(SETUP, 2, "setonlin"); @@ -3347,6 +3346,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) rc = -ENODEV; goto out_remove; } + qeth_trace_features(card); if (!card->dev && qeth_l3_setup_netdev(card)) { rc = -ENODEV; @@ -3510,11 +3510,12 @@ static int qeth_l3_recover(void *ptr) dev_info(&card->gdev->dev, "Device successfully recovered!\n"); else { - rtnl_lock(); - dev_close(card->dev); - rtnl_unlock(); - dev_warn(&card->gdev->dev, "The qeth device driver " - "failed to recover an error on the device\n"); + if (rtnl_trylock()) { + dev_close(card->dev); + rtnl_unlock(); + dev_warn(&card->gdev->dev, "The qeth device driver " + "failed to recover an error on the device\n"); + } } qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); @@ -3713,9 +3714,9 @@ static void qeth_l3_unregister_notifiers(void) { QETH_DBF_TEXT(SETUP, 5, "unregnot"); - BUG_ON(unregister_inetaddr_notifier(&qeth_l3_ip_notifier)); + WARN_ON(unregister_inetaddr_notifier(&qeth_l3_ip_notifier)); #ifdef CONFIG_QETH_IPV6 - BUG_ON(unregister_inet6addr_notifier(&qeth_l3_ip6_notifier)); + WARN_ON(unregister_inet6addr_notifier(&qeth_l3_ip6_notifier)); #endif /* QETH_IPV6 */ } diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index 207b7d74244..d8f990b6b33 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c @@ -157,7 +157,7 @@ static int smsg_pm_restore_thaw(struct device *dev) #ifdef CONFIG_PM_DEBUG printk(KERN_WARNING "smsg_pm_restore_thaw\n"); #endif - if (smsg_path && iucv_path_connected) { + if (smsg_path && !iucv_path_connected) { memset(smsg_path, 0, sizeof(*smsg_path)); smsg_path->msglim = 255; smsg_path->flags = 0; |