RE: [PATCH 20/20] scsi_error: format abort error message
> -Original Message- > From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- > ow...@vger.kernel.org] On Behalf Of Christoph Hellwig > Sent: Friday, 05 September, 2014 7:33 PM > Subject: Re: [PATCH 20/20] scsi_error: format abort error message > > On Wed, Sep 03, 2014 at 12:06:15PM +0200, Hannes Reinecke wrote: ... > > Decode the return value if the command abort failed. > > @@ -157,8 +157,8 @@ scmd_eh_abort_handler(struct work_struct *work) > > } else { > > SCSI_LOG_ERROR_RECOVERY(3, > > scmd_printk(KERN_INFO, scmd, > > - "scmd %p abort failed, rtn %d\n", > > - scmd, rtn)); > > + "scmd %p abort failed, rtn %s\n", > > + scmd, scsi_retval_string(rtn))); ... > I've not seen an answer to my question in reply to the previous version > of this. Why would you do pretty printing of a variable that can just > return SUCCESS or FAILURE? Is there anything prohibiting the scsi_eh_abort_handler provided by the LLD from returning any of the other values like NEEDS_RETRY? #define NEEDS_RETRY 0x2001 #define SUCCESS 0x2002 #define FAILED 0x2003 #define QUEUED 0x2004 #define SOFT_ERROR 0x2005 #define ADD_TO_MLQUEUE 0x2006 #define TIMEOUT_ERROR 0x2007 #define SCSI_RETURN_NOT_HANDLED 0x2008 #define FAST_IO_FAIL0x2009 --- Rob ElliottHP Server Storage -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] scsi: fix regression that accidentally disabled block-based tcq
Please try the fix below, looks like the commit broke TCQ for all drivers using block-level tagging. --- >From 865a19b760d2786fe37d3b5c151a4ecea4c0e95e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 12 Sep 2014 16:00:19 -0700 Subject: scsi: fix regression that accidentally disabled block-based tcq The scsi blk-mq support accidentally flipped a conditional, which lead to never enabling block based tcq when using the legacy request path. Fixes: d285203cf647d7c9 scsi: add support for a blk-mq based I/O path. Reported-by: Hans de Goede Signed-off-by: Christoph Hellwig --- include/scsi/scsi_tcq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index cdcc90b..e645835 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -68,7 +68,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) return; if (!shost_use_blk_mq(sdev->host) && - blk_queue_tagged(sdev->request_queue)) + !blk_queue_tagged(sdev->request_queue)) blk_queue_init_tags(sdev->request_queue, depth, sdev->host->bqt); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 5/5] SES: Add power_status to SES enclosure component
>From 53549716d9f965e59f3a84feb5ebae9d18232b52 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Tue, 19 Aug 2014 23:58:58 -0700 Subject: [PATCH 5/5] SES: Add power_status to SES enclosure component Add power_status to SES enclosure component, so we can power on/off the HDDs behind the enclosure. Check firmware status in ses_set_* before sending control pages to firmware. Signed-off-by: Song Liu Acked-by: Dan Williams Reviewed-by: Jens Axboe Cc: Hannes Reinecke --- drivers/misc/enclosure.c | 38 ++ drivers/scsi/ses.c| 98 ++- include/linux/enclosure.h | 6 +++ 3 files changed, 133 insertions(+), 9 deletions(-) diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 2e3eafa..819f2f2 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -148,6 +148,7 @@ enclosure_register(struct device *dev, const char *name, int components, for (i = 0; i < components; i++) { edev->component[i].number = -1; edev->component[i].slot = -1; + edev->component[i].power_status = 1; } mutex_lock(&container_list_lock); @@ -546,6 +547,40 @@ static ssize_t set_component_locate(struct device *cdev, return count; } +static ssize_t get_component_power_status(struct device *cdev, + struct device_attribute *attr, + char *buf) +{ + struct enclosure_device *edev = to_enclosure_device(cdev->parent); + struct enclosure_component *ecomp = to_enclosure_component(cdev); + + if (edev->cb->get_power_status) + edev->cb->get_power_status(edev, ecomp); + return snprintf(buf, 40, "%s\n", ecomp->power_status ? "on" : "off"); +} + +static ssize_t set_component_power_status(struct device *cdev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct enclosure_device *edev = to_enclosure_device(cdev->parent); + struct enclosure_component *ecomp = to_enclosure_component(cdev); + int val; + + if (strncmp(buf, "on", 2) == 0 && + (buf[2] == '\n' || buf[2] == '\0')) + val = 1; + else if (strncmp(buf, "off", 3) == 0 && + (buf[3] == '\n' || buf[3] == '\0')) + val = 0; + else + return -EINVAL; + + if (edev->cb->set_power_status) + edev->cb->set_power_status(edev, ecomp, val); + return count; +} + static ssize_t get_component_type(struct device *cdev, struct device_attribute *attr, char *buf) { @@ -577,6 +612,8 @@ static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active, set_component_active); static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, set_component_locate); +static DEVICE_ATTR(power_status, S_IRUGO | S_IWUSR, get_component_power_status, + set_component_power_status); static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL); static DEVICE_ATTR(slot, S_IRUGO, get_component_slot, NULL); @@ -585,6 +622,7 @@ static struct attribute *enclosure_component_attrs[] = { &dev_attr_status.attr, &dev_attr_active.attr, &dev_attr_locate.attr, + &dev_attr_power_status.attr, &dev_attr_type.attr, &dev_attr_slot.attr, NULL diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 3e59a5d..8ba3c78 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -67,6 +67,20 @@ static int ses_probe(struct device *dev) #define SES_TIMEOUT (30 * HZ) #define SES_RETRIES 3 +static void init_device_slot_control(unsigned char *dest_desc, +struct enclosure_component *ecomp, +unsigned char *status) +{ + memcpy(dest_desc, status, 4); + dest_desc[0] = 0; + /* only clear byte 1 for ENCLOSURE_COMPONENT_DEVICE */ + if (ecomp->type == ENCLOSURE_COMPONENT_DEVICE) + dest_desc[1] = 0; + dest_desc[2] &= 0xde; + dest_desc[3] &= 0x3c; +} + + static int ses_recv_diag(struct scsi_device *sdev, int page_code, void *buf, int bufflen) { @@ -178,14 +192,22 @@ static int ses_set_fault(struct enclosure_device *edev, struct enclosure_component *ecomp, enum enclosure_component_setting val) { - unsigned char desc[4] = {0 }; + unsigned char desc[4]; + unsigned char *desc_ptr; + + desc_ptr = ses_get_page2_descriptor(edev, ecomp); + + if (!desc_ptr) + return -EIO; + + init_device_slot_control(desc, ecomp, desc_ptr); switch (val) { case ENCLOSURE_SETTING_DISABLED: - /* zero is disabled */ + desc[3] &= 0xdf;
RE: [PATCH 5/5] SES: Add power_status to SES enclosure component
New patch in next email... Change to let power_status show "on" or "off" Initialization of desc was removed because it will be initialized in init_device_slot_control, so no need to initialize at define. Thanks, Song > -Original Message- > From: Hannes Reinecke [mailto:h...@suse.de] > Sent: Thursday, September 4, 2014 12:59 AM > To: Song Liu; linux-scsi@vger.kernel.org > Cc: Dan Williams; Jens Axboe > Subject: Re: [PATCH 5/5] SES: Add power_status to SES enclosure component > > On 08/25/2014 07:34 PM, Song Liu wrote: > > From: Song Liu [mailto:songliubrav...@fb.com] > > Sent: Monday, August 25, 2014 10:26 AM > > To: Song Liu > > Cc: Hannes Reinecke > > Subject: [PATCH 5/5] SES: Add power_status to SES enclosure component > > > > Add power_status to SES enclosure component, so we can power on/off > the HDDs behind the enclosure. > > > > Check firmware status in ses_set_* before sending control pages to > firmware. > > > > Signed-off-by: Song Liu > > Acked-by: Dan Williams > > Reviewed-by: Jens Axboe > > Cc: Hannes Reinecke > > --- > > drivers/misc/enclosure.c | 29 ++ > > drivers/scsi/ses.c| 98 > ++- > > include/linux/enclosure.h | 6 +++ > > 3 files changed, 124 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index > > de335bc..0331dfe 100644 > > --- a/drivers/misc/enclosure.c > > +++ b/drivers/misc/enclosure.c > > @@ -148,6 +148,7 @@ enclosure_register(struct device *dev, const char > *name, int components, > > for (i = 0; i < components; i++) { > > edev->component[i].number = -1; > > edev->component[i].slot = -1; > > + edev->component[i].power_status = 1; > > } > > > > mutex_lock(&container_list_lock); > > @@ -546,6 +547,31 @@ static ssize_t set_component_locate(struct > device *cdev, > > return count; > > } > > > > +static ssize_t get_component_power_status(struct device *cdev, > > + struct device_attribute *attr, > > + char *buf) > > +{ > > + struct enclosure_device *edev = to_enclosure_device(cdev->parent); > > + struct enclosure_component *ecomp = > to_enclosure_component(cdev); > > + > > + if (edev->cb->get_power_status) > > + edev->cb->get_power_status(edev, ecomp); > > + return snprintf(buf, 40, "%d\n", ecomp->power_status); } > > + > > +static ssize_t set_component_power_status(struct device *cdev, > > + struct device_attribute *attr, > > + const char *buf, size_t count) { > > + struct enclosure_device *edev = to_enclosure_device(cdev->parent); > > + struct enclosure_component *ecomp = > to_enclosure_component(cdev); > > + int val = simple_strtoul(buf, NULL, 0); > > + > > + if (edev->cb->set_power_status) > > + edev->cb->set_power_status(edev, ecomp, val); > > + return count; > > +} > > + > Just using a number here doesn't seem to be very instructive; what is this > number? Can't we have a decode setting here to allow even the uninitiated > to do some sensible decisions here? > > > static ssize_t get_component_type(struct device *cdev, > > struct device_attribute *attr, char *buf) > { @@ -577,6 +603,8 @@ static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, > get_component_active, > >set_component_active); > > static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, > >set_component_locate); > > +static DEVICE_ATTR(power_status, S_IRUGO | S_IWUSR, > get_component_power_status, > > + set_component_power_status); > > static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL); static > > DEVICE_ATTR(slot, S_IRUGO, get_component_slot, NULL); > > > > @@ -585,6 +613,7 @@ static struct attribute > *enclosure_component_attrs[] = { > > &dev_attr_status.attr, > > &dev_attr_active.attr, > > &dev_attr_locate.attr, > > + &dev_attr_power_status.attr, > > &dev_attr_type.attr, > > &dev_attr_slot.attr, > > NULL > > diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index > > bafa301..ea6b262 100644 > > --- a/drivers/scsi/ses.c > > +++ b/drivers/scsi/ses.c > > @@ -67,6 +67,20 @@ static int ses_probe(struct device *dev) #define > > SES_TIMEOUT (30 * HZ) #define SES_RETRIES 3 > > > > +static void init_device_slot_control(unsigned char *dest_desc, > > +struct enclosure_component *ecomp, > > +unsigned char *status) > > +{ > > + memcpy(dest_desc, status, 4); > > + dest_desc[0] = 0; > > + /* only clear byte 1 for ENCLOSURE_COMPONENT_DEVICE */ > > + if (ecomp->type == ENCLOSURE_COMPONENT_DEVICE) > > + dest_desc[1] = 0; > > + dest_desc[2] &= 0xde; > > + dest_desc[3] &= 0x3c; > > +} > > + > > + > > static int ses_recv_diag(struct scsi_device *sdev, int page_c
RE: [PATCH 3/5] SES: add enclosure logical id
>From 849dd255bdd2158cb621697e41448cf6b230d2f4 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Aug 2014 11:43:24 -0700 Subject: [PATCH 3/5] SES: add enclosure logical id Export the NAA logical id for the enclosure. This is optionally available from the sas_transport_class, but it is really a property of the enclosure. Signed-off-by: Dan Williams Signed-off-by: Song Liu Reviewed-by: Jens Axboe Cc: Hannes Reinecke --- drivers/misc/enclosure.c | 13 + drivers/scsi/ses.c| 9 + include/linux/enclosure.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 15faf61..18b87de 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -395,8 +395,21 @@ static ssize_t components_show(struct device *cdev, } static DEVICE_ATTR_RO(components); +static ssize_t id_show(struct device *cdev, +struct device_attribute *attr, +char *buf) +{ + struct enclosure_device *edev = to_enclosure_device(cdev); + + if (edev->cb->show_id) + return edev->cb->show_id(edev, buf); + return -EINVAL; +} +static DEVICE_ATTR_RO(id); + static struct attribute *enclosure_class_attrs[] = { &dev_attr_components.attr, + &dev_attr_id.attr, NULL, }; ATTRIBUTE_GROUPS(enclosure_class); diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 87cf970b..696d5d8 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -258,6 +258,14 @@ static int ses_set_active(struct enclosure_device *edev, return ses_set_page2_descriptor(edev, ecomp, desc); } +static int ses_show_id(struct enclosure_device *edev, char *buf) +{ + struct ses_device *ses_dev = edev->scratch; + unsigned long long id = get_unaligned_be64(ses_dev->page1+8+4); + + return sprintf(buf, "%#llx\n", id); +} + static struct enclosure_component_callbacks ses_enclosure_callbacks = { .get_fault = ses_get_fault, .set_fault = ses_set_fault, @@ -265,6 +273,7 @@ static struct enclosure_component_callbacks ses_enclosure_callbacks = { .get_locate = ses_get_locate, .set_locate = ses_set_locate, .set_active = ses_set_active, + .show_id= ses_show_id, }; struct ses_host_edev { diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index a835d33..807622b 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h @@ -79,6 +79,7 @@ struct enclosure_component_callbacks { int (*set_locate)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting); + int (*show_id)(struct enclosure_device *, char *buf); }; -- 1.8.1 > -Original Message- > From: Hannes Reinecke [mailto:h...@suse.de] > Sent: Thursday, September 4, 2014 12:55 AM > To: Song Liu; linux-scsi@vger.kernel.org > Cc: Dan Williams; Jens Axboe > Subject: Re: [PATCH 3/5] SES: add enclosure logical id > > On 08/25/2014 07:34 PM, Song Liu wrote: > > From: Song Liu [mailto:songliubrav...@fb.com] > > Sent: Monday, August 25, 2014 10:26 AM > > To: Song Liu > > Cc: Dan Williams; Hannes Reinecke > > Subject: [PATCH 3/5] SES: add enclosure logical id > > > > From: Dan Williams > > > > Export the NAA logical id for the enclosure. This is optionally available > from the sas_transport_class, but it is really a property of the enclosure. > > > > Signed-off-by: Dan Williams > > Signed-off-by: Song Liu > > Reviewed-by: Jens Axboe > > Cc: Hannes Reinecke > > --- > > drivers/misc/enclosure.c | 13 + > > drivers/scsi/ses.c| 9 + > > include/linux/enclosure.h | 1 + > > 3 files changed, 23 insertions(+) > > > > diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index > > 15faf61..646068a 100644 > > --- a/drivers/misc/enclosure.c > > +++ b/drivers/misc/enclosure.c > > @@ -395,8 +395,21 @@ static ssize_t components_show(struct device > > *cdev, } static DEVICE_ATTR_RO(components); > > > > +static ssize_t id_show(struct device *cdev, > > +struct device_attribute *attr, > > +char *buf) > > +{ > > + struct enclosure_device *edev = to_enclosure_device(cdev); > > + > > + if (edev->cb->show_id) > > + return edev->cb->show_id(edev, buf); > > + return 0; > > +} > > +static DEVICE_ATTR_RO(id); > > + > > static struct attribute *enclosure_class_attrs[] = { > > &dev_attr_components.attr, > > + &dev_attr_id.attr, > > NULL, > > }; > > ATTRIBUTE_GROUPS(enclosure_class); > > Maybe you should return -EINVAL or something here; '0' would mean an > enclosure id of length '0', which is a different meaning from 'enclosure id > not > available'. > > > diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index > > 8f0a62a..61deb4
RE: [PATCH 4/5] SES: add reliable slot attribute
>From 1cb4f9b4c57425cc3462b9615ac5bd013f7f4a88 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Aug 2014 11:43:26 -0700 Subject: [PATCH 4/5] SES: add reliable slot attribute The name provided by firmware is in a vendor specific format, publish the slot number to have a reliable mechanism for identifying slots across firmware implementations. If the enclosure does not provide a slot number fallback to the component number which is guaranteed unique, and usually mirrors the slot number. Cleaned up the unused ses_component.desc in the process. Signed-off-by: Dan Williams Signed-off-by: Song Liu Reviewed-by: Jens Axboe Reviewed-by: Hannes Reinecke --- drivers/misc/enclosure.c | 20 +++- drivers/scsi/ses.c| 17 - include/linux/enclosure.h | 1 + 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 18b87de..2e3eafa 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -145,8 +145,10 @@ enclosure_register(struct device *dev, const char *name, int components, if (err) goto err; - for (i = 0; i < components; i++) + for (i = 0; i < components; i++) { edev->component[i].number = -1; + edev->component[i].slot = -1; + } mutex_lock(&container_list_lock); list_add_tail(&edev->node, &container_list); @@ -552,6 +554,20 @@ static ssize_t get_component_type(struct device *cdev, return snprintf(buf, 40, "%s\n", enclosure_type[ecomp->type]); } +static ssize_t get_component_slot(struct device *cdev, + struct device_attribute *attr, char *buf) +{ + struct enclosure_component *ecomp = to_enclosure_component(cdev); + int slot; + + /* if the enclosure does not override then use 'number' as a stand-in */ + if (ecomp->slot >= 0) + slot = ecomp->slot; + else + slot = ecomp->number; + + return snprintf(buf, 40, "%d\n", slot); +} static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault, set_component_fault); @@ -562,6 +578,7 @@ static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active, static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, set_component_locate); static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL); +static DEVICE_ATTR(slot, S_IRUGO, get_component_slot, NULL); static struct attribute *enclosure_component_attrs[] = { &dev_attr_fault.attr, @@ -569,6 +586,7 @@ static struct attribute *enclosure_component_attrs[] = { &dev_attr_active.attr, &dev_attr_locate.attr, &dev_attr_type.attr, + &dev_attr_slot.attr, NULL }; ATTRIBUTE_GROUPS(enclosure_component); diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 696d5d8..3e59a5d 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -47,7 +47,6 @@ struct ses_device { struct ses_component { u64 addr; - unsigned char *desc; }; static int ses_probe(struct device *dev) @@ -307,19 +306,26 @@ static void ses_process_descriptor(struct enclosure_component *ecomp, int invalid = desc[0] & 0x80; enum scsi_protocol proto = desc[0] & 0x0f; u64 addr = 0; + int slot = -1; struct ses_component *scomp = ecomp->scratch; unsigned char *d; - scomp->desc = desc; - if (invalid) return; switch (proto) { + case SCSI_PROTOCOL_FCP: + if (eip) { + d = desc + 4; + slot = d[3]; + } + break; case SCSI_PROTOCOL_SAS: - if (eip) + if (eip) { + d = desc + 4; + slot = d[3]; d = desc + 8; - else + } else d = desc + 4; /* only take the phy0 addr */ addr = (u64)d[12] << 56 | @@ -335,6 +341,7 @@ static void ses_process_descriptor(struct enclosure_component *ecomp, /* FIXME: Need to add more protocols than just SAS */ break; } + ecomp->slot = slot; scomp->addr = addr; } diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 807622b..0f826c1 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h @@ -92,6 +92,7 @@ struct enclosure_component { int fault; int active; int locate; + int slot; enum enclosure_status status; }; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/5] SES: generate KOBJ_CHANGE on enclosure attach
>From 741aa4b6043af741e28c0c414d48249f878353dc Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Aug 2014 11:43:22 -0700 Subject: [PATCH 2/5] SES: generate KOBJ_CHANGE on enclosure attach In support of a /dev/disk/by-slot populated with data from the enclosure and ses modules udev needs notification when the new interface files/links are available. Otherwise, any udev rules specified for the disk cannot assume that the enclosure topology has settled. Signed-off-by: Dan Williams Signed-off-by: Song Liu Reviewed-by: Jens Axboe Reviewed-by: Hannes Reinecke --- drivers/scsi/ses.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index c52fd98..87cf970b 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -349,7 +349,8 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev, if (scomp->addr != efd->addr) continue; - enclosure_add_device(edev, i, efd->dev); + if (enclosure_add_device(edev, i, efd->dev) == 0) + kobject_uevent(&efd->dev->kobj, KOBJ_CHANGE); return 1; } return 0; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/5] SES: close potential registration race
>From 22d9dbcd783b315aaf59ad3eb928addaf0fba5fa Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Aug 2014 11:42:46 -0700 Subject: [PATCH 1/5] SES: close potential registration race The slot and address fields have a small window of instability when userspace can read them before initialization. Separate enclosure_component allocation from registration. Signed-off-by: Dan Williams Signed-off-by: Song Liu Reviewed-by: Jens Axboe Cc: Hannes Reinecke --- drivers/misc/enclosure.c | 36 +--- drivers/scsi/ses.c| 21 ++--- include/linux/enclosure.h | 5 +++-- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 2cf2bbc..15faf61 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -249,27 +249,25 @@ static void enclosure_component_release(struct device *dev) static const struct attribute_group *enclosure_component_groups[]; /** - * enclosure_component_register - add a particular component to an enclosure + * enclosure_component_alloc - prepare a new enclosure component * @edev: the enclosure to add the component * @num: the device number * @type: the type of component being added * @name: an optional name to appear in sysfs (leave NULL if none) * - * Registers the component. The name is optional for enclosures that - * give their components a unique name. If not, leave the field NULL - * and a name will be assigned. + * The name is optional for enclosures that give their components a unique + * name. If not, leave the field NULL and a name will be assigned. * * Returns a pointer to the enclosure component or an error. */ struct enclosure_component * -enclosure_component_register(struct enclosure_device *edev, -unsigned int number, -enum enclosure_component_type type, -const char *name) +enclosure_component_alloc(struct enclosure_device *edev, + unsigned int number, + enum enclosure_component_type type, + const char *name) { struct enclosure_component *ecomp; struct device *cdev; - int err; if (number >= edev->components) return ERR_PTR(-EINVAL); @@ -291,14 +289,30 @@ enclosure_component_register(struct enclosure_device *edev, cdev->release = enclosure_component_release; cdev->groups = enclosure_component_groups; + return ecomp; +} +EXPORT_SYMBOL_GPL(enclosure_component_alloc); + +/** + * enclosure_component_register - publishes an initialized enclosure component + * @ecomp: component to add + * + * Returns 0 on successful registration, releases the component otherwise + */ +int enclosure_component_register(struct enclosure_component *ecomp) +{ + struct device *cdev; + int err; + + cdev = &ecomp->cdev; err = device_register(cdev); if (err) { ecomp->number = -1; put_device(cdev); - return ERR_PTR(err); + return err; } - return ecomp; + return 0; } EXPORT_SYMBOL_GPL(enclosure_component_register); diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 80bfece..c52fd98 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -423,16 +423,23 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) { if (create) - ecomp = enclosure_component_register(edev, - components++, - type_ptr[0], - name); + ecomp = enclosure_component_alloc( + edev, + components++, + type_ptr[0], + name); else ecomp = &edev->component[components++]; - if (!IS_ERR(ecomp) && addl_desc_ptr) - ses_process_descriptor(ecomp, - addl_desc_ptr); + if (!IS_ERR(ecomp)) { + if (addl_desc_ptr) + ses_process_descriptor( + ecomp, + addl_desc_ptr); +
randconfig build error with next-20140912, in drivers/scsi/xen-scsifront.c
Building with the attached random configuration file, drivers/built-in.o: In function `scsifront_init': xen-scsifront.c:(.init.text+0x6069): undefined reference to `xenbus_register_frontend' make: *** [vmlinux] Error 1 # # Automatically generated file; DO NOT EDIT. # Linux/x86 3.17.0-rc4 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_MMU=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ZONE_DMA32=y CONFIG_AUDIT_ARCH=y CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_X86_64_SMP=y CONFIG_X86_HT=y CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" CONFIG_COMPILE_TEST=y CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set CONFIG_DEFAULT_HOSTNAME="(none)" CONFIG_SWAP=y # CONFIG_SYSVIPC is not set CONFIG_POSIX_MQUEUE=y # CONFIG_CROSS_MEMORY_ATTACH is not set # CONFIG_FHANDLE is not set CONFIG_USELIB=y # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y CONFIG_GENERIC_PENDING_IRQ=y CONFIG_IRQ_DOMAIN=y # CONFIG_IRQ_DOMAIN_DEBUG is not set CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y # # Timers subsystem # CONFIG_HZ_PERIODIC=y # CONFIG_NO_HZ_IDLE is not set # CONFIG_NO_HZ_FULL is not set # CONFIG_NO_HZ is not set # CONFIG_HIGH_RES_TIMERS is not set # # CPU/Task time and stats accounting # CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set CONFIG_BSD_PROCESS_ACCT=y # CONFIG_BSD_PROCESS_ACCT_V3 is not set # CONFIG_TASKSTATS is not set # # RCU Subsystem # CONFIG_TREE_RCU=y # CONFIG_PREEMPT_RCU is not set CONFIG_TASKS_RCU=y CONFIG_RCU_STALL_COMMON=y # CONFIG_RCU_USER_QS is not set CONFIG_RCU_FANOUT=64 CONFIG_RCU_FANOUT_LEAF=16 CONFIG_RCU_FANOUT_EXACT=y # CONFIG_TREE_RCU_TRACE is not set CONFIG_RCU_NOCB_CPU=y CONFIG_RCU_NOCB_CPU_NONE=y # CONFIG_RCU_NOCB_CPU_ZERO is not set # CONFIG_RCU_NOCB_CPU_ALL is not set CONFIG_BUILD_BIN2C=y CONFIG_IKCONFIG=y CONFIG_LOG_BUF_SHIFT=17 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y CONFIG_ARCH_SUPPORTS_INT128=y # CONFIG_NUMA_BALANCING is not set # CONFIG_CGROUPS is not set CONFIG_CHECKPOINT_RESTORE=y CONFIG_NAMESPACES=y # CONFIG_UTS_NS is not set # CONFIG_IPC_NS is not set # CONFIG_USER_NS is not set # CONFIG_PID_NS is not set # CONFIG_NET_NS is not set # CONFIG_SCHED_AUTOGROUP is not set CONFIG_SYSFS_DEPRECATED=y # CONFIG_SYSFS_DEPRECATED_V2 is not set CONFIG_RELAY=y # CONFIG_BLK_DEV_INITRD is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_ANON_INODES=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_HAVE_PCSPKR_PLATFORM=y CONFIG_EXPERT=y # CONFIG_SGETMASK_SYSCALL is not set # CONFIG_SYSFS_SYSCALL is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y # CONFIG_PRINTK is not set # CONFIG_BUG is not set CONFIG_PCSPKR_PLATFORM=y # CONFIG_BASE_FULL is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SIGNALFD=y CONFIG_TIMERFD=y # CONFIG_EVENTFD is not set CONFIG_SHMEM=y CONFIG_AIO=y CONFIG_PCI_QUIRKS=y # CONFIG_EMBEDDED is not set CONFIG_HAVE_PERF_EVENTS=y # # Kernel Performance Events And Counters # CONFIG_PERF_EVENTS=y # CONFIG_DEBUG_PERF_USE_VMALLOC is not set # CONFIG_VM_EVENT_COUNTERS is not set # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set
Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM
On Tue, Sep 9, 2014 at 4:03 PM, Tejun Heo wrote: > On Tue, Sep 09, 2014 at 12:25:29PM +0900, Tejun Heo wrote: >> Hello, >> >> On Mon, Sep 08, 2014 at 08:19:12PM -0700, Luis R. Rodriguez wrote: >> > On the systemd side of things it should enable this sysctl and for >> > older kernels what should it do? >> >> Supposing the change is backported via -stable, it can try to set the >> sysctl on all kernels. If the knob doesn't exist, the fix is not >> there and nothing can be done about it. > > The more I think about it, the more I think this should be a > per-insmod instance thing rather than a system-wide switch. Agreed, a good use case that comes to mind would be systemd's modules-load.d lists used by systemd services to require modules, the hooks there however likely expect probe to complete as part of the service, since the timeout is not applicable to these the synchronous probe for them would be good while systemd would use async probe for regular modules. > Currently > the kernel param code doesn't allow a generic param outside the ones > specified by the module itself but adding support for something like > driver.async_load=1 shouldn't be too difficult, applying that to > existing systems shouldn't be much more difficult than a system-wide > switch, and it'd be siginificantly cleaner than fiddling with driver > blacklist. Agreed. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [systemd-devel] [RFC v2 3/6] kthread: warn on kill signal if not OOM
On Thu, Sep 11, 2014 at 10:48 PM, Tom Gundersen wrote: > On Fri, Sep 12, 2014 at 12:26 AM, Luis R. Rodriguez > wrote: >> On Thu, Sep 11, 2014 at 2:43 PM, Tom Gundersen wrote: >>> How about simply introducing a new flag to finit_module() to indicate >>> that the caller does not care about asynchronicity. We could then pass >>> this from udev, but existing scripts calling modprobe/insmod will not >>> be affected. >> >> Do you mean that you *do want asynchronicity*? > > Precisely, udev would opt-in, but existing scripts etc would not. Sure that's the other alternative that Tejun was mentioning. >>> But isn't finit_module() taking a long time a serious problem given >>> that it means no other module can be loaded in parallel? >> >> Indeed but having a desire to make the init() complete fast is >> different than the desire to have the combination of both init and >> probe fast synchronously. > > I guess no one is arguing that probe should somehow be required to be > fast, but rather: > >> If userspace wants init to be fast and let >> probe be async then userspace has no option but to deal with the fact >> that async probe will be async, and it should then use other methods >> to match any dependencies if its doing that itself. > > Correct. And this therefore likely needs to be opt-in behaviour per > finit_module() invocation to avoid breaking old assumptions. Sure. >> For example >> networking should not kick off after a network driver is loaded but >> rather one the device creeps up on udev. We should be good with >> networking dealing with this correctly today but not sure about other >> subsystems. depmod should be able to load the required modules in >> order and if bus drivers work right then probe of the remnant devices >> should happen asynchronously. The one case I can think of that is a >> bit different is modules-load.d things but those *do not rely on the >> timeout*, but are loaded prior to a service requirement. Note though >> that if those modules had probe and they then run async'd then systemd >> service would probably need to consider that the requirements may not >> be there until later. If this is not carefully considered that could >> introduce regression to users of modules-load.d when async probe is >> fully deployed. The same applies to systemd making assumptions of kmod >> loading a module and a dependency being complete as probe would have >> run it before. > > Yeah, these all needs to be considered when deciding whether or not to > enable async in each specific case. Yes and come to think of it I'd recommend opting out of async functionality for modules-load.d given that it does *not* hooked with the timeout and there is a good chances its users likely do want to wait for probe to run at this point. Given this I also am inclined now for the per module request to be async or not (default) from userspace. The above would be a good example starting use case. >> I believe one concern here lies in on whether or not userspace >> is properly equipped to deal with the requirements on module loading >> doing async probing and that possibly failing. Perhaps systemd might >> think all userspace is ready for that but are we sure that's the case? > > There almost certainly are custom things out there relying on the > synchronous behaviour, but if we make it opt-in we should not have a > problem. Indeed. BTW as for the cxgb4 device driver it fails to load because it relies on get_vpd_params() on probe, that end sup calling pci_vpd_pci22_wait() which will fail if if fatal_signal_pending(current). This is an example now completely unrelated to the OOM series, and any other uses of fatal_signal_pending(current) should trigger similar failures on device drivers. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [REGRESSION 3.17] scsi (uas) disks no longer using tagged command queuing
Hi, On 09/11/2014 06:13 PM, Christoph Hellwig wrote: > On Thu, Sep 11, 2014 at 12:01:13PM +0200, Hans de Goede wrote: >>> So we're initializing the tag map, but scsi_activate_tcq doesn't pick it >>> up. I can't really come up with a good explanation for it, but there >>> even without that there is an elephant in the room: as part of the >>> scsi-mq series I moved the bqt field used for this into a union with the >>> new blk_mq_tag_set. Below is a patch to get rid of that union, can you >>> try if that fixes it? >> >> Unfortunately that does not fix it :| > > Alright, I guess we need the big bisect hammer unfortunately. > > We should be able to start with trying the first and last commit > of the big SCSI merge: > > start: fcc95a763444017288b318d48367098850c23c0d > end: c21a2c1a4973c8dde32557970fdb44eaa9489aeb The bisect points to: [hans@shalem linux]$ git bisect bad Bisecting: 0 revisions left to test after this (roughly 0 steps) [d285203cf647d7c97db3a1c33794315c9008593f] scsi: add support for a blk-mq based I/O path. I've double checked that that commit is bad, and one commit earlier in the history is good, so that really is the one. I've tried again to fix the union thing you spotted, which is introduced by that commit, and again it does not help. I've taken a quick look at the commit, and my guess with be this has something to do with the changes surrounding __scsi_alloc_queue . Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
from: Arpit Patel
Sup linux http://www.gayarabsex.info/fish.php?rich=rhggrzeb3286ezduyw Arpit Patel N�r��yb�X��ǧv�^�){.n�+{���"�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i
Re: Block/SCSI data integrity update v3
On 09/10/2014 06:23 PM, Martin K. Petersen wrote: >> "Jens" == Jens Axboe writes: > > Jens> Thanks, I'll do that once Martin respins the previous series (was > Jens> pulled due to multiple issues). > > I bumped bi_rw to u64 as discussed. Will get that into -next to see if > there's any fallout. Don't push it into -next, start with having it in a branch somewhere where Wu's automagic robots will pick it up. If they don't already, email Wu and get that done! -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 14/14] sd: Honor block layer integrity handling flags
> "Sagi" == Sagi Grimberg writes: Sagi, Sagi> I see, It's just confusing to see flags such as Sagi> REF_INCREMENT/GUARD_CHECK/REF_CHECK associated with a set of prot Sagi> operations, but I guess it's just me. Do you really need the mask Sagi> anyway? seems like just an extra precaution against wrong Sagi> flagging. I did it this way to avoid having several additional special cases in the hot path. Instead I apply a mask at the end to filter out any flags that would be invalid for that particular protection operation. It simplified the protection prep code significantly. I was also afraid of drivers blindly using the flags to fill out IOCB fields. I was guilty of that myself in the ones I converted and it tripped firmware errors in several cases during qualification runs. So I decided to be on the defensive side about the flags I send down to the LLD. I'd also rather have that filtering encapsulated in single location instead of every driver having to figure out whether it's being presented with a valid combination of flags or not. Sagi> Nice, I posted "RDMA signature feature update" preparing iSER DIF Sagi> code to complement this change - all that is left now is a Sagi> straight-forward conversion. Great! -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
On Fri, Sep 12, 2014 at 01:24:08PM +0530, Suman Tripathi wrote: > This patch fixes the error print invalid resource for the APM X-Gene > SoC AHCI SATA Host Controller driver. This print was due to the fact > that the controller 3 don't have a mux resource. This didn't result > in any errors but the print seems like meaningless. > > Signed-off-by: Loc Ho > Signed-off-by: Suman Tripathi > --- > drivers/ata/ahci_xgene.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c > index 40d0a76..9404db0c 100644 > --- a/drivers/ata/ahci_xgene.c > +++ b/drivers/ata/ahci_xgene.c > @@ -434,7 +434,7 @@ static int xgene_ahci_mux_select(struct > xgene_ahci_context *ctx) > u32 val; > > /* Check for optional MUX resource */ > - if (IS_ERR(ctx->csr_mux)) > + if (!ctx->csr_mux) > return 0; Hmmm? So, if devm_ioremap_resource() call actually fails, now the function tries to operation on ERR_PTR() value as a real pointer? Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 2/2] arcmsr: simplify of updating doneq_index and postq_index
On 09/12/2014 10:22 AM, Ching Huang wrote: > From: Ching Huang > > This patch is to modify previous patch 16/17 and it is relative to > http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr > > change in v4: > 1. clean up of duplicate variable declaration in switch. > 2. simplify of updating doneq_index and postq_index > 3. fix spin_lock area in arcmsr_hbaD_polling_ccbdone The intention of the doneq_lock is to protect the pmu->doneq_index and the associated buffer, right? Why is the spinlock not used on other places accessing the doneq_index like arcmsr_done4abort_postqueue or arcmsr_hbaD_postqueue_isr ? And in arcmsr_hbaD_polling_ccbdone the code looks so: spin_unlock_irqrestore(&acb->doneq_lock, flags); doneq_index = pmu->doneq_index; flag_ccb = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow; you unlock^ and after that is the value read and used Seems to me that I probably don't understand what the spinlock should protect. Could you explain ? Thanks, Tomas > > Signed-off-by: Ching Huang > --- > > diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c > b/drivers/scsi/arcmsr/arcmsr_hba.c > --- a/drivers/scsi/arcmsr/arcmsr_hba.c2014-09-12 12:43:16.956653000 > +0800 > +++ b/drivers/scsi/arcmsr/arcmsr_hba.c2014-09-12 15:00:23.516069000 > +0800 > @@ -1121,7 +1121,7 @@ static void arcmsr_drain_donequeue(struc > static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb) > { > int i = 0; > - uint32_t flag_ccb; > + uint32_t flag_ccb, ccb_cdb_phy; > struct ARCMSR_CDB *pARCMSR_CDB; > bool error; > struct CommandControlBlock *pCCB; > @@ -1165,10 +1165,6 @@ static void arcmsr_done4abort_postqueue( > break; > case ACB_ADAPTER_TYPE_C: { > struct MessageUnit_C __iomem *reg = acb->pmuC; > - struct ARCMSR_CDB *pARCMSR_CDB; > - uint32_t flag_ccb, ccb_cdb_phy; > - bool error; > - struct CommandControlBlock *pCCB; > while ((readl(®->host_int_status) & > ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { > /*need to do*/ > flag_ccb = readl(®->outbound_queueport_low); > @@ -1182,10 +1178,8 @@ static void arcmsr_done4abort_postqueue( > break; > case ACB_ADAPTER_TYPE_D: { > struct MessageUnit_D *pmu = acb->pmuD; > - uint32_t ccb_cdb_phy, outbound_write_pointer; > - uint32_t doneq_index, index_stripped, addressLow, residual; > - bool error; > - struct CommandControlBlock *pCCB; > + uint32_t outbound_write_pointer; > + uint32_t doneq_index, index_stripped, addressLow, residual, > toggle; > > outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1; > doneq_index = pmu->doneq_index; > @@ -1193,23 +1187,11 @@ static void arcmsr_done4abort_postqueue( > for (i = 0; i < residual; i++) { > while ((doneq_index & 0xFFF) != > (outbound_write_pointer & 0xFFF)) { > - if (doneq_index & 0x4000) { > - index_stripped = doneq_index & 0xFFF; > - index_stripped += 1; > - index_stripped %= > - ARCMSR_MAX_ARC1214_DONEQUEUE; > - pmu->doneq_index = index_stripped ? > - (index_stripped | 0x4000) : > - (index_stripped + 1); > - } else { > - index_stripped = doneq_index; > - index_stripped += 1; > - index_stripped %= > - ARCMSR_MAX_ARC1214_DONEQUEUE; > - pmu->doneq_index = index_stripped ? > - index_stripped : > - ((index_stripped | 0x4000) + 1); > - } > + toggle = doneq_index & 0x4000; > + index_stripped = (doneq_index & 0xFFF) + 1; > + index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE; > + pmu->doneq_index = index_stripped ? > (index_stripped | toggle) : > + ((toggle ^ 0x4000) + 1); > doneq_index = pmu->doneq_index; > addressLow = pmu->done_qbuffer[doneq_index & > 0xFFF].addressLow; > @@ -1461,7 +1443,7 @@ static void arcmsr_post_ccb(struct Adapt > case ACB_ADA
[PATCH RESEND 05/11] megaraid_sas : Extended VD support
Resending the patch. Addressed the review comments from Tomas Henzl. reserved1 field(part of union) of Raid map struct was not required so it is removed. Current MegaRAID firmware and hence the driver only supported 64VDs. E.g: If the user wants to create more than 64VD on a controller, it is not possible on current firmware/driver. New feature and requirement to support upto 256VD, firmware/driver/apps need changes. In addition to that there must be a backward compatibility of the new driver with the older firmware and vice versa. RAID map is the interface between Driver and FW to fetch all required fields(attributes) for each Virtual Drives. In the earlier design driver was using the FW copy of RAID map where as in the new design the Driver will keep the RAID map copy of its own; on which it will operate for any raid map access in fast path. Local driver raid map copy will provide ease of access through out the code and provide generic interface for future FW raid map changes. For the backward compatibility driver will notify FW that it supports 256VD to the FW in driver capability field. Based on the controller properly returned by the FW, the Driver will know whether it supports 256VD or not and will copy the RAID map accordingly. At any given time, driver will always have old or new Raid map. So with this changes, driver can also work in host lock less mode. Please see next patch which enable host lock less mode for megaraid_sas driver. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h| 73 +++--- drivers/scsi/megaraid/megaraid_sas_base.c | 205 drivers/scsi/megaraid/megaraid_sas_fp.c | 195 ++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 118 drivers/scsi/megaraid/megaraid_sas_fusion.h | 94 - 5 files changed, 500 insertions(+), 185 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index e0f03e2..5dedf09 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -390,7 +390,6 @@ enum MR_LD_QUERY_TYPE { #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db #define MR_EVT_LD_OFFLINE 0x00fc #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 -#define MAX_LOGICAL_DRIVES 64 enum MR_PD_STATE { MR_PD_STATE_UNCONFIGURED_GOOD = 0x00, @@ -468,14 +467,14 @@ struct MR_LD_LIST { u8 state; u8 reserved[3]; u64 size; - } ldList[MAX_LOGICAL_DRIVES]; + } ldList[MAX_LOGICAL_DRIVES_EXT]; } __packed; struct MR_LD_TARGETID_LIST { u32 size; u32 count; u8 pad[3]; - u8 targetId[MAX_LOGICAL_DRIVES]; + u8 targetId[MAX_LOGICAL_DRIVES_EXT]; }; @@ -941,6 +940,15 @@ struct megasas_ctrl_info { * HA cluster information */ struct { +#if defined(__BIG_ENDIAN_BITFIELD) + u32 reserved:26; + u32 premiumFeatureMismatch:1; + u32 ctrlPropIncompatible:1; + u32 fwVersionMismatch:1; + u32 hwIncompatible:1; + u32 peerIsIncompatible:1; + u32 peerIsPresent:1; +#else u32 peerIsPresent:1; u32 peerIsIncompatible:1; u32 hwIncompatible:1; @@ -948,6 +956,7 @@ struct megasas_ctrl_info { u32 ctrlPropIncompatible:1; u32 premiumFeatureMismatch:1; u32 reserved:26; +#endif } cluster; char clusterId[16]; /*7D4h */ @@ -962,9 +971,17 @@ struct megasas_ctrl_info { #if defined(__BIG_ENDIAN_BITFIELD) u32 reserved:25; u32 supportCrashDump:1; - u32 reserved1:6; + u32 supportMaxExtLDs:1; + u32 supportT10RebuildAssist:1; + u32 supportDisableImmediateIO:1; + u32 supportThermalPollInterval:1; + u32 supportPersonalityChange:2; #else - u32 reserved1:6; + u32 supportPersonalityChange:2; + u32 supportThermalPollInterval:1; + u32 supportDisableImmediateIO:1; + u32 supportT10RebuildAssist:1; + u32 supportMaxExtLDs:1; u32 supportCrashDump:1; u32 reserved:25; #endif @@ -979,13 +996,12 @@ struct megasas_ctrl_info { * === */ #define MEGASAS_MAX_PD_CHANNELS2 -#define MEGASAS_MAX_LD_CHANNELS1 +#define MEGASAS_MAX_LD_CHANNELS2 #define MEGASAS_MAX_CHANNELS
[PATCH RESEND 07/11] megaraid_sas : Round down max sge supported by controller to power of two
Resending the patch. Addressed the review comments from Tomas Henzl. Round down the max sge to power of two. Earlier max sge limit is 70 SGE, which will allow block layer to send 280K IO frame. It is optimal to provide max IO size aligned to the smallest possible stripe size. E.a Consider that we have configured RAID Volumes which does not allow Fast Path across the stripe. Raid volume with stripe size = 256K, will have peformance hit if we get io frame of size 280K. Driver will not send IO frame large than stripe size to the Fast Path. Also, FW will convert 280K frame into 256K + 24K. This is an additional overhead. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ed24a84..d35ac34 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1001,8 +1001,8 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) fusion->max_sge_in_chain = MEGASAS_MAX_SZ_CHAIN_FRAME / sizeof(union MPI2_SGE_IO_UNION); - instance->max_num_sge = fusion->max_sge_in_main_msg + - fusion->max_sge_in_chain - 2; + instance->max_num_sge = rounddown_pow_of_two( + fusion->max_sge_in_main_msg + fusion->max_sge_in_chain - 2); /* Used for pass thru MFI frame (DCMD) */ fusion->chain_offset_mfi_pthru = -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/2] arcmsr: simplify ioctl data read/write
On 09/12/2014 09:29 AM, Ching Huang wrote: > From: Ching Huang > > This patch is to modify previous patch 13/17 and it is relative to > http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr > > change in v4: > 1. for readability, rename firstindex to getIndex, rename lastindex to > putIndex For some reason, the names head+tail areusual for a circular buffer. But let us ignore the names, I don't care. > 2. define ARCMSR_API_DATA_BUFLEN as 1032 > 3. simplify ioctl data read by macro CIRC_CNT_TO_END and CIRC_CNT It's definitely better when you post renames and other non-functional changes in separate patches, it's easier for the reviewer. > > Signed-off-by: Ching Huang > --- > > diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c > b/drivers/scsi/arcmsr/arcmsr_attr.c > --- a/drivers/scsi/arcmsr/arcmsr_attr.c 2014-08-21 12:14:27.0 > +0800 > +++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2014-09-12 15:18:46.659125000 > +0800 > @@ -50,6 +50,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -68,7 +69,7 @@ static ssize_t arcmsr_sysfs_iop_message_ > struct device *dev = container_of(kobj,struct device,kobj); > struct Scsi_Host *host = class_to_shost(dev); > struct AdapterControlBlock *acb = (struct AdapterControlBlock *) > host->hostdata; > - uint8_t *pQbuffer,*ptmpQbuffer; > + uint8_t *ptmpQbuffer; > int32_t allxfer_len = 0; > unsigned long flags; > > @@ -78,57 +79,22 @@ static ssize_t arcmsr_sysfs_iop_message_ > /* do message unit read. */ > ptmpQbuffer = (uint8_t *)buf; > spin_lock_irqsave(&acb->rqbuffer_lock, flags); > - if (acb->rqbuf_firstindex != acb->rqbuf_lastindex) { > - pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex]; > - if (acb->rqbuf_firstindex > acb->rqbuf_lastindex) { > - if ((ARCMSR_MAX_QBUFFER - acb->rqbuf_firstindex) >= > 1032) { > - memcpy(ptmpQbuffer, pQbuffer, 1032); > - acb->rqbuf_firstindex += 1032; > - acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER; > - allxfer_len = 1032; > - } else { > - if (((ARCMSR_MAX_QBUFFER - > acb->rqbuf_firstindex) > - + acb->rqbuf_lastindex) > 1032) { > - memcpy(ptmpQbuffer, pQbuffer, > - ARCMSR_MAX_QBUFFER > - - acb->rqbuf_firstindex); > - ptmpQbuffer += ARCMSR_MAX_QBUFFER > - - acb->rqbuf_firstindex; > - memcpy(ptmpQbuffer, acb->rqbuffer, 1032 > - - (ARCMSR_MAX_QBUFFER - > - acb->rqbuf_firstindex)); > - acb->rqbuf_firstindex = 1032 - > - (ARCMSR_MAX_QBUFFER - > - acb->rqbuf_firstindex); > - allxfer_len = 1032; > - } else { > - memcpy(ptmpQbuffer, pQbuffer, > - ARCMSR_MAX_QBUFFER - > - acb->rqbuf_firstindex); > - ptmpQbuffer += ARCMSR_MAX_QBUFFER - > - acb->rqbuf_firstindex; > - memcpy(ptmpQbuffer, acb->rqbuffer, > - acb->rqbuf_lastindex); > - allxfer_len = ARCMSR_MAX_QBUFFER - > - acb->rqbuf_firstindex + > - acb->rqbuf_lastindex; > - acb->rqbuf_firstindex = > - acb->rqbuf_lastindex; > - } > - } > - } else { > - if ((acb->rqbuf_lastindex - acb->rqbuf_firstindex) > > 1032) { > - memcpy(ptmpQbuffer, pQbuffer, 1032); > - acb->rqbuf_firstindex += 1032; > - allxfer_len = 1032; > - } else { > - memcpy(ptmpQbuffer, pQbuffer, > acb->rqbuf_lastindex > - - acb->rqbuf_firstindex); > - allxfer_len = acb->rqbuf_lastindex - > - acb->rqbuf_firstindex; > - acb->rqbuf_firstindex = acb->rqbuf_lastindex; > - } > + if (acb->rqbuf_getIndex != acb->r
[PATCH RESEND 06/11] megaraid_sas : Host lock less mode to enabled asynchronous IO submission
Resending the patch. Addressed the review comments from Tomas Henzl. Megaraid_sas driver can now work in host lock less mode. Remove host lock less as megaraid_sas driver will have safer access to raid map as described in earlier patch. We now keep Driver Raid map copy, which will make sure that driver will always have old or new map Driver raid map will be replaced safely in MR_PopulateDrvRaidMap(), so there is no issue even if IO is continue from the scsi mid layer. There is a plan to remove "host_lock" and "hba_lock" usage from megaraid_sas in future. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_base.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index c7ddb12..bc79a05 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1536,7 +1536,7 @@ out_return_cmd: * @done: Callback entry point */ static int -megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) +megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) { struct megasas_instance *instance; unsigned long flags; @@ -1558,7 +1558,7 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd } else { spin_unlock_irqrestore(&instance->hba_lock, flags); scmd->result = DID_NO_CONNECT << 16; - done(scmd); + scmd->scsi_done(scmd); return 0; } } @@ -1566,7 +1566,7 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { spin_unlock_irqrestore(&instance->hba_lock, flags); scmd->result = DID_NO_CONNECT << 16; - done(scmd); + scmd->scsi_done(scmd); return 0; } @@ -1577,7 +1577,6 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd spin_unlock_irqrestore(&instance->hba_lock, flags); - scmd->scsi_done = done; scmd->result = 0; if (MEGASAS_IS_LOGICAL(scmd) && @@ -1607,12 +1606,10 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd return 0; out_done: - done(scmd); + scmd->scsi_done(scmd); return 0; } -static DEF_SCSI_QCMD(megasas_queue_command) - static struct megasas_instance *megasas_lookup_instance(u16 host_no) { int i; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 04/11] megaraid_sas : Firmware crash dump feature support
Resending the patch. Addressed the review comments from Tomas Henzl. Move buff_offset inside spinlock, corrected loop at crash dump buffer free, reset_devices check is added to disable fw crash dump feature in kdump kernel. This feature will provide similar interface as kernel crash dump feature. When megaraid firmware encounter any crash, driver will collect the firmware raw image and dump it into pre-configured location. Driver will allocate two different segment of memory. #1 Non-DMA able large buffer (will be allocated on demand) to capture actual FW crash dump. #2 DMA buffer (persistence allocation) just to do a arbitrator job. Firmware will keep writing Crash dump data in chucks of DMA buffer size into #2, which will be copy back by driver to the host memory as described in #1. Driver-Firmware interface: == A.) Host driver can allocate maximum 512MB Host memory to store crash dump data. This memory will be internal to the host and will not be exposed to the Firmware. Driver may not be able to allocate 512 MB. In that case, driver will do possible memory (available at run time) allocation to store crash dump data. Let’s call this buffer as Host Crash Buffer. Host Crash buffer will not be contigious as a whole, but it will have multiple chunk of contigious memory. This will be internal to driver and firmware/application are unaware of it. Partial allocation of Host Crash buffer may have valid information to debug depending upon what was collected in that buffer and depending on nature of failure. Complete Crash dump is the best case, but we do want to capture partial buffer just to grab something rather than nothing. Host Crash buffer will be allocated only when FW Crash dump data is available, and will be deallocated once application copy Host Crash buffer to the file. Host Crash buffer size can be anything between 1MB to 512MB. (It will be multiple of 1MBs) B.) Irrespective of underlying Firmware capability of crash dump support, driver will allocate DMA buffer at start of the day for each MR controllers. Let’s call this buffer as “DMA Crash Buffer”. For this feature, size of DMA crash buffer will be 1MB. (We will not gain much even if DMA buffer size is increased.) C.) Driver will now read Controller Info sending existing dcmd “MR_DCMD_CTRL_GET_INFO”. Driver should extract the information from ctrl info provided by firmware and figure out if firmware support crash dump feature or not. Driver will enable crash dump feature only if “Firmware support Crash dump” + “Driver was able to create DMA Crash Buffer”. If either one from above is not set, Crash dump feature should be disable in driver. Firmware will enable crash dump feature only if “Driver Send DCMD- MR_DCMD_SET_CRASH_BUF_PARA with MR_CRASH_BUF_TURN_ON” Helper application/script should use sysfs parameter fw_crash_xxx to actually copy data from host memory to the filesystem. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h| 58 +- drivers/scsi/megaraid/megaraid_sas_base.c | 294 +++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 172 +++- 3 files changed, 519 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index bc7adcf..e0f03e2 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -105,6 +105,9 @@ #define MFI_STATE_READY0xB000 #define MFI_STATE_OPERATIONAL 0xC000 #define MFI_STATE_FAULT0xF000 +#define MFI_STATE_FORCE_OCR0x0080 +#define MFI_STATE_DMADONE 0x0008 +#define MFI_STATE_CRASH_DUMP_DONE 0x0004 #define MFI_RESET_REQUIRED 0x0001 #define MFI_RESET_ADAPTER 0x0002 #define MEGAMFI_FRAME_SIZE 64 @@ -191,6 +194,9 @@ #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 #define MR_DCMD_PD_LIST_QUERY 0x02010100 +#define MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS 0x01190100 +#define MR_DRIVER_SET_APP_CRASHDUMP_MODE (0xF001 | 0x0600) + /* * Global functions */ @@ -264,6 +270,25 @@ enum MFI_STAT { }; /* + * Crash dump related defines + */ +#define MAX_CRASH_DUMP_SIZE 512 +#define CRASH_DMA_BUF_SIZE (1024 * 1024) + +enum MR_FW_CRASH_DUMP_STATE { + UNAVAILABLE = 0, + AVAILABLE = 1, + COPYING = 2, + COPIED = 3, + COPY_ERROR = 4, +}; + +enum _MR_CRASH_BUF_STATUS { + MR_CRASH_BUF_TURN_OFF = 0, + MR_CRASH_BUF_TURN_ON = 1, +}; + +/* * Number of mailbox bytes in DCMD message frame */ #define MFI_MBOX_SIZE 12 @@ -933,7 +958,19 @@ struct megasas_ctrl_info { u8 reserved; /*0x7E
[PATCH RESEND 02/11] megaraid_sas : Use writeq for 64bit pci write to avoid spinlock overhead
Resending the patch. Addressed the review comments from Tomas Henzl. Reduce the assingment for u64 req_data variable. Use writeq() for 64bit PCI write instead of writel() to avoid additional lock overhead. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 57b47fe..8898817 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1065,6 +1065,11 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance, u32 req_desc_hi, struct megasas_register_set __iomem *regs) { +#if defined(writeq) && defined(CONFIG_64BIT) + u64 req_data = (((u64)req_desc_hi << 32) | (u32)req_desc_lo); + + writeq(le64_to_cpu(req_data), &(regs)->inbound_low_queue_port); +#else unsigned long flags; spin_lock_irqsave(&instance->hba_lock, flags); @@ -1072,6 +1077,7 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance, writel(le32_to_cpu(req_desc_lo), &(regs)->inbound_low_queue_port); writel(le32_to_cpu(req_desc_hi), &(regs)->inbound_high_queue_port); spin_unlock_irqrestore(&instance->hba_lock, flags); +#endif } /** -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 03/11] megaraid_sas : Update threshold based reply post host index register
Resending the patch. Addressed the review comments from Tomas Henzl. Current driver updates reply post host index to let firmware know that replies are processed, while returning from ISR function, only if there is no oustanding replies in reply queue. Driver will free the request frame immediately from ISR but reply post host index is not yet updated. It means freed request can be used by submission path and there may be a tight loop in request/reply path. In such condition, firmware may crash when it tries to post reply and there is no free reply post descriptor. Eventually two things needs to be change to avoid this issue. Increase reply queue depth (double than request queue) to accommodate worst case scenario. Update reply post host index to firmware once it reach to some pre-defined threshold value. This change will make sure that firmware will always have some buffer of reply descriptor and will never find empty reply descriptor in completion path. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 8898817..155b8b1 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -971,7 +971,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) max_cmd = instance->max_fw_cmds; - fusion->reply_q_depth = ((max_cmd + 1 + 15)/16)*16; + fusion->reply_q_depth = 2 * (((max_cmd + 1 + 15)/16)*16); fusion->request_alloc_sz = sizeof(union MEGASAS_REQUEST_DESCRIPTOR_UNION) *max_cmd; @@ -1874,6 +1874,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) u32 status, extStatus, device_id; union desc_value d_val; struct LD_LOAD_BALANCE_INFO *lbinfo; + int threshold_reply_count = 0; fusion = instance->ctrl_context; @@ -1961,6 +1962,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) desc->Words = ULLONG_MAX; num_completed++; + threshold_reply_count++; /* Get the next reply descriptor */ if (!fusion->last_reply_idx[MSIxIndex]) @@ -1980,6 +1982,25 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) if (reply_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) break; + /* +* Write to reply post host index register after completing threshold +* number of reply counts and still there are more replies in reply queue +* pending to be completed +*/ + if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { + if ((instance->pdev->device == + PCI_DEVICE_ID_LSI_INVADER) || + (instance->pdev->device == + PCI_DEVICE_ID_LSI_FURY)) + writel(((MSIxIndex & 0x7) << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[MSIxIndex/8]); + else + writel((MSIxIndex << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[0]); + threshold_reply_count = 0; + } } if (!num_completed) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index e76af54..d660c4d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -86,6 +86,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { #define MEGASAS_FP_CMD_LEN 16 #define MEGASAS_FUSION_IN_RESET 0 +#define THRESHOLD_REPLY_COUNT 50 /* * Raid Context structure which describes MegaRAID specific IO Parameters -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 11/11] megaraid_sas : Driver version update
Resending the patch. Addressed the review comments by Tomas Henzl. Driver version upgrade patch. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h | 6 +++--- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index f99db18..a49914d 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -33,9 +33,9 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION"06.803.02.00-rc1" -#define MEGASAS_RELDATE"Jun. 19, 2014" -#define MEGASAS_EXT_VERSION"Thu. Jun. 19 17:00:00 PDT 2014" +#define MEGASAS_VERSION"06.805.06.00-rc1" +#define MEGASAS_RELDATE"Sep. 4, 2014" +#define MEGASAS_EXT_VERSION"Thu. Sep. 4 17:00:00 PDT 2014" /* * Device IDs diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d8cc922..f6a69a3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * FILE: megaraid_sas_base.c - * Version : 06.803.02.00-rc1 + * Version : 06.805.06.00-rc1 * * Authors: LSI Corporation * Sreenivas Bagalkote -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 10/11] megaraid_sas : MFI MPT linked list corruption fix
Resending the patch. Addressed the review comments from Tomas Henzl. Added comment for to-do work. Problem statement: MFI link list in megaraid_sas driver is used from mfi-mpt pass-through commands. This list can be corrupted due to many possible race conditions in driver and eventually we may see kernel panic. One example - MFI frame is freed from calling process as driver send command via polling method and interrupt for that command comes after driver free mfi frame (actually even after some other context reuse the mfi frame). When driver receive MPT frame in ISR, driver will be using the index of MFI and access that MFI frame and finally in-used MFI frame’s list will be corrupted. High level description of new solution - Free MFI and MPT command from same context. Free both the command either from process (from where mfi-mpt pass-through was called) or from ISR context. Do not split freeing of MFI and MPT, because it creates the race condition which will do MFI/MPT list corruption. Renamed the cmd_pool_lock which is used in instance as well as fusion with below name. mfi_pool_lock and mpt_pool_lock to add more code readability. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h| 25 +++- drivers/scsi/megaraid/megaraid_sas_base.c | 196 drivers/scsi/megaraid/megaraid_sas_fusion.c | 100 ++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 +- 4 files changed, 240 insertions(+), 83 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 156d4b9..f99db18 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1016,6 +1016,12 @@ struct megasas_ctrl_info { #define VD_EXT_DEBUG 0 +enum MR_MFI_MPT_PTHR_FLAGS { + MFI_MPT_DETACHED = 0, + MFI_LIST_ADDED = 1, + MFI_MPT_ATTACHED = 2, +}; + /* Frame Type */ #define IO_FRAME 0 #define PTHRU_FRAME1 @@ -1033,7 +1039,7 @@ struct megasas_ctrl_info { #define MEGASAS_IOCTL_CMD 0 #define MEGASAS_DEFAULT_CMD_TIMEOUT90 #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 - +#define MEGASAS_BLOCKED_CMD_TIMEOUT60 /* * FW reports the maximum of number of commands that it can accept (maximum * commands that can be outstanding) at any time. The driver must report a @@ -1652,7 +1658,7 @@ struct megasas_instance { struct megasas_cmd **cmd_list; struct list_head cmd_pool; /* used to sync fire the cmd to fw */ - spinlock_t cmd_pool_lock; + spinlock_t mfi_pool_lock; /* used to sync fire the cmd to fw */ spinlock_t hba_lock; /* used to synch producer, consumer ptrs in dpc */ @@ -1839,6 +1845,11 @@ struct megasas_cmd { struct list_head list; struct scsi_cmnd *scmd; + + void *mpt_pthr_cmd_blocked; + atomic_t mfi_mpt_pthr; + u8 is_wait_event; + struct megasas_instance *instance; union { struct { @@ -1927,4 +1938,14 @@ int megasas_set_crash_dump_params(struct megasas_instance *instance, void megasas_free_host_crash_buffer(struct megasas_instance *instance); void megasas_fusion_crash_dump_wq(struct work_struct *work); +void megasas_return_cmd_fusion(struct megasas_instance *instance, + struct megasas_cmd_fusion *cmd); +int megasas_issue_blocked_cmd(struct megasas_instance *instance, + struct megasas_cmd *cmd, int timeout); +void __megasas_return_cmd(struct megasas_instance *instance, + struct megasas_cmd *cmd); + +void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance, + struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion); + #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 4c4c266..d8cc922 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -210,43 +210,66 @@ struct megasas_cmd *megasas_get_cmd(struct megasas_instance unsigned long flags; struct megasas_cmd *cmd = NULL; - spin_lock_irqsave(&instance->cmd_pool_lock, flags); + spin_lock_irqsave(&instance->mfi_pool_lock, flags); if (!list_empty(&instance->cmd_pool)) { cmd = list_entry((&instance->cmd_pool)->next, struct megasas_cmd, list); list_del_init(&cmd->list); + atomic_set(&cmd->mfi_mpt_pthr, MFI_MPT_DETACHED); } else { printk(KERN_ERR "megasas: Command pool empty!\n"); } - spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); + spin_unlock_irqrestore(&instance->mfi_pool_lock, flags); return cmd; } /** - * megasas_return_cmd -Return a cmd t
[PATCH RESEND 01/11] megaraid_sas : Do not scan non syspd drives
Resending the patch. Addressed the review comments from Tomas Henzl. Current driver allow device scan for all the devices on channel 0 and 1. E.a If we have two single drive raid volumes, we may see prints like below. First two prints are for physical device which are used to form VD. Prints like this creates confusion as it is really not required to scan any hidden physical devices. scsi1 : LSI SAS based MegaRAID driver scsi 1:0:0:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 scsi 1:0:1:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 scsi 1:2:0:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 scsi 1:2:1:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 When slave_alloc called, sdev-type will not be set, so current code will always return "0" in slave_alloc callback. This patch make sure that driver return "-ENXIO" for non-syspd devices. After this patch, we will see prints in syslog only for devices which are exposed. For current example, below print will be available in syslog. scsi1 : LSI SAS based MegaRAID driver scsi 1:2:0:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 scsi 1:2:1:0: Direct-Access LSI MR9361-8i4.21 PQ: 0 ANSI: 5 Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_base.c | 35 --- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index ff44f2c..a894f13 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1628,36 +1628,12 @@ static struct megasas_instance *megasas_lookup_instance(u16 host_no) static int megasas_slave_configure(struct scsi_device *sdev) { - u16 pd_index = 0; - struct megasas_instance *instance ; - - instance = megasas_lookup_instance(sdev->host->host_no); - - /* - * Don't export physical disk devices to the disk driver. - * - * FIXME: Currently we don't export them to the midlayer at all. - *That will be fixed once LSI engineers have audited the - *firmware for possible issues. - */ - if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && - sdev->type == TYPE_DISK) { - pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + - sdev->id; - if (instance->pd_list[pd_index].driveState == - MR_PD_STATE_SYSTEM) { - blk_queue_rq_timeout(sdev->request_queue, - MEGASAS_DEFAULT_CMD_TIMEOUT * HZ); - return 0; - } - return -ENXIO; - } - /* * The RAID firmware may require extended timeouts. */ blk_queue_rq_timeout(sdev->request_queue, MEGASAS_DEFAULT_CMD_TIMEOUT * HZ); + return 0; } @@ -1666,18 +1642,15 @@ static int megasas_slave_alloc(struct scsi_device *sdev) u16 pd_index = 0; struct megasas_instance *instance ; instance = megasas_lookup_instance(sdev->host->host_no); - if ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) && - (sdev->type == TYPE_DISK)) { + if (sdev->channel < MEGASAS_MAX_PD_CHANNELS) { /* * Open the OS scan to the SYSTEM PD */ pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id; - if ((instance->pd_list[pd_index].driveState == - MR_PD_STATE_SYSTEM) && - (instance->pd_list[pd_index].driveType == - TYPE_DISK)) { + if (instance->pd_list[pd_index].driveState == + MR_PD_STATE_SYSTEM) { return 0; } return -ENXIO; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 08/11] megaraid_sas : Add module parameter to disable IRQ-CPU affinity hint
Resending the patch. Addressed the review comments from Tomas Henzl. For certain deployment, we may need to disable irq cpu affinity hint. This module parameter provides option for use to disable irq cpu affinity hint and allow irqbalancer to handle the rest. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_base.c | 60 +++ 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index bc79a05..4c4c266 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -89,6 +89,10 @@ module_param(resetwaittime, int, S_IRUGO); MODULE_PARM_DESC(resetwaittime, "Wait time in seconds after I/O timeout " "before resetting adapter. Default: 180"); +int smp_affinity_enable = 1; +module_param(smp_affinity_enable, int, S_IRUGO); +MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale Default: enable(1)"); + MODULE_LICENSE("GPL"); MODULE_VERSION(MEGASAS_VERSION); MODULE_AUTHOR("megaraidli...@lsi.com"); @@ -5162,8 +5166,9 @@ retry_irq_register: printk(KERN_DEBUG "megasas: Failed to " "register IRQ for vector %d.\n", i); for (j = 0; j < i; j++) { - irq_set_affinity_hint( - instance->msixentry[j].vector, NULL); + if (smp_affinity_enable) + irq_set_affinity_hint( + instance->msixentry[j].vector, NULL); free_irq( instance->msixentry[j].vector, &instance->irq_context[j]); @@ -5172,11 +5177,14 @@ retry_irq_register: instance->msix_vectors = 0; goto retry_irq_register; } - if (irq_set_affinity_hint(instance->msixentry[i].vector, - get_cpu_mask(cpu))) - dev_err(&instance->pdev->dev, "Error setting" - "affinity hint for cpu %d\n", cpu); - cpu = cpumask_next(cpu, cpu_online_mask); + if (smp_affinity_enable) { + if (irq_set_affinity_hint(instance->msixentry[i].vector, + get_cpu_mask(cpu))) + dev_err(&instance->pdev->dev, + "Error setting affinity hint " + "for cpu %d\n", cpu); + cpu = cpumask_next(cpu, cpu_online_mask); + } } } else { instance->irq_context[0].instance = instance; @@ -5235,8 +5243,9 @@ retry_irq_register: instance->instancet->disable_intr(instance); if (instance->msix_vectors) for (i = 0; i < instance->msix_vectors; i++) { - irq_set_affinity_hint( - instance->msixentry[i].vector, NULL); + if (smp_affinity_enable) + irq_set_affinity_hint( + instance->msixentry[i].vector, NULL); free_irq(instance->msixentry[i].vector, &instance->irq_context[i]); } @@ -5399,8 +5408,9 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) if (instance->msix_vectors) for (i = 0; i < instance->msix_vectors; i++) { - irq_set_affinity_hint( - instance->msixentry[i].vector, NULL); + if (smp_affinity_enable) + irq_set_affinity_hint( + instance->msixentry[i].vector, NULL); free_irq(instance->msixentry[i].vector, &instance->irq_context[i]); } @@ -5509,8 +5519,9 @@ megasas_resume(struct pci_dev *pdev) printk(KERN_DEBUG "megasas: Failed to " "register IRQ for vector %d.\n", i); for (j = 0; j < i; j++) { - irq_set_affinity_hint( - instance->msixentry[j].vector, NULL); + if (smp_affinity_enable) + irq_set_affinity_hint( +
[PATCH RESEND 00/11] megaraid_sas : Description Patch
MegaRaid driver changes. Please consider this patch set for next kernel release. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- [PATCH RESEND 00/11] megaraid_sas : Description Patch [PATCH RESEND 01/11] megaraid_sas : Do not scan non syspd drives. [PATCH RESEND 02/11] megaraid_sas : Use writeq for 64bit pci write to avoid spinlock overhead [PATCH RESEND 03/11] megaraid_sas : Update threshold based reply post host index register [PATCH RESEND 04/11] megaraid_sas : Firmware crash dump feature support [PATCH RESEND 05/11] megaraid_sas : Extended VD support. [PATCH RESEND 06/11] megaraid_sas : Host lock less mode to enabled asynchronous IO submission [PATCH RESEND 07/11] megaraid_sas : Round down max sge supported by controller to power of two [PATCH RESEND 08/11] megaraid_sas : Add module parameter to disable IRQ-CPU affinity hint [PATCH RESEND 09/11] megaraid_sas : N-drive primary raid level 1 load balancing [PATCH RESEND 10/11] megaraid_sas : MFI MPT linked list corruption fix [PATCH RESEND 11/11] megaraid_sas : Driver version update. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND 09/11] megaraid_sas : N-drive primary raid level 1 load balancing
Resending the patch. Addressed the review comments from Tomas Henzl. Current driver does fast path read load balancing between arm and mirror disk for two Drive Raid-1 configuration only. Now, Driver support fast path read load balancing for all (any number of disk) Raid-1 configuration. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas.h| 8 +- drivers/scsi/megaraid/megaraid_sas_fp.c | 134 drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 ++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 8 +- 4 files changed, 96 insertions(+), 68 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 5dedf09..156d4b9 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1188,7 +1188,8 @@ union megasas_sgl_frame { typedef union _MFI_CAPABILITIES { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:28; + u32 reserved:27; + u32 support_ndrive_r1_lb:1; u32 support_max_255lds:1; u32 reserved1:1; u32 support_additional_msix:1; @@ -1198,7 +1199,8 @@ typedef union _MFI_CAPABILITIES { u32 support_additional_msix:1; u32 reserved1:1; u32 support_max_255lds:1; - u32 reserved:28; + u32 support_ndrive_r1_lb:1; + u32 reserved:27; #endif } mfi_capabilities; u32 reg; @@ -1914,6 +1916,8 @@ u16 MR_LdSpanArrayGet(u32 ld, u32 span, struct MR_DRV_RAID_MAP_ALL *map); u16 MR_PdDevHandleGet(u32 pd, struct MR_DRV_RAID_MAP_ALL *map); u16 MR_GetLDTgtId(u32 ld, struct MR_DRV_RAID_MAP_ALL *map); +u16 get_updated_dev_handle(struct megasas_instance *instance, + struct LD_LOAD_BALANCE_INFO *lbInfo, struct IO_REQUEST_INFO *in_info); void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map, struct LD_LOAD_BALANCE_INFO *lbInfo); int megasas_get_ctrl_info(struct megasas_instance *instance, diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index c2eaf6e..685e6f3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -55,6 +55,13 @@ #include "megaraid_sas.h" #include +#define LB_PENDING_CMDS_DEFAULT 4 +static unsigned int lb_pending_cmds = LB_PENDING_CMDS_DEFAULT; +module_param(lb_pending_cmds, int, S_IRUGO); +MODULE_PARM_DESC(lb_pending_cmds, "Change raid-1 load balancing outstanding " + "threshold. Valid Values are 1-128. Default: 4"); + + #define ABS_DIFF(a, b) (((a) > (b)) ? ((a) - (b)) : ((b) - (a))) #define MR_LD_STATE_OPTIMAL 3 #define FALSE 0 @@ -769,6 +776,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, *pdBlock += stripRef + le64_to_cpu(MR_LdSpanPtrGet(ld, span, map)->startBlk); pRAID_Context->spanArm = (span << RAID_CTX_SPANARM_SPAN_SHIFT) | physArm; + io_info->span_arm = pRAID_Context->spanArm; return retval; } @@ -865,6 +873,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, *pdBlock += stripRef + le64_to_cpu(MR_LdSpanPtrGet(ld, span, map)->startBlk); pRAID_Context->spanArm = (span << RAID_CTX_SPANARM_SPAN_SHIFT) | physArm; + io_info->span_arm = pRAID_Context->spanArm; return retval; } @@ -1131,7 +1140,7 @@ MR_BuildRaidContext(struct megasas_instance *instance, * */ void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map, - PLD_SPAN_INFO ldSpanInfo) + PLD_SPAN_INFO ldSpanInfo) { u8 span, count; u32 element, span_row_width; @@ -1239,90 +1248,105 @@ void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map, } -void -mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map, - struct LD_LOAD_BALANCE_INFO *lbInfo) +void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *drv_map, + struct LD_LOAD_BALANCE_INFO *lbInfo) { int ldCount; u16 ld; struct MR_LD_RAID *raid; + if (lb_pending_cmds > 128 || lb_pending_cmds < 1) + lb_pending_cmds = LB_PENDING_CMDS_DEFAULT; + for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES_EXT; ldCount++) { - ld = MR_TargetIdToLdGet(ldCount, map); + ld = MR_TargetIdToLdGet(ldCount, drv_map); if (ld >= MAX_LOGICAL_DRIVES_EXT) { lbInfo[ldCount].loadBalanceFlag = 0; continue; } - raid = MR_LdRaidGet(ld, map); - - /* Two drive Optimal RAID 1 */ - if ((raid->level == 1) && (raid->rowSize == 2) && - (raid->s
Re: [PATCH 14/14] sd: Honor block layer integrity handling flags
On 9/12/2014 4:35 AM, Martin K. Petersen wrote: "Sagi" == Sagi Grimberg writes: Sagi, Sagi> That's still a dependence on prot_type (type 0...). Notice that Sagi> you set SCSI_PROT_REF_INCREMENT in every op index (except Sagi> SCSI_PROT_NORMAL) so my point is that it's strange to see this Sagi> association. I still don't understand your point. The mask table indicates which flags are valid for a given protection operation. They are explicitly DIX flags and have nothing to do with the target protection type. I see, It's just confusing to see flags such as REF_INCREMENT/GUARD_CHECK/REF_CHECK associated with a set of prot operations, but I guess it's just me. Do you really need the mask anyway? seems like just an extra precaution against wrong flagging. It's just nit-picking - I do not see anything wrong with the patchset. We can drop this if you want... Sagi> P.S. Now drivers can stop understanding prot_type to set DIF Sagi> operations... so once drivers stop referencing it we can remove Sagi> it from scsi_cmnd. Yes. Second part of this installment removes this and a few other things and converts qla2xxx, lpfc, mptNsas, etc. to the new interface. Nice, I posted "RDMA signature feature update" preparing iSER DIF code to complement this change - all that is left now is a straight-forward conversion. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] hpsa: add missing pci_set_master in kdump path
Add a call to pci_set_master(...) missing in the previous patch "hpsa: refine the pci enable/disable handling". Found thanks to Rob Elliot. --- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 7828834..cef5d49 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6544,7 +6544,7 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) dev_warn(&pdev->dev, "failed to enable device.\n"); return -ENODEV; } - + pci_set_master(pdev); /* Reset the controller with a PCI power-cycle or via doorbell */ rc = hpsa_kdump_hard_reset_controller(pdev); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 11/18][SCSI] mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced
Added code to send an SEP message that turns off the Predictive Failure LED when a drive is removed (if Predictive Failure LED was turned on). Added a new flag 'pfa_led_on' per device that tracks the status of Predictive Failure LED. When the drive is removed, this flag is checked and sends an SEP message to turn off the respective Predictive Failure LED. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.h | 5 ++- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 67 ++-- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 9b90a6f..184826c 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -272,8 +272,10 @@ struct _internal_cmd { * @channel: target channel * @slot: number number * @phy: phy identifier provided in sas device page 0 - * @fast_path: fast path feature enable bit * @responding: used in _scsih_sas_device_mark_responding + * @fast_path: fast path feature enable bit + * @pfa_led_on: flag for PFA LED status + * */ struct _sas_device { struct list_head list; @@ -293,6 +295,7 @@ struct _sas_device { u8 phy; u8 responding; u8 fast_path; + u8 pfa_led_on; }; /** diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 135f12c..77a5bfa 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -159,7 +159,7 @@ struct sense_info { }; #define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB) -#define MPT3SAS_TURN_ON_FAULT_LED (0xFFFC) +#define MPT3SAS_TURN_ON_PFA_LED (0xFFFC) #define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD) #define MPT3SAS_ABRT_TASK_SET (0xFFFE) #define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0x) @@ -3885,7 +3885,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, #endif /** - * _scsih_turn_on_fault_led - illuminate Fault LED + * _scsih_turn_on_pfa_led - illuminate PFA LED * @ioc: per adapter object * @handle: device handle * Context: process @@ -3893,10 +3893,15 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, * Return nothing. */ static void -_scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) +_scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) { Mpi2SepReply_t mpi_reply; Mpi2SepRequest_t mpi_request; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; @@ -3911,6 +3916,7 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) __FILE__, __LINE__, __func__); return; } + sas_device->pfa_led_on = 1; if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { dewtprintk(ioc, pr_info(MPT3SAS_FMT @@ -3920,9 +3926,46 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) return; } } +/** + * _scsih_turn_off_pfa_led - turn off Fault LED + * @ioc: per adapter object + * @sas_device: sas device whose PFA LED has to turned off + * Context: process + * + * Return nothing. + */ +static void +_scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc, + struct _sas_device *sas_device) +{ + Mpi2SepReply_t mpi_reply; + Mpi2SepRequest_t mpi_request; + memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); + mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + mpi_request.SlotStatus = 0; + mpi_request.Slot = cpu_to_le16(sas_device->slot); + mpi_request.DevHandle = 0; + mpi_request.EnclosureHandle = cpu_to_le16(sas_device->enclosure_handle); + mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply, + &mpi_request)) != 0) { + printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, + __FILE__, __LINE__, __func__); + return; + } + + if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { + dewtprintk(ioc, printk(MPT3SAS_FMT +"enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", +ioc->name, le16_to_cpu(mpi_reply.IOCStatus), +le32_to_cpu(mpi_reply.IOCLogInfo))); + return; + } +} /** - * _scsih_send_event_to_turn_on_fault_led - fire delayed event + * _scsih_send_event_to_turn_on_pfa_led - fire delayed event * @ioc: per adapter object * @handle: device handle * Context: interrupt. @@ -3930,14 +3973,14 @@ _scsih_turn_on_fault_led(struct MPT3SA
[PATCH v2 07/18][SCSI] mpt2sas: Added Reply Descriptor Post Queue (RDPQ) Array support
Up to now, Driver allocates a single contiguous block of memory pool for all reply queues and passes down a single address in the ReplyDescriptorPostQueueAddress field of the IOC Init Request Message to the firmware. When firmware receives this address, it will program each of the Reply Descriptor Post Queue registers, as each reply queue has its own register. Thus the firmware, starting from a base address it determines the starting address of the subsequent reply queues through some simple arithmetic calculations. The size of this contiguous block of memory pool is directly proportional to number of MSI-X vectors and the HBA queue depth. For example higher MSIX vectors requires larger contiguous block of memory pool. But some of the OS kernels are unable to allocate this larger contiguous block of memory pool. So, the proposal is to allocate memory independently for each Reply Queue and pass down all of the addresses to the firmware. Then the firmware will just take each address and program the value into the correct register. When HBAs with older firmware(i.e. without RDPQ capability) is used with this new driver then the max_msix_vectors value would be set to 8 by default. Change_set in v1: 1. Declared _base_get_ioc_facts() function at the beginning of the mpt2sas_base.c file instead of moving all these functions before mpt2sas_base_map_resources() function a. _base_wait_for_doorbell_int() b. _base_wait_for_doorbell_ack() c. _base_wait_for_doorbell_not_used() d. _base_handshake_req_reply_wait() e. _base_get_ioc_facts() 2. Initially set the consistent DMA mask to 32 bit and then change it to 64 bit mask after allocating RDPQ pools by calling the function _base_change_consistent_dma_mask. This is to ensure that all the upper 32 bits of RDPQ entries's base address to be same. 3. Reduced the redundancy between the RDPQ and non-RDPQ support in these following functions a. _base_release_memory_pools() b. _base_allocate_memory_pools() c. _base_send_ioc_init() d. _base_make_ioc_operational() Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.c | 240 +++- drivers/scsi/mpt2sas/mpt2sas_base.h | 20 ++- 2 files changed, 199 insertions(+), 61 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 24d0e52..51a83d7 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -92,6 +92,9 @@ static int disable_discovery = -1; module_param(disable_discovery, int, 0); MODULE_PARM_DESC(disable_discovery, " disable discovery "); +static int +_base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag); + /** * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. * @@ -1179,17 +1182,22 @@ static int _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) { struct sysinfo s; - char *desc = NULL; + u64 consistent_dma_mask; + + if (ioc->dma_mask) + consistent_dma_mask = DMA_BIT_MASK(64); + else + consistent_dma_mask = DMA_BIT_MASK(32); if (sizeof(dma_addr_t) > 4) { const uint64_t required_mask = dma_get_required_mask(&pdev->dev); - if ((required_mask > DMA_BIT_MASK(32)) && !pci_set_dma_mask(pdev, - DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(pdev, - DMA_BIT_MASK(64))) { + if ((required_mask > DMA_BIT_MASK(32)) && + !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && + !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) { ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->sge_size = sizeof(Mpi2SGESimple64_t); - desc = "64"; + ioc->dma_mask = 64; goto out; } } @@ -1198,18 +1206,29 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { ioc->base_add_sg_single = &_base_add_sg_single_32; ioc->sge_size = sizeof(Mpi2SGESimple32_t); - desc = "32"; + ioc->dma_mask = 32; } else return -ENODEV; out: si_meminfo(&s); - printk(MPT2SAS_INFO_FMT "%s BIT PCI BUS DMA ADDRESSING SUPPORTED, " - "total mem (%ld kB)\n", ioc->name, desc, convert_to_kb(s.totalram)); + printk(MPT2SAS_INFO_FMT + "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", + ioc->name, ioc->dma_mask, convert_to_kb(s.totalram)); return 0; } +static int +_base_change_consistent_dma_mask(struct MPT2SAS_ADAPTER *ioc, + struct pci_dev *pdev
[PATCH v2 04/18][SCSI] mpt2sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced
Added code to send a SEP message that turns off the Predictive Failure LED when a drive is removed (if Predictive Failure LED was turned on). Added a new flag 'pfa_led_on' per device that tracks the status of Predictive Failure LED. When the drive is removed, this flag is checked and sends the SEP message to turn off the respective Predictive Failure LED. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.h | 2 ++ drivers/scsi/mpt2sas/mpt2sas_scsih.c | 70 +++- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 89f944a..6ce7020 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -355,6 +355,7 @@ struct _internal_cmd { * @slot: number number * @phy: phy identifier provided in sas device page 0 * @responding: used in _scsih_sas_device_mark_responding + * @pfa_led_on: flag for PFA LED status */ struct _sas_device { struct list_head list; @@ -373,6 +374,7 @@ struct _sas_device { u16 slot; u8 phy; u8 responding; + u8 pfa_led_on; }; /** diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index db71b60..e7303ed 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -145,7 +145,7 @@ struct sense_info { }; -#define MPT2SAS_TURN_ON_FAULT_LED (0xFFFC) +#define MPT2SAS_TURN_ON_PFA_LED (0xFFFC) #define MPT2SAS_PORT_ENABLE_COMPLETE (0xFFFD) #define MPT2SAS_REMOVE_UNRESPONDING_DEVICES (0x) /** @@ -4308,7 +4308,7 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, #endif /** - * _scsih_turn_on_fault_led - illuminate Fault LED + * _scsih_turn_on_pfa_led - illuminate PFA LED * @ioc: per adapter object * @handle: device handle * Context: process @@ -4316,10 +4316,15 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, * Return nothing. */ static void -_scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) +_scsih_turn_on_pfa_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) { Mpi2SepReply_t mpi_reply; Mpi2SepRequest_t mpi_request; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; @@ -4334,6 +4339,47 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) __FILE__, __LINE__, __func__); return; } + sas_device->pfa_led_on = 1; + + + if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { + dewtprintk(ioc, printk(MPT2SAS_INFO_FMT +"enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", +ioc->name, le16_to_cpu(mpi_reply.IOCStatus), +le32_to_cpu(mpi_reply.IOCLogInfo))); + return; + } +} + +/** + * _scsih_turn_off_pfa_led - turn off PFA LED + * @ioc: per adapter object + * @sas_device: sas device whose PFA LED has to turned off + * Context: process + * + * Return nothing. + */ +static void +_scsih_turn_off_pfa_led(struct MPT2SAS_ADAPTER *ioc, + struct _sas_device *sas_device) +{ + Mpi2SepReply_t mpi_reply; + Mpi2SepRequest_t mpi_request; + + memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); + mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + mpi_request.SlotStatus = 0; + mpi_request.Slot = cpu_to_le16(sas_device->slot); + mpi_request.DevHandle = 0; + mpi_request.EnclosureHandle = cpu_to_le16(sas_device->enclosure_handle); + mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + if ((mpt2sas_base_scsi_enclosure_processor(ioc, &mpi_reply, + &mpi_request)) != 0) { + printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, + __FILE__, __LINE__, __func__); + return; + } if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "enclosure_processor: " @@ -4345,7 +4391,7 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) } /** - * _scsih_send_event_to_turn_on_fault_led - fire delayed event + * _scsih_send_event_to_turn_on_pfa_led - fire delayed event * @ioc: per adapter object * @handle: device handle * Context: interrupt. @@ -4353,14 +4399,14 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) * Return nothing. */ static void -_scsih_send_event_to_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) +_scsih_send_event_to_turn_on_pfa_led(struct MPT2SAS_ADAPTER
[PATCH v2 10/18][SCSI] mpt3sas: MPI2.5 Rev G (2.5.2) specifications
Below is the change set in MPI2.5 Rev G specification and 2.00.31 header files 1) Added SCSIStatusQualifier to SCSI IO Error Reply message. 2) Added ATA Security Freeze Lock to IO Unit Page 1 Flags field. 3) Added Allow Protection Information bit for IR Volume Create. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpi/mpi2.h | 6 -- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 8 ++-- drivers/scsi/mpt3sas/mpi/mpi2_init.h | 6 -- drivers/scsi/mpt3sas/mpi/mpi2_raid.h | 6 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index 20da8f9..dc143dd 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -8,7 +8,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.29 + * mpi2.h Version: 02.00.31 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -86,6 +86,8 @@ * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. * 12-20-12 02.00.29 Bumped MPI2_HEADER_VERSION_UNIT. * Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET. + * 04-09-13 02.00.30 Bumped MPI2_HEADER_VERSION_UNIT. + * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. * -- */ @@ -119,7 +121,7 @@ #define MPI2_VERSION_02_05 (0x0205) /*Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x1D) +#define MPI2_HEADER_VERSION_UNIT(0x1F) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 889aa70..5b0e5c1 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -6,7 +6,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.24 + * mpi2_cnfg.h Version: 02.00.25 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -160,6 +160,9 @@ * 12-20-12 02.00.24 Marked MPI2_SASIOUNIT1_CONTROL_CLEAR_AFFILIATION as * obsolete for MPI v2.5 and later. * Added some defines for 12G SAS speeds. + * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. + * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to + * match the specification. * -- */ @@ -792,6 +795,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 { #define MPI2_IOUNITPAGE1_PAGEVERSION(0x04) /*IO Unit Page 1 Flags defines */ +#define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x4000) #define MPI25_IOUNITPAGE1_NEW_DEVICE_FAST_PATH_DISABLE (0x2000) #define MPI25_IOUNITPAGE1_DISABLE_FAST_PATH (0x1000) #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY(0x0800) @@ -870,7 +874,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_5 { #define MPI2_IOUNITPAGE5_PAGEVERSION(0x00) /*defines for IO Unit Page 5 DmaEngineCapabilities field */ -#define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0xFF00) +#define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0x) #define MPI2_IOUNITPAGE5_DMA_CAP_SHIFT_MAX_REQUESTS (16) #define MPI2_IOUNITPAGE5_DMA_CAP_EEDP (0x0008) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index f7928bf..b3e3331 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -6,7 +6,7 @@ * Title: MPI SCSI initiator mode messages and structures * Creation Date: June 23, 2006 * - * mpi2_init.h Version: 02.00.14 + * mpi2_init.h Version: 02.00.15 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -44,6 +44,8 @@ * Priority to match SAM-4. * Added EEDPErrorOffset to MPI2_SCSI_IO_REPLY. * 07-10-12 02.00.14 Added MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION. + * 04-09-13 02.00.15 Added SCSIStatusQualifier field to MPI2_SCSI_IO_REPLY, + * replacing the Reserved4 field. * -- */ @@ -347,7 +349,7 @@ typedef struct _MPI2_SCSI_IO_REPLY { U32 SenseCount; /*0x18 */ U32 ResponseInfo; /*0x1C */ U16 TaskTag;/*0x20 */ -
[PATCH v2 05/18][SCSI] mpt2sas: Bump mpt2sas driver version to 17.100.00.00
Bump mpt2sas driver version to 17.100.00.00 Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 6ce7020..e0e4dd4 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -69,8 +69,8 @@ #define MPT2SAS_DRIVER_NAME"mpt2sas" #define MPT2SAS_AUTHOR "LSI Corporation " #define MPT2SAS_DESCRIPTION"LSI MPT Fusion SAS 2.0 Device Driver" -#define MPT2SAS_DRIVER_VERSION "16.100.00.00" -#define MPT2SAS_MAJOR_VERSION 16 +#define MPT2SAS_DRIVER_VERSION "17.100.00.00" +#define MPT2SAS_MAJOR_VERSION 17 #define MPT2SAS_MINOR_VERSION 100 #define MPT2SAS_BUILD_VERSION 00 #define MPT2SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/18][SCSI] mpt2sas: Avoid type casting for direct I/O commands
A type casting error caused the max volume LBA to be truncated from 64 to 32 bits. The virtual LBA would also get truncated to 32 bits in the case of a 16-byte READ/WRITE command. Rewrite entire function to get rid of code duplication and type casts. Use get/put_unaligned wrappers to extract and replace the LBA field in the MPI request CDB. Signed-off-by: Martin K. Petersen Tested-by: Sreekanth Reddy --- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 117 --- 1 file changed, 40 insertions(+), 77 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index e7303ed..231ec34 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -55,6 +55,8 @@ #include #include +#include + #include "mpt2sas_base.h" MODULE_AUTHOR(MPT2SAS_AUTHOR); @@ -3858,85 +3860,46 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, u16 smid) { - u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size; + sector_t v_lba, p_lba, stripe_off, stripe_unit, column, io_size; u32 stripe_sz, stripe_exp; - u8 num_pds, *cdb_ptr, i; - u8 cdb0 = scmd->cmnd[0]; - u64 v_llba; + u8 num_pds, cmd = scmd->cmnd[0]; - /* -* Try Direct I/O to RAID memeber disks -*/ - if (cdb0 == READ_16 || cdb0 == READ_10 || - cdb0 == WRITE_16 || cdb0 == WRITE_10) { - cdb_ptr = mpi_request->CDB.CDB32; - - if ((cdb0 < READ_16) || !(cdb_ptr[2] | cdb_ptr[3] | cdb_ptr[4] - | cdb_ptr[5])) { - io_size = scsi_bufflen(scmd) >> - raid_device->block_exponent; - i = (cdb0 < READ_16) ? 2 : 6; - /* get virtual lba */ - v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[i])); - - if (((u64)v_lba + (u64)io_size - 1) <= - (u32)raid_device->max_lba) { - stripe_sz = raid_device->stripe_sz; - stripe_exp = raid_device->stripe_exponent; - stripe_off = v_lba & (stripe_sz - 1); - - /* Check whether IO falls within a stripe */ - if ((stripe_off + io_size) <= stripe_sz) { - num_pds = raid_device->num_pds; - p_lba = v_lba >> stripe_exp; - stripe_unit = p_lba / num_pds; - column = p_lba % num_pds; - p_lba = (stripe_unit << stripe_exp) + - stripe_off; - mpi_request->DevHandle = - cpu_to_le16(raid_device-> - pd_handle[column]); - (*(__be32 *)(&cdb_ptr[i])) = - cpu_to_be32(p_lba); - /* - * WD: To indicate this I/O is directI/O - */ - _scsih_scsi_direct_io_set(ioc, smid, 1); - } - } - } else { - io_size = scsi_bufflen(scmd) >> - raid_device->block_exponent; - /* get virtual lba */ - v_llba = be64_to_cpu(*(__be64 *)(&cdb_ptr[2])); - - if ((v_llba + (u64)io_size - 1) <= - raid_device->max_lba) { - stripe_sz = raid_device->stripe_sz; - stripe_exp = raid_device->stripe_exponent; - stripe_off = (u32) (v_llba & (stripe_sz - 1)); - - /* Check whether IO falls within a stripe */ - if ((stripe_off + io_size) <= stripe_sz) { - num_pds = raid_device->num_pds; - p_lba = (u32)(v_llba >> stripe_exp); - stripe_unit = p_lba / num_pds; - column = p_lba % num_pds; - p_lba = (stripe_unit << stripe_exp) + - stripe_off; - mpi_request->DevHandle = - cpu_to_le16(raid_device-> - pd_handle[column]); - (*(__be64 *)(&cdb_ptr[2])) =
[PATCH v2 08/18][SCSI] mpt2sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state.
Driver initialization fails if driver tries to send IOC facts request message when the IOC is in reset or in a fault state. This patch will make sure that 1.Driver to send IOC facts request message only if HBA is in operational or ready state. 2.If IOC is in fault state, a diagnostic reset would be issued. 3.If IOC is in reset state then driver will wait for 10 seconds to exit out of reset state. If the HBA continues to be in reset state, then the HBA wouldn't be claimed by the driver. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.c | 68 + 1 file changed, 68 insertions(+) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 51a83d7..32cd7fa 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -95,6 +95,9 @@ MODULE_PARM_DESC(disable_discovery, " disable discovery "); static int _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag); +static int +_base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag); + /** * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. * @@ -3461,6 +3464,64 @@ _base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag) } /** + * _base_wait_for_iocstate - Wait until the card is in READY or OPERATIONAL + * @ioc: per adapter object + * @timeout: + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + */ +static int +_base_wait_for_iocstate(struct MPT2SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 ioc_state, doorbell; + int rc; + + dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, + __func__)); + + if (ioc->pci_error_recovery) + return 0; + + doorbell = mpt2sas_base_get_iocstate(ioc, 0); + ioc_state = doorbell & MPI2_IOC_STATE_MASK; + dhsprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: ioc_state(0x%08x)\n", + ioc->name, __func__, ioc_state)); + + switch (ioc_state) { + case MPI2_IOC_STATE_READY: + case MPI2_IOC_STATE_OPERATIONAL: + return 0; + } + + if (doorbell & MPI2_DOORBELL_USED) { + dhsprintk(ioc, printk(MPT2SAS_INFO_FMT + "unexpected doorbell activ!e\n", ioc->name)); + goto issue_diag_reset; + } + + if (ioc_state == MPI2_IOC_STATE_FAULT) { + mpt2sas_base_fault_info(ioc, doorbell & + MPI2_DOORBELL_DATA_MASK); + goto issue_diag_reset; + } + + ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, + timeout, sleep_flag); + if (ioc_state) { + printk(MPT2SAS_ERR_FMT + "%s: failed going to ready state (ioc_state=0x%x)\n", + ioc->name, __func__, ioc_state); + return -EFAULT; + } + + issue_diag_reset: + rc = _base_diag_reset(ioc, sleep_flag); + return rc; +} + +/** * _base_get_ioc_facts - obtain ioc facts reply and save in ioc * @ioc: per adapter object * @sleep_flag: CAN_SLEEP or NO_SLEEP @@ -3478,6 +3539,13 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, __func__)); + r = _base_wait_for_iocstate(ioc, 10, sleep_flag); + if (r) { + printk(MPT2SAS_ERR_FMT "%s: failed getting to correct state\n", + ioc->name, __func__); + return r; + } + mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t); mpi_request_sz = sizeof(Mpi2IOCFactsRequest_t); memset(&mpi_request, 0, mpi_request_sz); -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 01/18][SCSI] mpt2sas: Added driver module parameter max_msix_vectors
Added driver module parameter max_msix_vectors. Using this module parameter the maximum number of MSI-X vectors could be set. The number of MSI-X vectors used would be the minimum of MSI-X vectors supported by the HBA, the number of CPU cores and the value set to max_msix_vectors module parameters. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 2f262be..982703a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -80,6 +80,10 @@ static int msix_disable = -1; module_param(msix_disable, int, 0); MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); +static int max_msix_vectors = -1; +module_param(max_msix_vectors, int, 0); +MODULE_PARM_DESC(max_msix_vectors, " max msix vectors "); + static int mpt2sas_fwfault_debug; MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " "and halt firmware - (default=0)"); @@ -1402,6 +1406,16 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) ioc->reply_queue_count = min_t(int, ioc->cpu_count, ioc->msix_vector_count); + if (max_msix_vectors > 0) { + ioc->reply_queue_count = min_t(int, max_msix_vectors, + ioc->reply_queue_count); + ioc->msix_vector_count = ioc->reply_queue_count; + } + + printk(MPT2SAS_INFO_FMT + "MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n", +ioc->name, ioc->msix_vector_count, ioc->cpu_count, max_msix_vectors); + entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry), GFP_KERNEL); if (!entries) { -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 18/18][SCSI] mpt3sas, mpt2sas: fix scsi_add_host error handling problems in _scsih_probe
In _scsih_probe, propagate the return value from scsi_add_host. In mpt3sas, avoid calling list_del twice if that returns an error, which causes list_del corruption warnings if an error is returned. Tested with blk-mq and scsi-mq patches to properly cleanup from and propagate blk_mq_init_rq_map errors. Signed-off-by: Robert Elliott Acked-by: Sreekanth Reddy --- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 8 ++-- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 9 ++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 231ec34..992a224 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -8147,6 +8147,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct MPT2SAS_ADAPTER *ioc; struct Scsi_Host *shost; + int rv; shost = scsi_host_alloc(&scsih_driver_template, sizeof(struct MPT2SAS_ADAPTER)); @@ -8242,6 +8243,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!ioc->firmware_event_thread) { printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); + rv = -ENODEV; goto out_thread_fail; } @@ -8249,6 +8251,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) if ((mpt2sas_base_attach(ioc))) { printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); + rv = -ENODEV; goto out_attach_fail; } @@ -8266,7 +8269,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) } else ioc->hide_drives = 0; - if ((scsi_add_host(shost, &pdev->dev))) { + rv = scsi_add_host(shost, &pdev->dev); + if (rv) { printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); goto out_add_shost_fail; @@ -8283,7 +8287,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_thread_fail: list_del(&ioc->list); scsi_host_put(shost); - return -ENODEV; + return rv; } #ifdef CONFIG_PM diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 95a1049..857276b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -7781,6 +7781,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct MPT3SAS_ADAPTER *ioc; struct Scsi_Host *shost; + int rv; shost = scsi_host_alloc(&scsih_driver_template, sizeof(struct MPT3SAS_ADAPTER)); @@ -7873,6 +7874,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!ioc->firmware_event_thread) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); + rv = -ENODEV; goto out_thread_fail; } @@ -7880,12 +7882,13 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) if ((mpt3sas_base_attach(ioc))) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); + rv = -ENODEV; goto out_attach_fail; } - if ((scsi_add_host(shost, &pdev->dev))) { + rv = scsi_add_host(shost, &pdev->dev); + if (rv) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); - list_del(&ioc->list); goto out_add_shost_fail; } @@ -7898,7 +7901,7 @@ out_add_shost_fail: out_thread_fail: list_del(&ioc->list); scsi_host_put(shost); - return -ENODEV; + return rv; } #ifdef CONFIG_PM -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 15/18][SCSI] mpt3sas: Added OEM branding Strings
Added following branding Strings for Intel custom HBAs support. Driver String: Vendor ID Device ID SubSystemVendor ID SubSystemDevice ID Intel(R) Integrated RAID Module RMS3JC080 0x1000 0x0097 0x8086 0x3521 Intel(R) RAID Controller RS3GC008 0x1000 0x0097 0x8086 0x3522 Intel(R) RAID Controller RS3FC044 0x1000 0x0097 0x8086 0x3523 Intel(R) RAID Controller RS3UC080 0x1000 0x0097 0x8086 0x3524 Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.c | 49 + drivers/scsi/mpt3sas/mpt3sas_base.h | 18 ++ 2 files changed, 67 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index faa3380..d71f135 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -2185,6 +2185,53 @@ mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid) &ioc->scsi_lookup_lock); } +/** + * _base_display_intel_branding - Display branding string + * @ioc: per adapter object + * + * Return nothing. + */ +static void +_base_display_intel_branding(struct MPT3SAS_ADAPTER *ioc) +{ + if (ioc->pdev->subsystem_vendor != PCI_VENDOR_ID_INTEL) + return; + + switch (ioc->pdev->device) { + case MPI25_MFGPAGE_DEVID_SAS3008: + switch (ioc->pdev->subsystem_device) { + case MPT3SAS_INTEL_RMS3JC080_SSDID: + pr_info(MPT3SAS_FMT "%s\n", ioc->name, + MPT3SAS_INTEL_RMS3JC080_BRANDING); + break; + + case MPT3SAS_INTEL_RS3GC008_SSDID: + pr_info(MPT3SAS_FMT "%s\n", ioc->name, + MPT3SAS_INTEL_RS3GC008_BRANDING); + break; + case MPT3SAS_INTEL_RS3FC044_SSDID: + pr_info(MPT3SAS_FMT "%s\n", ioc->name, + MPT3SAS_INTEL_RS3FC044_BRANDING); + break; + case MPT3SAS_INTEL_RS3UC080_SSDID: + pr_info(MPT3SAS_FMT "%s\n", ioc->name, + MPT3SAS_INTEL_RS3UC080_BRANDING); + break; + default: + pr_info(MPT3SAS_FMT + "Intel(R) Controller: Subsystem ID: 0x%X\n", + ioc->name, ioc->pdev->subsystem_device); + break; + } + break; + default: + pr_info(MPT3SAS_FMT + "Intel(R) Controller: Subsystem ID: 0x%X\n", + ioc->name, ioc->pdev->subsystem_device); + break; + } +} + /** @@ -2216,6 +2263,8 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) (bios_version & 0xFF00) >> 8, bios_version & 0x00FF); + _base_display_intel_branding(ioc); + pr_info(MPT3SAS_FMT "Protocol=(", ioc->name); if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) { diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 86b931e..e920728 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -130,7 +130,25 @@ #define MPT_TARGET_FLAGS_DELETED 0x04 #define MPT_TARGET_FASTPATH_IO 0x08 +/* + * Intel HBA branding + */ +#define MPT3SAS_INTEL_RMS3JC080_BRANDING \ + "Intel(R) Integrated RAID Module RMS3JC080" +#define MPT3SAS_INTEL_RS3GC008_BRANDING \ + "Intel(R) RAID Controller RS3GC008" +#define MPT3SAS_INTEL_RS3FC044_BRANDING \ + "Intel(R) RAID Controller RS3FC044" +#define MPT3SAS_INTEL_RS3UC080_BRANDING \ + "Intel(R) RAID Controller RS3UC080" +/* + * Intel HBA SSDIDs + */ +#define MPT3SAS_INTEL_RMS3JC080_SSDID 0x3521 +#define MPT3SAS_INTEL_RS3GC008_SSDID 0x3522 +#define MPT3SAS_INTEL_RS3FC044_SSDID 0x3523 +#define MPT3SAS_INTEL_RS3UC080_SSDID0x3524 /* * status bits for ioc->diag_buffer_status -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 17/18][SCSI] mpt3sas: Bump mpt3sas driver version to 04.100.00.00
Bump mpt3sas driver version to 04.100.00.00. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index ca4a7cc..40926aa 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -70,8 +70,8 @@ #define MPT3SAS_DRIVER_NAME"mpt3sas" #define MPT3SAS_AUTHOR "LSI Corporation " #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver" -#define MPT3SAS_DRIVER_VERSION "03.100.00.00" -#define MPT3SAS_MAJOR_VERSION 3 +#define MPT3SAS_DRIVER_VERSION "04.100.00.00" +#define MPT3SAS_MAJOR_VERSION 4 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 12/18][SCSI] mpt3sas: Bump mpt3sas driver version to 03.100.00.00
Bump mpt3sas driver version to 03.100.00.00. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 184826c..575f1bc 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -70,8 +70,8 @@ #define MPT3SAS_DRIVER_NAME"mpt3sas" #define MPT3SAS_AUTHOR "LSI Corporation " #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver" -#define MPT3SAS_DRIVER_VERSION "02.100.00.00" -#define MPT3SAS_MAJOR_VERSION 2 +#define MPT3SAS_DRIVER_VERSION "03.100.00.00" +#define MPT3SAS_MAJOR_VERSION 3 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 13/18][SCSI] mpt3sas: MPI2.5 Rev H (2.5.3) specifications
Below is the change set in MPI2.5 Rev H specification and 2.00.32 header files 1) Added reserved fields to IO Unit Page 7 for future use. 2) Added optional functionality to IOCInit Request so that the host may specify a separate base address for each Reply Descriptor Post Queue. IOC support for this is indicated using a new IOCCapabilities bit in the IOCFacts Reply. 3) Added Toolbox Console Text Display Tool The host uses the Console Text Display Tool to send a string to IOC's Console using different console types (eg: UART serial terminal or Ethernet terminal). 4) Firmware images can now be signed using an encrypted hash. 5) Added MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL 6) Added more details about configuration page restrictions when Host Based Discovery is enabled Enabling host based discovery affects the availability of some configuration pages and events. The SAS Expander, SAS Device, and SAS Enclosure configuration pages are not available from the IOC. The IOC returns an error status to any Configuration Request message attempting to access these pages. The IOC does not send the SAS Discovery Event, the SAS Topology Change List Event, or the SAS Enclosure Device Status Change Event when host based discovery is enabled. 7) Bit 13 of the SAS IO Unit Page 1 ControlFlags field is now obsolete. It was used to enable limiting direct attached SATA maximum link rate to 1.5 Gbps. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 10 -- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 62 ++-- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 6 ++-- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 43 - 4 files changed, 114 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 5b0e5c1..becee07 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -6,7 +6,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.25 + * mpi2_cnfg.h Version: 02.00.26 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -163,6 +163,8 @@ * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to * match the specification. + * 08-19-13 02.00.26 Added reserved words to MPI2_CONFIG_PAGE_IO_UNIT_7 for + * future use. * -- */ @@ -924,11 +926,15 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_7 { U8 BoardTemperatureUnits; /*0x16 */ U8 Reserved3; /*0x17 */ + U32 Reserved4; /* 0x18 */ + U32 Reserved5; /* 0x1C */ + U32 Reserved6; /* 0x20 */ + U32 Reserved7; /* 0x24 */ } MPI2_CONFIG_PAGE_IO_UNIT_7, *PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, Mpi2IOUnitPage7_t, *pMpi2IOUnitPage7_t; -#define MPI2_IOUNITPAGE7_PAGEVERSION(0x02) +#define MPI2_IOUNITPAGE7_PAGEVERSION (0x04) /*defines for IO Unit Page 7 CurrentPowerMode and PreviousPowerMode fields */ #define MPI25_IOUNITPAGE7_PM_INIT_MASK (0xC0) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h index e2bb821..15813f3 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h @@ -6,7 +6,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.22 + * mpi2_ioc.h Version: 02.00.23 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -127,6 +127,11 @@ * 07-26-12 02.00.22 Added MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE. * Added ElapsedSeconds field to * MPI2_EVENT_DATA_IR_OPERATION_STATUS. + * 08-19-13 02.00.23 For IOCInit, added MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE + * and MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY. + * Added MPI2_IOCFACTS_CAPABILITY_RDPQ_ARRAY_CAPABLE. + * Added MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY. + * Added Encrypted Hash Extended Image. * -- */ @@ -182,6 +187,10 @@ typedef struct _MPI2_IOC_INIT_REQUEST { #define MPI2_WHOINIT_HOST_DRIVER(0x04) #define MPI2_WHOINIT_MANUFACTURER
[PATCH v2 16/18][SCSI] mpt3sas: Added Reply Descriptor Post Queue (RDPQ) Array support
Up to now, Driver allocates a single contiguous block of memory pool for all reply queues and passes down a single address in the ReplyDescriptorPostQueueAddress field of the IOC Init Request Message to the firmware. When firmware receives this address, it will program each of the Reply Descriptor Post Queue registers, as each reply queue has its own register. Thus the firmware, starting from a base address it determines the starting address of the subsequent reply queues through some simple arithmetic calculations. The size of this contiguous block of memory pool is directly proportional to number of MSI-X vectors and the HBA queue depth. For example higher MSIX vectors requires larger contiguous block of memory pool. But some of the OS kernels are unable to allocate this larger contiguous block of memory pool. So, the proposal is to allocate memory independently for each Reply Queue and pass down all of the addresses to the firmware. Then the firmware will just take each address and program the value into the correct register. When HBAs with older firmware(i.e. without RDPQ capability) is used with this new driver then the max_msix_vectors value would be set to 8 by default. Change set in v1: 1. Declared the _base_get_ioc_facts() functions at the beginning of the mpt3sas_base.c file instead of moving all these functions before mpt3sas_base_map_resources() function a. _base_wait_for_doorbell_int() b. _base_wait_for_doorbell_ack() c. _base_wait_for_doorbell_not_used() d. _base_handshake_req_reply_wait() e. _base_get_ioc_facts() 2. Initially set the consistent DMA mask to 32 bit and then change it to 64 bit mask after allocating RDPQ pools by calling the function _base_change_consistent_dma_mask. This is to ensure that all the upper 32 bits of RDPQ entries's base address to be same. 3. Reduced the redundancy between the RDPQ and non-RDPQ support in these following functions a. _base_release_memory_pools() b. _base_allocate_memory_pools() c. _base_send_ioc_init() d. _base_make_ioc_operational() Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.c | 232 +++- drivers/scsi/mpt3sas/mpt3sas_base.h | 20 +++- 2 files changed, 191 insertions(+), 61 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index d71f135..ea6c2fb 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -91,6 +91,8 @@ static int mpt3sas_fwfault_debug; MODULE_PARM_DESC(mpt3sas_fwfault_debug, " enable detection of firmware fault and halt firmware - (default=0)"); +static int +_base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc, int sleep_flag); /** * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. @@ -1482,17 +1484,22 @@ static int _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) { struct sysinfo s; - char *desc = NULL; + u64 consistent_dma_mask; + + if (ioc->dma_mask) + consistent_dma_mask = DMA_BIT_MASK(64); + else + consistent_dma_mask = DMA_BIT_MASK(32); if (sizeof(dma_addr_t) > 4) { const uint64_t required_mask = dma_get_required_mask(&pdev->dev); if ((required_mask > DMA_BIT_MASK(32)) && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && - !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { + !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) { ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->sge_size = sizeof(Mpi2SGESimple64_t); - desc = "64"; + ioc->dma_mask = 64; goto out; } } @@ -1501,16 +1508,27 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { ioc->base_add_sg_single = &_base_add_sg_single_32; ioc->sge_size = sizeof(Mpi2SGESimple32_t); - desc = "32"; + ioc->dma_mask = 32; } else return -ENODEV; out: si_meminfo(&s); pr_info(MPT3SAS_FMT - "%s BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", - ioc->name, desc, convert_to_kb(s.totalram)); + "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", + ioc->name, ioc->dma_mask, convert_to_kb(s.totalram)); + + return 0; +} +static int +_base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc, + struct pci_dev *pdev) +{ + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { + if (pci_set_consistent_d
[PATCH v2 14/18][SCSI] mpt3sas: Copyright in driver sources is updated for year the 2014.
Copyright in driver sources is updated for year the 2014. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/Kconfig| 2 +- drivers/scsi/mpt3sas/mpi/mpi2.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h| 2 +- drivers/scsi/mpt3sas/mpi/mpi2_init.h| 2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h| 2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h| 2 +- drivers/scsi/mpt3sas/mpi/mpi2_type.h| 2 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_config.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_debug.h| 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c| 2 +- drivers/scsi/mpt3sas/mpt3sas_transport.c| 2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig index d53e1b0..4d235dd 100644 --- a/drivers/scsi/mpt3sas/Kconfig +++ b/drivers/scsi/mpt3sas/Kconfig @@ -2,7 +2,7 @@ # Kernel configuration file for the MPT3SAS # # This code is based on drivers/scsi/mpt3sas/Kconfig -# Copyright (C) 2012-2013 LSI Corporation +# Copyright (C) 2012-2014 LSI Corporation # (mailto:dl-mptfusionli...@lsi.com) # This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index dc143dd..c34c115 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index becee07..e261a31 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_cnfg.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index b3e3331..068c98e 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_init.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h index 15813f3..4908309 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_ioc.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h index fbe3aae..13d93ca 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_raid.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_sas.h b/drivers/scsi/mpt3sas/mpi/mpi2_sas.h index 361a275..156e305 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_sas.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_sas.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_sas.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h index 94e32c2..904910d 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_tool.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_type.h b/drivers/scsi/mpt3sas/mpi/mpi2_type.h index ba1fed5..99ab093 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_type.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_type.h diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 93ce2b2..faa3380 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.c - * Copyright (C) 2012-2013 LSI Corporation + * Copyright (C) 2012-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistr
[PATCH v2 09/18][SCSI] mpt2sas: Bump mpt2sas driver version to 18.100.00.00
Bump mpt2sas driver version to 18.100.00.00. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpt2sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 9bc8e0b..239f169 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -69,8 +69,8 @@ #define MPT2SAS_DRIVER_NAME"mpt2sas" #define MPT2SAS_AUTHOR "LSI Corporation " #define MPT2SAS_DESCRIPTION"LSI MPT Fusion SAS 2.0 Device Driver" -#define MPT2SAS_DRIVER_VERSION "17.100.00.00" -#define MPT2SAS_MAJOR_VERSION 17 +#define MPT2SAS_DRIVER_VERSION "18.100.00.00" +#define MPT2SAS_MAJOR_VERSION 18 #define MPT2SAS_MINOR_VERSION 100 #define MPT2SAS_BUILD_VERSION 00 #define MPT2SAS_RELEASE_VERSION00 -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 02/18][SCSI] mpt2sas: MPI2 Rev Y (2.00.17) and Rev Z (2.00.18) specifications
Below is the change set in MPI2 Rev Y specification and in 2.00.17 header files 1) Added SCSIStatusQualifier to SCSI IO Error Reply message. 2) Added ATA Security Freeze Lock to IO Unit Page 1 Flags field. Below is the change set in MPI2 Rev Z specification and in 2.00.19 header files 1) Added reserved fields to IO Unit Page 7 for future use. 2) Added optional functionality to IOCInit Request so that the host may specify a separate base address for each Reply Descriptor Post Queue. IOC support for this is indicated using a new IOCCapabilities bit in the IOCFacts Reply. 3) Added Toolbox Console Text Display Tool The host uses the Console Text Display Tool to send a string to IOC's Console using different console types (eg: UART serial terminal or Ethernet terminal). The copyright in the mpi files is updated for year 2014 Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/mpi/mpi2.h | 12 -- drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h | 29 ++ drivers/scsi/mpt2sas/mpi/mpi2_init.h | 8 ++-- drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | 74 ++-- drivers/scsi/mpt2sas/mpi/mpi2_raid.h | 8 +++- drivers/scsi/mpt2sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt2sas/mpi/mpi2_tool.h | 44 - drivers/scsi/mpt2sas/mpi/mpi2_type.h | 2 +- 8 files changed, 148 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpi/mpi2.h b/drivers/scsi/mpt2sas/mpi/mpi2.h index 7b14a01..088eefa 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2.h @@ -8,7 +8,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.28 + * mpi2.h Version: 02.00.32 * * Version History * --- @@ -78,6 +78,11 @@ * 07-10-12 02.00.26 Bumped MPI2_HEADER_VERSION_UNIT. * 07-26-12 02.00.27 Bumped MPI2_HEADER_VERSION_UNIT. * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. + * 12-20-12 02.00.29 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET. + * 04-09-13 02.00.30 Bumped MPI2_HEADER_VERSION_UNIT. + * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-19-13 02.00.32 Bumped MPI2_HEADER_VERSION_UNIT. * -- */ @@ -103,7 +108,7 @@ #define MPI2_VERSION_02_00 (0x0200) /* versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x1C) +#define MPI2_HEADER_VERSION_UNIT(0x20) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -263,6 +268,7 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS #define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FF) #define MPI2_RPHI_MSIX_INDEX_MASK (0xFF00) #define MPI2_RPHI_MSIX_INDEX_SHIFT (24) +#define MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x030C) /* MPI v2.5 only */ /* * Defines for the HCBSize and address diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h index 88cb7f8..510ef0d 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - *mpi2_cnfg.h Version: 02.00.23 + *mpi2_cnfg.h Version: 02.00.26 * * Version History * --- @@ -150,7 +150,13 @@ * Added UEFIVersion field to BIOS Page 1 and defined new * BiosOptions bits. * 11-27-12 02.00.23 Added MPI2_MANPAGE7_FLAG_EVENTREPLAY_SLOT_ORDER. - * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. + * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. + * 12-20-12 02.00.24 Marked MPI2_SASIOUNIT1_CONTROL_CLEAR_AFFILIATION as + * obsolete for MPI v2.5 and later. + * Added some defines for 12G SAS speeds. + * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. + * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to + * match the specification. * -- */ @@ -773,6 +779,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 #define MPI2_IOUNITPAGE1_PAGEVERSION(0x04) /* IO Unit Page 1 Flags defines */ +#define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x4000) #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVER
[PATCH v2 03/18][SCSI] mpt2sas: Copyright in driver sources is updated for year the 2014
Copyright in driver sources is updated for year the 2014. Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt2sas/Kconfig | 2 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_base.h | 2 +- drivers/scsi/mpt2sas/mpt2sas_config.c| 2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.h | 2 +- drivers/scsi/mpt2sas/mpt2sas_debug.h | 2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig index 39f08dd..657b45c 100644 --- a/drivers/scsi/mpt2sas/Kconfig +++ b/drivers/scsi/mpt2sas/Kconfig @@ -2,7 +2,7 @@ # Kernel configuration file for the MPT2SAS # # This code is based on drivers/scsi/mpt2sas/Kconfig -# Copyright (C) 2007-2012 LSI Corporation +# Copyright (C) 2007-2014 LSI Corporation # (mailto:dl-mptfusionli...@lsi.com) # This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 982703a..24d0e52 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt2sas/mpt2_base.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 0ac5815..89f944a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt2sas/mpt2_base.h - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c index 0c47425..c72a2ff 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_config.c +++ b/drivers/scsi/mpt2sas/mpt2sas_config.c @@ -2,7 +2,7 @@ * This module provides common API for accessing firmware configuration pages * * This code is based on drivers/scsi/mpt2sas/mpt2_base.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 62df8f9..ca4e563 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c @@ -3,7 +3,7 @@ * controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.h b/drivers/scsi/mpt2sas/mpt2sas_ctl.h index 8b2ac18..fa0567c 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.h +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.h @@ -3,7 +3,7 @@ * controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.h - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_debug.h b/drivers/scsi/mpt2sas/mpt2sas_debug.h index a9021cb..cc57ef3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_debug.h +++ b/drivers/scsi/mpt2sas/mpt2sas_debug.h @@ -2,7 +2,7 @@ * Logging Support for MPT (Message Passing Technology) based controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_debug.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index dd46101..db71b60 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -2,7 +2,7 @@ * Scsi Host Layer for MPT (Message Passing Technology) based controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_scsih.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 410f4a3..0d1d064 100644 --- a/dr
[PATCH 00/18][SCSI] mpt2sas,mpt3sas: mpt2sas's phase17, phase18 and mpt3sas's phase2, phase3 patch set series
This patch set series contains latest reviewed mpt2sas driver's Phase17 and Phase18 patches and also mpt3sas driver's Phase2 and Phase3 patches. Thanks Martin for reviewing all these patches. Incremented the version to v2 for all these patches to indicate that these are the latest patches and accommodates all the review changes. Droped below patch from this series and I will include this patch in the next series once the review completes on this patch mpt2sas: Added module parameter 'unblock_io' to unblock IO's during disk addition Sreekanth Reddy (18): [SCSI] mpt2sas: Added driver module parameter max_msix_vectors [SCSI] mpt2sas: MPI2 Rev Y (2.00.17) and Rev Z (2.00.18) specifications [SCSI] mpt2sas: Copyright in driver sources is updated for year the 2014 [SCSI] mpt2sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced [SCSI] mpt2sas: Bump mpt2sas driver version to 17.100.00.00 [SCSI] mpt2sas: Avoid type casting for direct I/O commands [SCSI] mpt2sas: Added Reply Descriptor Post Queue (RDPQ) Array support [SCSI] mpt2sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state. [SCSI] mpt2sas: Bump mpt2sas driver version to 18.100.00.00 [SCSI] mpt3sas: MPI2.5 Rev G (2.5.2) specifications SCSI] mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced [SCSI] mpt3sas: Bump mpt3sas driver version to 03.100.00.00 [SCSI] mpt3sas: MPI2.5 Rev H (2.5.3) specifications [SCSI] mpt3sas: Copyright in driver sources is updated for year the 2014. [SCSI] mpt3sas: Added OEM branding Strings [SCSI] mpt3sas: Added Reply Descriptor Post Queue (RDPQ) Array support [SCSI] mpt3sas: Bump mpt3sas driver version to 04.100.00.00 [SCSI] mpt3sas, mpt2sas: fix scsi_add_host error handling problems in _scsih_probe drivers/scsi/mpt2sas/Kconfig| 2 +- drivers/scsi/mpt2sas/mpi/mpi2.h | 12 +- drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h| 29 ++- drivers/scsi/mpt2sas/mpi/mpi2_init.h| 8 +- drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | 74 ++- drivers/scsi/mpt2sas/mpi/mpi2_raid.h| 8 +- drivers/scsi/mpt2sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt2sas/mpi/mpi2_tool.h| 44 +++- drivers/scsi/mpt2sas/mpi/mpi2_type.h| 2 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 322 +++- drivers/scsi/mpt2sas/mpt2sas_base.h | 28 ++- drivers/scsi/mpt2sas/mpt2sas_config.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.h | 2 +- drivers/scsi/mpt2sas/mpt2sas_debug.h| 2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c| 197 + drivers/scsi/mpt2sas/mpt2sas_transport.c| 2 +- drivers/scsi/mpt3sas/Kconfig| 2 +- drivers/scsi/mpt3sas/mpi/mpi2.h | 8 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h| 18 +- drivers/scsi/mpt3sas/mpi/mpi2_init.h| 8 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 64 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h| 8 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 8 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h| 45 +++- drivers/scsi/mpt3sas/mpi/mpi2_type.h| 2 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 283 +++- drivers/scsi/mpt3sas/mpt3sas_base.h | 49 - drivers/scsi/mpt3sas/mpt3sas_config.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_debug.h| 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c| 78 +-- drivers/scsi/mpt3sas/mpt3sas_transport.c| 2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h | 2 +- 36 files changed, 1026 insertions(+), 299 deletions(-) -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/2] arcmsr: simplify of updating doneq_index and postq_index
From: Ching Huang This patch is to modify previous patch 16/17 and it is relative to http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr change in v4: 1. clean up of duplicate variable declaration in switch. 2. simplify of updating doneq_index and postq_index 3. fix spin_lock area in arcmsr_hbaD_polling_ccbdone Signed-off-by: Ching Huang --- diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2014-09-12 12:43:16.956653000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2014-09-12 15:00:23.516069000 +0800 @@ -1121,7 +1121,7 @@ static void arcmsr_drain_donequeue(struc static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb) { int i = 0; - uint32_t flag_ccb; + uint32_t flag_ccb, ccb_cdb_phy; struct ARCMSR_CDB *pARCMSR_CDB; bool error; struct CommandControlBlock *pCCB; @@ -1165,10 +1165,6 @@ static void arcmsr_done4abort_postqueue( break; case ACB_ADAPTER_TYPE_C: { struct MessageUnit_C __iomem *reg = acb->pmuC; - struct ARCMSR_CDB *pARCMSR_CDB; - uint32_t flag_ccb, ccb_cdb_phy; - bool error; - struct CommandControlBlock *pCCB; while ((readl(®->host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { /*need to do*/ flag_ccb = readl(®->outbound_queueport_low); @@ -1182,10 +1178,8 @@ static void arcmsr_done4abort_postqueue( break; case ACB_ADAPTER_TYPE_D: { struct MessageUnit_D *pmu = acb->pmuD; - uint32_t ccb_cdb_phy, outbound_write_pointer; - uint32_t doneq_index, index_stripped, addressLow, residual; - bool error; - struct CommandControlBlock *pCCB; + uint32_t outbound_write_pointer; + uint32_t doneq_index, index_stripped, addressLow, residual, toggle; outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1; doneq_index = pmu->doneq_index; @@ -1193,23 +1187,11 @@ static void arcmsr_done4abort_postqueue( for (i = 0; i < residual; i++) { while ((doneq_index & 0xFFF) != (outbound_write_pointer & 0xFFF)) { - if (doneq_index & 0x4000) { - index_stripped = doneq_index & 0xFFF; - index_stripped += 1; - index_stripped %= - ARCMSR_MAX_ARC1214_DONEQUEUE; - pmu->doneq_index = index_stripped ? - (index_stripped | 0x4000) : - (index_stripped + 1); - } else { - index_stripped = doneq_index; - index_stripped += 1; - index_stripped %= - ARCMSR_MAX_ARC1214_DONEQUEUE; - pmu->doneq_index = index_stripped ? - index_stripped : - ((index_stripped | 0x4000) + 1); - } + toggle = doneq_index & 0x4000; + index_stripped = (doneq_index & 0xFFF) + 1; + index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE; + pmu->doneq_index = index_stripped ? (index_stripped | toggle) : + ((toggle ^ 0x4000) + 1); doneq_index = pmu->doneq_index; addressLow = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow; @@ -1461,7 +1443,7 @@ static void arcmsr_post_ccb(struct Adapt case ACB_ADAPTER_TYPE_D: { struct MessageUnit_D *pmu = acb->pmuD; u16 index_stripped; - u16 postq_index; + u16 postq_index, toggle; unsigned long flags; struct InBound_SRB *pinbound_srb; @@ -1472,19 +1454,11 @@ static void arcmsr_post_ccb(struct Adapt pinbound_srb->addressLow = dma_addr_lo32(cdb_phyaddr); pinbound_srb->length = ccb->arc_cdb_size >> 2; arcmsr_cdb->msgContext = dma_addr_lo32(cdb_phyaddr); - if (postq_index & 0x4000) { - index_stripped = postq_index & 0xFF; - index_stripped += 1; - index_stripped %= ARCMSR_MAX_ARC1214_POSTQUEUE; -
[PATCH] ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
Signed-off-by: Loc Ho Signed-off-by: Suman Tripathi --- Suman Tripathi (1): ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver. drivers/ata/ahci_xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.8.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
This patch fixes the error print invalid resource for the APM X-Gene SoC AHCI SATA Host Controller driver. This print was due to the fact that the controller 3 don't have a mux resource. This didn't result in any errors but the print seems like meaningless. Signed-off-by: Loc Ho Signed-off-by: Suman Tripathi --- drivers/ata/ahci_xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 40d0a76..9404db0c 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -434,7 +434,7 @@ static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx) u32 val; /* Check for optional MUX resource */ - if (IS_ERR(ctx->csr_mux)) + if (!ctx->csr_mux) return 0; val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG); @@ -485,7 +485,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) /* Retrieve the optional IP mux resource */ res = platform_get_resource(pdev, IORESOURCE_MEM, 4); - ctx->csr_mux = devm_ioremap_resource(dev, res); + ctx->csr_mux = res ? devm_ioremap_resource(dev, res) : NULL; dev_dbg(dev, "VAddr 0x%p Mmio VAddr 0x%p\n", ctx->csr_core, hpriv->mmio); -- 1.8.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/2] arcmsr: simplify ioctl data read/write
From: Ching Huang This patch is to modify previous patch 13/17 and it is relative to http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr change in v4: 1. for readability, rename firstindex to getIndex, rename lastindex to putIndex 2. define ARCMSR_API_DATA_BUFLEN as 1032 3. simplify ioctl data read by macro CIRC_CNT_TO_END and CIRC_CNT Signed-off-by: Ching Huang --- diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c --- a/drivers/scsi/arcmsr/arcmsr_attr.c 2014-08-21 12:14:27.0 +0800 +++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2014-09-12 15:18:46.659125000 +0800 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ static ssize_t arcmsr_sysfs_iop_message_ struct device *dev = container_of(kobj,struct device,kobj); struct Scsi_Host *host = class_to_shost(dev); struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; - uint8_t *pQbuffer,*ptmpQbuffer; + uint8_t *ptmpQbuffer; int32_t allxfer_len = 0; unsigned long flags; @@ -78,57 +79,22 @@ static ssize_t arcmsr_sysfs_iop_message_ /* do message unit read. */ ptmpQbuffer = (uint8_t *)buf; spin_lock_irqsave(&acb->rqbuffer_lock, flags); - if (acb->rqbuf_firstindex != acb->rqbuf_lastindex) { - pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex]; - if (acb->rqbuf_firstindex > acb->rqbuf_lastindex) { - if ((ARCMSR_MAX_QBUFFER - acb->rqbuf_firstindex) >= 1032) { - memcpy(ptmpQbuffer, pQbuffer, 1032); - acb->rqbuf_firstindex += 1032; - acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER; - allxfer_len = 1032; - } else { - if (((ARCMSR_MAX_QBUFFER - acb->rqbuf_firstindex) - + acb->rqbuf_lastindex) > 1032) { - memcpy(ptmpQbuffer, pQbuffer, - ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex); - ptmpQbuffer += ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex; - memcpy(ptmpQbuffer, acb->rqbuffer, 1032 - - (ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex)); - acb->rqbuf_firstindex = 1032 - - (ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex); - allxfer_len = 1032; - } else { - memcpy(ptmpQbuffer, pQbuffer, - ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex); - ptmpQbuffer += ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex; - memcpy(ptmpQbuffer, acb->rqbuffer, - acb->rqbuf_lastindex); - allxfer_len = ARCMSR_MAX_QBUFFER - - acb->rqbuf_firstindex + - acb->rqbuf_lastindex; - acb->rqbuf_firstindex = - acb->rqbuf_lastindex; - } - } - } else { - if ((acb->rqbuf_lastindex - acb->rqbuf_firstindex) > 1032) { - memcpy(ptmpQbuffer, pQbuffer, 1032); - acb->rqbuf_firstindex += 1032; - allxfer_len = 1032; - } else { - memcpy(ptmpQbuffer, pQbuffer, acb->rqbuf_lastindex - - acb->rqbuf_firstindex); - allxfer_len = acb->rqbuf_lastindex - - acb->rqbuf_firstindex; - acb->rqbuf_firstindex = acb->rqbuf_lastindex; - } + if (acb->rqbuf_getIndex != acb->rqbuf_putIndex) { + unsigned int tail = acb->rqbuf_getIndex; + unsigned int head = acb->rqbuf_putIndex; + unsigned int cnt_to_end = CIRC_CNT_TO_END(head, tail, ARCMSR_MAX_QBUFFER); + + allxfer_len = CIRC_CNT(head, tail, ARCMSR_MAX_QBUFFER); + if (allxfer_len > ARCMSR_API_DATA_BUFLEN) +