libata-core: Allow longer timeout for drive spinup from PUIS
authorDamien Le Moal <damien.lemoal@hgst.com>
Mon, 4 Apr 2016 16:17:09 +0000 (12:17 -0400)
committerTejun Heo <tj@kernel.org>
Mon, 4 Apr 2016 16:17:09 +0000 (12:17 -0400)
When spinning up a drive from powered on standby mode (PUIS),
SETFEATURES_SPINUP is executed with the default timeout used
for any SETFEATURES subcommand, that is 5+10 seconds. The
total 15s is too short for some drives to complete spinup
(e.g. drives with a large indirection table stored on media),
resulting in ata_dev_read_id to fail twice on the execution
of SETFEATURES_SPINUP. For this feature, allow a larger
default timeout of 30 seconds. However, in the same spirit
as with the timeout of other feature subcommands, do not
ignore ata_probe_timeout if it is set).

Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libata-core.c
include/linux/ata.h

index 55e257c268ddde37677cf4ff85472f65e9a63c97..7b21021dbf7dc344b89d16113ef36d6db1c2ee2b 100644 (file)
@@ -4528,6 +4528,7 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
 {
        struct ata_taskfile tf;
        unsigned int err_mask;
+       unsigned long timeout = 0;
 
        /* set up set-features taskfile */
        DPRINTK("set features - SATA features\n");
@@ -4539,7 +4540,10 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
        tf.protocol = ATA_PROT_NODATA;
        tf.nsect = feature;
 
-       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
+       if (enable == SETFEATURES_SPINUP)
+               timeout = ata_probe_timeout ?
+                         ata_probe_timeout * 1000 : SETFEATURES_SPINUP_TIMEOUT;
+       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
 
        DPRINTK("EXIT, err_mask=%x\n", err_mask);
        return err_mask;
index c1a2f345cbe6146352fff77080019eba5d0fe76e..f310ec0f072e5e9ada48935d9c0c1b362424598f 100644 (file)
@@ -371,7 +371,8 @@ enum {
        SETFEATURES_AAM_ON      = 0x42,
        SETFEATURES_AAM_OFF     = 0xC2,
 
-       SETFEATURES_SPINUP      = 0x07, /* Spin-up drive */
+       SETFEATURES_SPINUP              = 0x07, /* Spin-up drive */
+       SETFEATURES_SPINUP_TIMEOUT      = 30000, /* 30s timeout for drive spin-up from PUIS */
 
        SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
        SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
This page took 0.029372 seconds and 5 git commands to generate.