From 329b785bcee5d001f97a33bdb80de014bb5020b0 Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Thu, 27 Apr 2006 18:40:02 -0700 Subject: [PATCH] s390: fix I/O termination race in cio Fix a race condition in the I/O termination logic. The race can cause I/O to a dasd device to fail with no retry left after turning one channel path to the device off and on multiple times. Signed-off-by: Peter Oberparleiter Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/cio/chsc.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 6412b2c3edd..daedb00a434 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -242,28 +242,10 @@ s390_subchannel_remove_chpid(struct device *dev, void *data) if (sch->vpm == mask) goto out_unreg; - if ((sch->schib.scsw.actl & (SCSW_ACTL_CLEAR_PEND | - SCSW_ACTL_HALT_PEND | - SCSW_ACTL_START_PEND | - SCSW_ACTL_RESUME_PEND)) && - (sch->schib.pmcw.lpum == mask)) { - int cc = cio_cancel(sch); - - if (cc == -ENODEV) - goto out_unreg; - - if (cc == -EINVAL) { - cc = cio_clear(sch); - if (cc == -ENODEV) - goto out_unreg; - /* Call handler. */ - if (sch->driver && sch->driver->termination) - sch->driver->termination(&sch->dev); - goto out_unlock; - } - } else if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && - (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && - (sch->schib.pmcw.lpum == mask)) { + if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && + (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && + (sch->schib.pmcw.lpum == mask) && + (sch->vpm == 0)) { int cc; cc = cio_clear(sch); -- cgit v1.2.3 From 6dcfca78d4c036c9d012f913e2a622aae218827f Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Thu, 27 Apr 2006 18:40:04 -0700 Subject: [PATCH] s390: enable interrupts on error path Interrupts can stay disabled if an error occurred in _chp_add(). Use spin_unlock_irq on the error paths to reenable interrupts. Signed-off-by: Stefan Bader Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/cio/chsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index daedb00a434..72187e54dca 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -635,13 +635,13 @@ __chp_add(struct subchannel_id schid, void *data) if (sch->schib.pmcw.chpid[i] == chp->id) { if (stsch(sch->schid, &sch->schib) != 0) { /* Endgame. */ - spin_unlock(&sch->lock); + spin_unlock_irq(&sch->lock); return -ENXIO; } break; } if (i==8) { - spin_unlock(&sch->lock); + spin_unlock_irq(&sch->lock); return 0; } sch->lpm = ((sch->schib.pmcw.pim & -- cgit v1.2.3 From a3ae39c060be57a4936d2c1d970e4d0c7d320d9c Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Thu, 27 Apr 2006 18:40:09 -0700 Subject: [PATCH] s390: qdio memory allocations Avoid memory allocation with GFP_KERNEL in qdio_establish/qdio_shutdown. Use memory pool instead. (Otherwise this can lead to an I/O stall where qdio waits for a free page and zfcp waits for end of error recovery in low memory situations.) Signed-off-by: Andreas Herrmann Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/cio/qdio.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 814f9258ce0..a5bf272fe77 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,8 @@ static int indicator_used[INDICATORS_PER_CACHELINE]; static __u32 * volatile indicators; static __u32 volatile spare_indicator; static atomic_t spare_indicator_usecount; +#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2 +static mempool_t *qdio_mempool_scssc; static debug_info_t *qdio_dbf_setup; static debug_info_t *qdio_dbf_sbal; @@ -2304,7 +2307,7 @@ qdio_get_ssqd_information(struct qdio_irq *irq_ptr) QDIO_DBF_TEXT0(0,setup,"getssqd"); qdioac = 0; - ssqd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + ssqd_area = mempool_alloc(qdio_mempool_scssc, GFP_ATOMIC); if (!ssqd_area) { QDIO_PRINT_WARN("Could not get memory for chsc. Using all " \ "SIGAs for sch x%x.\n", irq_ptr->schid.sch_no); @@ -2364,7 +2367,7 @@ qdio_get_ssqd_information(struct qdio_irq *irq_ptr) out: qdio_check_subchannel_qebsm(irq_ptr, qdioac, ssqd_area->sch_token); - free_page ((unsigned long) ssqd_area); + mempool_free(ssqd_area, qdio_mempool_scssc); irq_ptr->qdioac = qdioac; } @@ -2458,7 +2461,7 @@ tiqdio_set_subchannel_ind(struct qdio_irq *irq_ptr, int reset_to_zero) virt_to_phys((volatile void *)irq_ptr->dev_st_chg_ind); } - scssc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + scssc_area = mempool_alloc(qdio_mempool_scssc, GFP_ATOMIC); if (!scssc_area) { QDIO_PRINT_WARN("No memory for setting indicators on " \ "subchannel 0.%x.%x.\n", @@ -2514,7 +2517,7 @@ tiqdio_set_subchannel_ind(struct qdio_irq *irq_ptr, int reset_to_zero) QDIO_DBF_HEX2(0,setup,&real_addr_dev_st_chg_ind,sizeof(unsigned long)); result = 0; out: - free_page ((unsigned long) scssc_area); + mempool_free(scssc_area, qdio_mempool_scssc); return result; } @@ -2543,7 +2546,7 @@ tiqdio_set_delay_target(struct qdio_irq *irq_ptr, unsigned long delay_target) if (!irq_ptr->is_thinint_irq) return -ENODEV; - scsscf_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + scsscf_area = mempool_alloc(qdio_mempool_scssc, GFP_ATOMIC); if (!scsscf_area) { QDIO_PRINT_WARN("No memory for setting delay target on " \ "subchannel 0.%x.%x.\n", @@ -2581,7 +2584,7 @@ tiqdio_set_delay_target(struct qdio_irq *irq_ptr, unsigned long delay_target) QDIO_DBF_HEX2(0,trace,&delay_target,sizeof(unsigned long)); result = 0; /* not critical */ out: - free_page ((unsigned long) scsscf_area); + mempool_free(scsscf_area, qdio_mempool_scssc); return result; } @@ -3780,6 +3783,16 @@ oom: return -ENOMEM; } +static void *qdio_mempool_alloc(gfp_t gfp_mask, void *size) +{ + return (void *) get_zeroed_page(gfp_mask|GFP_DMA); +} + +static void qdio_mempool_free(void *element, void *size) +{ + free_page((unsigned long) element); +} + static int __init init_QDIO(void) { @@ -3809,6 +3822,10 @@ init_QDIO(void) qdio_add_procfs_entry(); + qdio_mempool_scssc = mempool_create(QDIO_MEMPOOL_SCSSC_ELEMENTS, + qdio_mempool_alloc, + qdio_mempool_free, NULL); + if (tiqdio_check_chsc_availability()) QDIO_PRINT_ERR("Not all CHSCs supported. Continuing.\n"); @@ -3824,6 +3841,7 @@ cleanup_QDIO(void) qdio_remove_procfs_entry(); qdio_release_qdio_memory(); qdio_unregister_dbf_views(); + mempool_destroy(qdio_mempool_scssc); printk("qdio: %s: module removed\n",version); } -- cgit v1.2.3 From 39ccf95e28765a08a9e01be614695d7c570b4e77 Mon Sep 17 00:00:00 2001 From: Horst Hummel Date: Thu, 27 Apr 2006 18:40:10 -0700 Subject: [PATCH] s390: dasd ioctl never returns The dasd state machine is not designed to enable an unformatted device, since 'unformatted' is a final state. The BIODASDENABLE ioctl calls dasd_enable_device() which never returns if the device is in this special state. Return -EPERM in dasd_increase_state for unformatted devices to make dasd_enable_device terminate. Note: To get such an unformatted device online it has to be re-analyzed. This means that the device needs to be disabled prior to re-enablement. Signed-off-by: Horst Hummel Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/block/dasd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/s390') diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index a3bfebcf31e..cfb1fff3787 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -314,6 +314,11 @@ dasd_increase_state(struct dasd_device *device) device->target >= DASD_STATE_READY) rc = dasd_state_basic_to_ready(device); + if (!rc && + device->state == DASD_STATE_UNFMT && + device->target > DASD_STATE_UNFMT) + rc = -EPERM; + if (!rc && device->state == DASD_STATE_READY && device->target >= DASD_STATE_ONLINE) -- cgit v1.2.3 From 40ac6b204c20da09b64b6dcc10c68b6e7bd9fadd Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Thu, 27 Apr 2006 18:40:11 -0700 Subject: [PATCH] s390: fix slab debugging With CONFIG_SLAB_DEBUG=y networking over qeth doesn't work. The problem is that the qib structure embedded in the qeth_irq structure needs an alignment of 256 but kmalloc only guarantees an alignment of 8. When using SLAB debugging the alignment of qeth_irq is not sufficient for the embedded qib structure which causes all users of qdio (qeth and zfcp) to stop working. Allocate qeth_irq structure with __get_free_page. That wastes a small amount of memory (~2500 bytes) per online adapter. Signed-off-by: Christian Borntraeger Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/cio/qdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index a5bf272fe77..96f519281d9 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c @@ -1640,7 +1640,7 @@ next: } kfree(irq_ptr->qdr); - kfree(irq_ptr); + free_page((unsigned long) irq_ptr); } static void @@ -2983,7 +2983,7 @@ qdio_allocate(struct qdio_initialize *init_data) qdio_allocate_do_dbf(init_data); /* create irq */ - irq_ptr = kzalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA); + irq_ptr = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); QDIO_DBF_TEXT0(0,setup,"irq_ptr:"); QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); @@ -2998,7 +2998,7 @@ qdio_allocate(struct qdio_initialize *init_data) /* QDR must be in DMA area since CCW data address is only 32 bit */ irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA); if (!(irq_ptr->qdr)) { - kfree(irq_ptr); + free_page((unsigned long) irq_ptr); QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n"); return -ENOMEM; } -- cgit v1.2.3 From 2cc924b8ba1e9493ed50f5b793974e2427a15748 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Thu, 27 Apr 2006 18:40:16 -0700 Subject: [PATCH] s390: tape 3590 changes Added some changes that where proposed by Andrew Morton. Added 3592 device type. Signed-off-by: Stefan Bader Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/char/tape_3590.c | 22 +++++++++++----------- drivers/s390/char/tape_std.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index c3915f60a3a..d71ef1adea5 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c @@ -230,14 +230,16 @@ tape_3590_read_attmsg(struct tape_device *device) * These functions are used to schedule follow-up actions from within an * interrupt context (like unsolicited interrupts). */ +struct work_handler_data { + struct tape_device *device; + enum tape_op op; + struct work_struct work; +}; + static void tape_3590_work_handler(void *data) { - struct { - struct tape_device *device; - enum tape_op op; - struct work_struct work; - } *p = data; + struct work_handler_data *p = data; switch (p->op) { case TO_MSEN: @@ -257,11 +259,7 @@ tape_3590_work_handler(void *data) static int tape_3590_schedule_work(struct tape_device *device, enum tape_op op) { - struct { - struct tape_device *device; - enum tape_op op; - struct work_struct work; - } *p; + struct work_handler_data *p; if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL) return -ENOMEM; @@ -316,7 +314,7 @@ tape_3590_bread(struct tape_device *device, struct request *req) rq_for_each_bio(bio, req) { bio_for_each_segment(bv, bio, i) { - dst = kmap(bv->bv_page) + bv->bv_offset; + dst = page_address(bv->bv_page) + bv->bv_offset; for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) { ccw->flags = CCW_FLAG_CC; @@ -1168,6 +1166,7 @@ tape_3590_setup_device(struct tape_device *device) static void tape_3590_cleanup_device(struct tape_device *device) { + flush_scheduled_work(); tape_std_unassign(device); kfree(device->discdata); @@ -1234,6 +1233,7 @@ static struct tape_discipline tape_discipline_3590 = { static struct ccw_device_id tape_3590_ids[] = { {CCW_DEVICE_DEVTYPE(0x3590, 0, 0x3590, 0), .driver_info = tape_3590}, + {CCW_DEVICE_DEVTYPE(0x3592, 0, 0x3592, 0), .driver_info = tape_3592}, { /* end of list */ } }; diff --git a/drivers/s390/char/tape_std.h b/drivers/s390/char/tape_std.h index 2d311798edf..1fc95235934 100644 --- a/drivers/s390/char/tape_std.h +++ b/drivers/s390/char/tape_std.h @@ -153,6 +153,7 @@ enum s390_tape_type { tape_3480, tape_3490, tape_3590, + tape_3592, }; #endif // _TAPE_STD_H -- cgit v1.2.3 From b73d40c6178f2c8b2d574db566b47f36e3d12072 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 27 Apr 2006 18:40:23 -0700 Subject: [PATCH] s390: instruction processing damage handling In case of an instruction processing damage (IPD) machine check in kernel mode the resulting action is always to stop the kernel. This is not necessarily the best solution since a retry of the failing instruction might succeed. Add logic to retry the instruction if no more than 30 instruction processing damage checks occured in the last 5 minutes. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/s390mach.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index 3bf46660351..5ae14803091 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c @@ -362,12 +362,19 @@ s390_revalidate_registers(struct mci *mci) return kill_task; } +#define MAX_IPD_COUNT 29 +#define MAX_IPD_TIME (5 * 60 * 100 * 1000) /* 5 minutes */ + /* * machine check handler. */ void s390_do_machine_check(struct pt_regs *regs) { + static DEFINE_SPINLOCK(ipd_lock); + static unsigned long long last_ipd; + static int ipd_count; + unsigned long long tmp; struct mci *mci; struct mcck_struct *mcck; int umode; @@ -404,11 +411,27 @@ s390_do_machine_check(struct pt_regs *regs) s390_handle_damage("processing backup machine " "check with damage."); } - if (!umode) - s390_handle_damage("processing backup machine " - "check in kernel mode."); - mcck->kill_task = 1; - mcck->mcck_code = *(unsigned long long *) mci; + + /* + * Nullifying exigent condition, therefore we might + * retry this instruction. + */ + + spin_lock(&ipd_lock); + + tmp = get_clock(); + + if (((tmp - last_ipd) >> 12) < MAX_IPD_TIME) + ipd_count++; + else + ipd_count = 1; + + last_ipd = tmp; + + if (ipd_count == MAX_IPD_COUNT) + s390_handle_damage("too many ipd retries."); + + spin_unlock(&ipd_lock); } else { /* Processing damage -> stopping machine */ -- cgit v1.2.3 From 3d052595423b4432f4d599c1aeb1949ac0da7314 Mon Sep 17 00:00:00 2001 From: Horst Hummel Date: Thu, 27 Apr 2006 18:40:28 -0700 Subject: [PATCH] s390: dasd device identifiers Generate new sysfs-attribute 'uid' that contains an device specific unique identifier. This can be used to identity multiple ALIASES of the same physical device (PAV). In addition the sysfs-attributes 'vendor' (containing the manufacturer of the device) and 'alias' (identify alias or base device) is added. This is first part of PAV support in LPAR (also valid on zVM). Signed-off-by: Horst Hummel Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/block/dasd_devmap.c | 102 +++++++++++++++++++++++++++++++++++++++ drivers/s390/block/dasd_eckd.c | 51 +++++++++++++++++++- drivers/s390/block/dasd_eckd.h | 46 +++++++++++------- drivers/s390/block/dasd_int.h | 12 +++++ 4 files changed, 191 insertions(+), 20 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index c1c6f138115..216bc4fba19 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -45,6 +45,7 @@ struct dasd_devmap { unsigned int devindex; unsigned short features; struct dasd_device *device; + struct dasd_uid uid; }; /* @@ -716,6 +717,68 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr, char *bu static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL); +static ssize_t +dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct dasd_devmap *devmap; + int alias; + + devmap = dasd_find_busid(dev->bus_id); + spin_lock(&dasd_devmap_lock); + if (!IS_ERR(devmap)) + alias = devmap->uid.alias; + else + alias = 0; + spin_unlock(&dasd_devmap_lock); + + return sprintf(buf, alias ? "1\n" : "0\n"); +} + +static DEVICE_ATTR(alias, 0444, dasd_alias_show, NULL); + +static ssize_t +dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct dasd_devmap *devmap; + char *vendor; + + devmap = dasd_find_busid(dev->bus_id); + spin_lock(&dasd_devmap_lock); + if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0) + vendor = devmap->uid.vendor; + else + vendor = ""; + spin_unlock(&dasd_devmap_lock); + + return snprintf(buf, PAGE_SIZE, "%s\n", vendor); +} + +static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL); + +#define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\ + /* SSID */ 4 + 1 + /* unit addr */ 2 + 1) + +static ssize_t +dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct dasd_devmap *devmap; + char uid[UID_STRLEN]; + + devmap = dasd_find_busid(dev->bus_id); + spin_lock(&dasd_devmap_lock); + if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0) + snprintf(uid, sizeof(uid), "%s.%s.%04x.%02x", + devmap->uid.vendor, devmap->uid.serial, + devmap->uid.ssid, devmap->uid.unit_addr); + else + uid[0] = 0; + spin_unlock(&dasd_devmap_lock); + + return snprintf(buf, PAGE_SIZE, "%s\n", uid); +} + +static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL); + /* * extended error-reporting */ @@ -759,6 +822,9 @@ static DEVICE_ATTR(eer_enabled, 0644, dasd_eer_show, dasd_eer_store); static struct attribute * dasd_attrs[] = { &dev_attr_readonly.attr, &dev_attr_discipline.attr, + &dev_attr_alias.attr, + &dev_attr_vendor.attr, + &dev_attr_uid.attr, &dev_attr_use_diag.attr, &dev_attr_eer_enabled.attr, NULL, @@ -768,6 +834,42 @@ static struct attribute_group dasd_attr_group = { .attrs = dasd_attrs, }; + +/* + * Return copy of the device unique identifier. + */ +int +dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid) +{ + struct dasd_devmap *devmap; + + devmap = dasd_find_busid(cdev->dev.bus_id); + if (IS_ERR(devmap)) + return PTR_ERR(devmap); + spin_lock(&dasd_devmap_lock); + *uid = devmap->uid; + spin_unlock(&dasd_devmap_lock); + return 0; +} + +/* + * Register the given device unique identifier into devmap struct. + */ +int +dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) +{ + struct dasd_devmap *devmap; + + devmap = dasd_find_busid(cdev->dev.bus_id); + if (IS_ERR(devmap)) + return PTR_ERR(devmap); + spin_lock(&dasd_devmap_lock); + devmap->uid = *uid; + spin_unlock(&dasd_devmap_lock); + return 0; +} +EXPORT_SYMBOL(dasd_set_uid); + /* * Return value of the specified feature. */ diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index ee09ef33d08..7d5a6cee4bd 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -446,6 +446,39 @@ dasd_eckd_cdl_reclen(int recid) return LABEL_SIZE; } +/* + * Generate device unique id that specifies the physical device. + */ +static int +dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid) +{ + struct dasd_eckd_private *private; + struct dasd_eckd_confdata *confdata; + + private = (struct dasd_eckd_private *) device->private; + if (!private) + return -ENODEV; + confdata = &private->conf_data; + if (!confdata) + return -ENODEV; + + memset(uid, 0, sizeof(struct dasd_uid)); + strncpy(uid->vendor, confdata->ned1.HDA_manufacturer, + sizeof(uid->vendor) - 1); + EBCASC(uid->vendor, sizeof(uid->vendor) - 1); + strncpy(uid->serial, confdata->ned1.HDA_location, + sizeof(uid->serial) - 1); + EBCASC(uid->serial, sizeof(uid->serial) - 1); + uid->ssid = confdata->neq.subsystemID; + if (confdata->ned2.sneq.flags == 0x40) { + uid->alias = 1; + uid->unit_addr = confdata->ned2.sneq.base_unit_addr; + } else + uid->unit_addr = confdata->ned1.unit_addr; + + return 0; +} + static int dasd_eckd_read_conf(struct dasd_device *device) { @@ -507,11 +540,15 @@ dasd_eckd_read_conf(struct dasd_device *device) return 0; } - +/* + * Check device characteristics. + * If the device is accessible using ECKD discipline, the device is enabled. + */ static int dasd_eckd_check_characteristics(struct dasd_device *device) { struct dasd_eckd_private *private; + struct dasd_uid uid; void *rdc_data; int rc; @@ -536,6 +573,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) /* Read Device Characteristics */ rdc_data = (void *) &(private->rdc_data); + memset(rdc_data, 0, sizeof(rdc_data)); rc = read_dev_chars(device->cdev, &rdc_data, 64); if (rc) { DEV_MESSAGE(KERN_WARNING, device, @@ -556,8 +594,17 @@ dasd_eckd_check_characteristics(struct dasd_device *device) /* Read Configuration Data */ rc = dasd_eckd_read_conf (device); - return rc; + if (rc) + return rc; + + /* Generate device unique id and register in devmap */ + rc = dasd_eckd_generate_uid(device, &uid); + if (rc) + return rc; + rc = dasd_set_uid(device->cdev, &uid); + + return rc; } static struct dasd_ccw_req * diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index ad8524bb7bb..d5734e976e1 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h @@ -228,26 +228,36 @@ struct dasd_eckd_confdata { unsigned char HDA_manufacturer[3]; unsigned char HDA_location[2]; unsigned char HDA_seqno[12]; - __u16 ID; + __u8 ID; + __u8 unit_addr; } __attribute__ ((packed)) ned1; - struct { + union { struct { - unsigned char identifier:2; - unsigned char token_id:1; - unsigned char sno_valid:1; - unsigned char subst_sno:1; - unsigned char recNED:1; - unsigned char emuNED:1; - unsigned char reserved:1; - } __attribute__ ((packed)) flags; - __u8 descriptor; - __u8 reserved[2]; - unsigned char dev_type[6]; - unsigned char dev_model[3]; - unsigned char DASD_manufacturer[3]; - unsigned char DASD_location[2]; - unsigned char DASD_seqno[12]; - __u16 ID; + struct { + unsigned char identifier:2; + unsigned char token_id:1; + unsigned char sno_valid:1; + unsigned char subst_sno:1; + unsigned char recNED:1; + unsigned char emuNED:1; + unsigned char reserved:1; + } __attribute__ ((packed)) flags; + __u8 descriptor; + __u8 reserved[2]; + unsigned char dev_type[6]; + unsigned char dev_model[3]; + unsigned char DASD_manufacturer[3]; + unsigned char DASD_location[2]; + unsigned char DASD_seqno[12]; + __u16 ID; + } __attribute__ ((packed)) ned; + struct { + unsigned char flags; /* byte 0 */ + unsigned char res2[7]; /* byte 1- 7 */ + unsigned char sua_flags; /* byte 8 */ + __u8 base_unit_addr; /* byte 9 */ + unsigned char res3[22]; /* byte 10-31 */ + } __attribute__ ((packed)) sneq; } __attribute__ ((packed)) ned2; struct { struct { diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 4293ba82752..d4b13e300a7 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -268,6 +268,16 @@ struct dasd_discipline { extern struct dasd_discipline *dasd_diag_discipline_pointer; +/* + * Unique identifier for dasd device. + */ +struct dasd_uid { + __u8 alias; + char vendor[4]; + char serial[15]; + __u16 ssid; + __u8 unit_addr; +}; /* * Notification numbers for extended error reporting notifications: @@ -516,6 +526,8 @@ void dasd_devmap_exit(void); struct dasd_device *dasd_create_device(struct ccw_device *); void dasd_delete_device(struct dasd_device *); +int dasd_get_uid(struct ccw_device *, struct dasd_uid *); +int dasd_set_uid(struct ccw_device *, struct dasd_uid *); int dasd_get_feature(struct ccw_device *, int); int dasd_set_feature(struct ccw_device *, int, int); -- cgit v1.2.3 From 235acec78e87a60ace01d1ecb4b87ad1d689715a Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Mon, 1 May 2006 12:15:42 -0700 Subject: [PATCH] s390: make qeth buildable Signed-off-by: Bastian Blank Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: "David S. Miller" Acked-by: Jeff Garzik Acked-by: Frank Pavlic Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/net/qeth_main.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/s390') diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index b3c6e790779..cb14642d97a 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -8014,7 +8014,6 @@ static int (*qeth_old_arp_constructor) (struct neighbour *); static struct neigh_ops arp_direct_ops_template = { .family = AF_INET, - .destructor = NULL, .solicit = NULL, .error_report = NULL, .output = dev_queue_xmit, -- cgit v1.2.3 From 022e4fc0fb2e4e179aaba4ee139dcb8fded0cba2 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Mon, 1 May 2006 12:16:14 -0700 Subject: [PATCH] s390: fix ipd handling As pointed out by Paulo Marques MAX_IPD_TIME is by a factor of ten too small. Since this means that we allow ten times more IPDs in the intended time frame this could result in a cpu check stop of a physical cpu. Cc: Martin Schwidefsky Signed-off-by: Heiko Carstens Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/s390mach.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/s390') diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index 5ae14803091..f99e55308b3 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -363,7 +364,7 @@ s390_revalidate_registers(struct mci *mci) } #define MAX_IPD_COUNT 29 -#define MAX_IPD_TIME (5 * 60 * 100 * 1000) /* 5 minutes */ +#define MAX_IPD_TIME (5 * 60 * USEC_PER_SEC) /* 5 minutes */ /* * machine check handler. -- cgit v1.2.3