aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Teel <scott.teel@hp.com>2014-02-18 14:57:00 -0500
committerJames Bottomley <JBottomley@Parallels.com>2014-03-15 13:19:07 -0400
commitda0697bd3075598f7990002dc46f208d722b6160 (patch)
tree64682fc16ed80050cf60c4f116384cb649502e44
parent6b80b18fe51540baf7f0c76b7d68df02f69db58c (diff)
[SCSI] hpsa: allow user to disable accelerated i/o path
Allow SSD Smart Path for a controller to be disabled by the user, regardless of settings in controller firmware or array configuration. To disable: echo 0 > /sys/class/scsi_host/host<id>/acciopath_status To re-enable: echo 1 > /sys/class/scsi_host/host<id>/acciopath_status To check state: cat /sys/class/scsi_host/host<id>/acciopath_status Signed-off-by: Scott Teel <scott.teel@hp.com> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--Documentation/ABI/testing/sysfs-class-scsi_host16
-rw-r--r--drivers/scsi/hpsa.c45
-rw-r--r--drivers/scsi/hpsa.h1
3 files changed, 61 insertions, 1 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-scsi_host b/Documentation/ABI/testing/sysfs-class-scsi_host
index 29a4f892e433..0eb255e7db12 100644
--- a/Documentation/ABI/testing/sysfs-class-scsi_host
+++ b/Documentation/ABI/testing/sysfs-class-scsi_host
@@ -11,3 +11,19 @@ Description:
11 guaranteed. The 'isci_id' attribute unambiguously identifies 11 guaranteed. The 'isci_id' attribute unambiguously identifies
12 the controller index: '0' for the first controller, 12 the controller index: '0' for the first controller,
13 '1' for the second. 13 '1' for the second.
14
15What: /sys/class/scsi_host/hostX/acciopath_status
16Date: November 2013
17Contact: Stephen M. Cameron <scameron@beardog.cce.hp.com>
18Description: This file contains the current status of the "SSD Smart Path"
19 feature of HP Smart Array RAID controllers using the hpsa
20 driver. SSD Smart Path, when enabled permits the driver to
21 send i/o requests directly to physical devices that are part
22 of a logical drive, bypassing the controllers firmware RAID
23 stack for a performance advantage when possible. A value of
24 '1' indicates the feature is enabled, and the controller may
25 use the direct i/o path to physical devices. A value of zero
26 means the feature is disabled and the controller may not use
27 the direct i/o path to physical devices. This setting is
28 controller wide, affecting all configured logical drives on the
29 controller. This file is readable and writable.
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7cd28714d8dd..a599a7b51a92 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -287,6 +287,30 @@ static int check_for_busy(struct ctlr_info *h, struct CommandList *c)
287 return 1; 287 return 1;
288} 288}
289 289
290static ssize_t host_store_hp_ssd_smart_path_status(struct device *dev,
291 struct device_attribute *attr,
292 const char *buf, size_t count)
293{
294 int status, len;
295 struct ctlr_info *h;
296 struct Scsi_Host *shost = class_to_shost(dev);
297 char tmpbuf[10];
298
299 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
300 return -EACCES;
301 len = count > sizeof(tmpbuf) - 1 ? sizeof(tmpbuf) - 1 : count;
302 strncpy(tmpbuf, buf, len);
303 tmpbuf[len] = '\0';
304 if (sscanf(tmpbuf, "%d", &status) != 1)
305 return -EINVAL;
306 h = shost_to_hba(shost);
307 h->acciopath_status = !!status;
308 dev_warn(&h->pdev->dev,
309 "hpsa: HP SSD Smart Path %s via sysfs update.\n",
310 h->acciopath_status ? "enabled" : "disabled");
311 return count;
312}
313
290static ssize_t host_store_rescan(struct device *dev, 314static ssize_t host_store_rescan(struct device *dev,
291 struct device_attribute *attr, 315 struct device_attribute *attr,
292 const char *buf, size_t count) 316 const char *buf, size_t count)
@@ -334,6 +358,17 @@ static ssize_t host_show_transport_mode(struct device *dev,
334 "performant" : "simple"); 358 "performant" : "simple");
335} 359}
336 360
361static ssize_t host_show_hp_ssd_smart_path_status(struct device *dev,
362 struct device_attribute *attr, char *buf)
363{
364 struct ctlr_info *h;
365 struct Scsi_Host *shost = class_to_shost(dev);
366
367 h = shost_to_hba(shost);
368 return snprintf(buf, 30, "HP SSD Smart Path %s\n",
369 (h->acciopath_status == 1) ? "enabled" : "disabled");
370}
371
337/* List of controllers which cannot be hard reset on kexec with reset_devices */ 372/* List of controllers which cannot be hard reset on kexec with reset_devices */
338static u32 unresettable_controller[] = { 373static u32 unresettable_controller[] = {
339 0x324a103C, /* Smart Array P712m */ 374 0x324a103C, /* Smart Array P712m */
@@ -546,6 +581,9 @@ static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
546static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); 581static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
547static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO, 582static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO,
548 host_show_hp_ssd_smart_path_enabled, NULL); 583 host_show_hp_ssd_smart_path_enabled, NULL);
584static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH,
585 host_show_hp_ssd_smart_path_status,
586 host_store_hp_ssd_smart_path_status);
549static DEVICE_ATTR(firmware_revision, S_IRUGO, 587static DEVICE_ATTR(firmware_revision, S_IRUGO,
550 host_show_firmware_revision, NULL); 588 host_show_firmware_revision, NULL);
551static DEVICE_ATTR(commands_outstanding, S_IRUGO, 589static DEVICE_ATTR(commands_outstanding, S_IRUGO,
@@ -569,6 +607,7 @@ static struct device_attribute *hpsa_shost_attrs[] = {
569 &dev_attr_commands_outstanding, 607 &dev_attr_commands_outstanding,
570 &dev_attr_transport_mode, 608 &dev_attr_transport_mode,
571 &dev_attr_resettable, 609 &dev_attr_resettable,
610 &dev_attr_hp_ssd_smart_path_status,
572 NULL, 611 NULL,
573}; 612};
574 613
@@ -3341,7 +3380,8 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
3341 * Retries always go down the normal I/O path. 3380 * Retries always go down the normal I/O path.
3342 */ 3381 */
3343 if (likely(cmd->retries == 0 && 3382 if (likely(cmd->retries == 0 &&
3344 cmd->request->cmd_type == REQ_TYPE_FS)) { 3383 cmd->request->cmd_type == REQ_TYPE_FS &&
3384 h->acciopath_status)) {
3345 if (dev->offload_enabled) { 3385 if (dev->offload_enabled) {
3346 rc = hpsa_scsi_ioaccel_raid_map(h, c); 3386 rc = hpsa_scsi_ioaccel_raid_map(h, c);
3347 if (rc == 0) 3387 if (rc == 0)
@@ -6326,6 +6366,9 @@ reinit_after_soft_reset:
6326 goto reinit_after_soft_reset; 6366 goto reinit_after_soft_reset;
6327 } 6367 }
6328 6368
6369 /* Enable Accelerated IO path at driver layer */
6370 h->acciopath_status = 1;
6371
6329 /* Turn the interrupts on so we can service requests */ 6372 /* Turn the interrupts on so we can service requests */
6330 h->access.set_intr_mask(h, HPSA_INTR_ON); 6373 h->access.set_intr_mask(h, HPSA_INTR_ON);
6331 6374
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 45bb1ea6835e..1d3340dbe310 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -181,6 +181,7 @@ struct ctlr_info {
181#define HPSATMF_LOG_QRY_TSET (1 << 24) 181#define HPSATMF_LOG_QRY_TSET (1 << 24)
182#define HPSATMF_LOG_QRY_ASYNC (1 << 25) 182#define HPSATMF_LOG_QRY_ASYNC (1 << 25)
183 u32 events; 183 u32 events;
184 int acciopath_status;
184}; 185};
185#define HPSA_ABORT_MSG 0 186#define HPSA_ABORT_MSG 0
186#define HPSA_DEVICE_RESET_MSG 1 187#define HPSA_DEVICE_RESET_MSG 1