diff options
| author | Asai Thambi S P <asamymuthupa@micron.com> | 2012-04-09 02:35:39 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2012-04-09 02:35:39 -0400 |
| commit | c74b0f586fa3cbc92ca451836fd75ae7a3fa85ac (patch) | |
| tree | 75d9e1086d2cc934568df2aef91ec552825adad5 | |
| parent | 8a857a880bd83ba4f217d55dd4a623a7e4b5cb47 (diff) | |
mtip32xx: fix handling of commands in various scenarios
* If a ncq command time out and a non-ncq command is active, skip restart port
* Queue(pause) ncq commands during operations spanning more than one non-ncq commands - secure erase, download microcode
* When a non-ncq command is active, allow incoming non-ncq commands to wait instead of failing back
* Changed timeout for download microcode and smart commands
* If the device in write protect mode, fail all writes (do not send to device)
* Set maximum retries to 2
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 144 | ||||
| -rw-r--r-- | drivers/block/mtip32xx/mtip32xx.h | 39 |
2 files changed, 132 insertions, 51 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index e57864a7912e..47404ef5749f 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
| @@ -436,7 +436,8 @@ static void mtip_init_port(struct mtip_port *port) | |||
| 436 | writel(0xFFFFFFFF, port->completed[i]); | 436 | writel(0xFFFFFFFF, port->completed[i]); |
| 437 | 437 | ||
| 438 | /* Clear any pending interrupts for this port */ | 438 | /* Clear any pending interrupts for this port */ |
| 439 | writel(readl(port->mmio + PORT_IRQ_STAT), port->mmio + PORT_IRQ_STAT); | 439 | writel(readl(port->dd->mmio + PORT_IRQ_STAT), |
| 440 | port->dd->mmio + PORT_IRQ_STAT); | ||
| 440 | 441 | ||
| 441 | /* Clear any pending interrupts on the HBA. */ | 442 | /* Clear any pending interrupts on the HBA. */ |
| 442 | writel(readl(port->dd->mmio + HOST_IRQ_STAT), | 443 | writel(readl(port->dd->mmio + HOST_IRQ_STAT), |
| @@ -541,6 +542,7 @@ static void mtip_timeout_function(unsigned long int data) | |||
| 541 | int tag, cmdto_cnt = 0; | 542 | int tag, cmdto_cnt = 0; |
| 542 | unsigned int bit, group; | 543 | unsigned int bit, group; |
| 543 | unsigned int num_command_slots = port->dd->slot_groups * 32; | 544 | unsigned int num_command_slots = port->dd->slot_groups * 32; |
| 545 | unsigned long to; | ||
| 544 | 546 | ||
| 545 | if (unlikely(!port)) | 547 | if (unlikely(!port)) |
| 546 | return; | 548 | return; |
| @@ -605,7 +607,7 @@ static void mtip_timeout_function(unsigned long int data) | |||
| 605 | } | 607 | } |
| 606 | } | 608 | } |
| 607 | 609 | ||
| 608 | if (cmdto_cnt) { | 610 | if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { |
| 609 | dev_warn(&port->dd->pdev->dev, | 611 | dev_warn(&port->dd->pdev->dev, |
| 610 | "%d commands timed out: restarting port", | 612 | "%d commands timed out: restarting port", |
| 611 | cmdto_cnt); | 613 | cmdto_cnt); |
| @@ -614,6 +616,21 @@ static void mtip_timeout_function(unsigned long int data) | |||
| 614 | wake_up_interruptible(&port->svc_wait); | 616 | wake_up_interruptible(&port->svc_wait); |
| 615 | } | 617 | } |
| 616 | 618 | ||
| 619 | if (port->ic_pause_timer) { | ||
| 620 | to = port->ic_pause_timer + msecs_to_jiffies(1000); | ||
| 621 | if (time_after(jiffies, to)) { | ||
| 622 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | ||
| 623 | port->ic_pause_timer = 0; | ||
| 624 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
| 625 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
| 626 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | ||
| 627 | wake_up_interruptible(&port->svc_wait); | ||
| 628 | } | ||
| 629 | |||
| 630 | |||
| 631 | } | ||
| 632 | } | ||
| 633 | |||
| 617 | /* Restart the timer */ | 634 | /* Restart the timer */ |
| 618 | mod_timer(&port->cmd_timer, | 635 | mod_timer(&port->cmd_timer, |
| 619 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); | 636 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); |
| @@ -1105,6 +1122,39 @@ static void mtip_issue_non_ncq_command(struct mtip_port *port, int tag) | |||
| 1105 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); | 1122 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); |
| 1106 | } | 1123 | } |
| 1107 | 1124 | ||
| 1125 | static bool mtip_pause_ncq(struct mtip_port *port, | ||
| 1126 | struct host_to_dev_fis *fis) | ||
| 1127 | { | ||
| 1128 | struct host_to_dev_fis *reply; | ||
| 1129 | unsigned long task_file_data; | ||
| 1130 | |||
| 1131 | reply = port->rxfis + RX_FIS_D2H_REG; | ||
| 1132 | task_file_data = readl(port->mmio+PORT_TFDATA); | ||
| 1133 | |||
| 1134 | if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) | ||
| 1135 | return false; | ||
| 1136 | |||
| 1137 | if (fis->command == ATA_CMD_SEC_ERASE_PREP) { | ||
| 1138 | set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
| 1139 | port->ic_pause_timer = jiffies; | ||
| 1140 | return true; | ||
| 1141 | } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && | ||
| 1142 | (fis->features == 0x03)) { | ||
| 1143 | set_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
| 1144 | port->ic_pause_timer = jiffies; | ||
| 1145 | return true; | ||
| 1146 | } else if ((fis->command == ATA_CMD_SEC_ERASE_UNIT) || | ||
| 1147 | ((fis->command == 0xFC) && | ||
| 1148 | (fis->features == 0x27 || fis->features == 0x72 || | ||
| 1149 | fis->features == 0x62 || fis->features == 0x26))) { | ||
| 1150 | /* Com reset after secure erase or lowlevel format */ | ||
| 1151 | mtip_restart_port(port); | ||
| 1152 | return false; | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | return false; | ||
| 1156 | } | ||
| 1157 | |||
| 1108 | /* | 1158 | /* |
| 1109 | * Wait for port to quiesce | 1159 | * Wait for port to quiesce |
| 1110 | * | 1160 | * |
| @@ -1176,8 +1226,9 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
| 1176 | { | 1226 | { |
| 1177 | struct mtip_cmd_sg *command_sg; | 1227 | struct mtip_cmd_sg *command_sg; |
| 1178 | DECLARE_COMPLETION_ONSTACK(wait); | 1228 | DECLARE_COMPLETION_ONSTACK(wait); |
| 1179 | int rv = 0; | 1229 | int rv = 0, ready2go = 1; |
| 1180 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1230 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; |
| 1231 | unsigned long to; | ||
| 1181 | 1232 | ||
| 1182 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ | 1233 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ |
| 1183 | if (buffer & 0x00000007) { | 1234 | if (buffer & 0x00000007) { |
| @@ -1186,13 +1237,26 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
| 1186 | return -EFAULT; | 1237 | return -EFAULT; |
| 1187 | } | 1238 | } |
| 1188 | 1239 | ||
| 1189 | /* Only one internal command should be running at a time */ | 1240 | to = jiffies + msecs_to_jiffies(timeout); |
| 1190 | if (test_and_set_bit(MTIP_TAG_INTERNAL, port->allocated)) { | 1241 | do { |
| 1242 | ready2go = !test_and_set_bit(MTIP_TAG_INTERNAL, | ||
| 1243 | port->allocated); | ||
| 1244 | if (ready2go) | ||
| 1245 | break; | ||
| 1246 | mdelay(100); | ||
| 1247 | } while (time_before(jiffies, to)); | ||
| 1248 | if (!ready2go) { | ||
| 1191 | dev_warn(&port->dd->pdev->dev, | 1249 | dev_warn(&port->dd->pdev->dev, |
| 1192 | "Internal command already active\n"); | 1250 | "Internal cmd active. new cmd [%02X]\n", fis->command); |
| 1193 | return -EBUSY; | 1251 | return -EBUSY; |
| 1194 | } | 1252 | } |
| 1195 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | 1253 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
| 1254 | port->ic_pause_timer = 0; | ||
| 1255 | |||
| 1256 | if (fis->command == ATA_CMD_SEC_ERASE_UNIT) | ||
| 1257 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
| 1258 | else if (fis->command == ATA_CMD_DOWNLOAD_MICRO) | ||
| 1259 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
| 1196 | 1260 | ||
| 1197 | if (atomic == GFP_KERNEL) { | 1261 | if (atomic == GFP_KERNEL) { |
| 1198 | if (fis->command != ATA_CMD_STANDBYNOW1) { | 1262 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
| @@ -1314,6 +1378,10 @@ exec_ic_exit: | |||
| 1314 | /* Clear the allocated and active bits for the internal command. */ | 1378 | /* Clear the allocated and active bits for the internal command. */ |
| 1315 | atomic_set(&int_cmd->active, 0); | 1379 | atomic_set(&int_cmd->active, 0); |
| 1316 | release_slot(port, MTIP_TAG_INTERNAL); | 1380 | release_slot(port, MTIP_TAG_INTERNAL); |
| 1381 | if (rv >= 0 && mtip_pause_ncq(port, fis)) { | ||
| 1382 | /* NCQ paused */ | ||
| 1383 | return rv; | ||
| 1384 | } | ||
| 1317 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | 1385 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
| 1318 | wake_up_interruptible(&port->svc_wait); | 1386 | wake_up_interruptible(&port->svc_wait); |
| 1319 | 1387 | ||
| @@ -1767,8 +1835,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
| 1767 | fis.cyl_hi = command[5]; | 1835 | fis.cyl_hi = command[5]; |
| 1768 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ | 1836 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ |
| 1769 | 1837 | ||
| 1770 | 1838 | dbg_printk(MTIP_DRV_NAME " %s: User Command: cmd %x, feat %x, nsect %x, sect %x, lcyl %x, hcyl %x, sel %x\n", | |
| 1771 | dbg_printk(MTIP_DRV_NAME "%s: User Command: cmd %x, feat %x, nsect %x, sect %x, lcyl %x, hcyl %x, sel %x\n", | ||
| 1772 | __func__, | 1839 | __func__, |
| 1773 | command[0], | 1840 | command[0], |
| 1774 | command[1], | 1841 | command[1], |
| @@ -1795,7 +1862,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
| 1795 | command[4] = reply->cyl_low; | 1862 | command[4] = reply->cyl_low; |
| 1796 | command[5] = reply->cyl_hi; | 1863 | command[5] = reply->cyl_hi; |
| 1797 | 1864 | ||
| 1798 | dbg_printk(MTIP_DRV_NAME "%s: Completion Status: stat %x, err %x , cyl_lo %x cyl_hi %x\n", | 1865 | dbg_printk(MTIP_DRV_NAME " %s: Completion Status: stat %x, err %x , cyl_lo %x cyl_hi %x\n", |
| 1799 | __func__, | 1866 | __func__, |
| 1800 | command[0], | 1867 | command[0], |
| 1801 | command[1], | 1868 | command[1], |
| @@ -1838,7 +1905,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
| 1838 | } | 1905 | } |
| 1839 | 1906 | ||
| 1840 | dbg_printk(MTIP_DRV_NAME | 1907 | dbg_printk(MTIP_DRV_NAME |
| 1841 | "%s: User Command: cmd %x, sect %x, " | 1908 | " %s: User Command: cmd %x, sect %x, " |
| 1842 | "feat %x, sectcnt %x\n", | 1909 | "feat %x, sectcnt %x\n", |
| 1843 | __func__, | 1910 | __func__, |
| 1844 | command[0], | 1911 | command[0], |
| @@ -1867,7 +1934,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
| 1867 | command[2] = command[3]; | 1934 | command[2] = command[3]; |
| 1868 | 1935 | ||
| 1869 | dbg_printk(MTIP_DRV_NAME | 1936 | dbg_printk(MTIP_DRV_NAME |
| 1870 | "%s: Completion Status: stat %x, " | 1937 | " %s: Completion Status: stat %x, " |
| 1871 | "err %x, cmd %x\n", | 1938 | "err %x, cmd %x\n", |
| 1872 | __func__, | 1939 | __func__, |
| 1873 | command[0], | 1940 | command[0], |
| @@ -2070,9 +2137,10 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
| 2070 | } | 2137 | } |
| 2071 | 2138 | ||
| 2072 | dbg_printk(MTIP_DRV_NAME | 2139 | dbg_printk(MTIP_DRV_NAME |
| 2073 | "taskfile: cmd %x, feat %x, nsect %x," | 2140 | " %s: cmd %x, feat %x, nsect %x," |
| 2074 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," | 2141 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," |
| 2075 | " head/dev %x\n", | 2142 | " head/dev %x\n", |
| 2143 | __func__, | ||
| 2076 | fis.command, | 2144 | fis.command, |
| 2077 | fis.features, | 2145 | fis.features, |
| 2078 | fis.sect_count, | 2146 | fis.sect_count, |
| @@ -2083,8 +2151,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
| 2083 | 2151 | ||
| 2084 | switch (fis.command) { | 2152 | switch (fis.command) { |
| 2085 | case ATA_CMD_DOWNLOAD_MICRO: | 2153 | case ATA_CMD_DOWNLOAD_MICRO: |
| 2086 | /* Change timeout for Download Microcode to 60 seconds.*/ | 2154 | /* Change timeout for Download Microcode to 2 minutes */ |
| 2087 | timeout = 60000; | 2155 | timeout = 120000; |
| 2088 | break; | 2156 | break; |
| 2089 | case ATA_CMD_SEC_ERASE_UNIT: | 2157 | case ATA_CMD_SEC_ERASE_UNIT: |
| 2090 | /* Change timeout for Security Erase Unit to 4 minutes.*/ | 2158 | /* Change timeout for Security Erase Unit to 4 minutes.*/ |
| @@ -2100,8 +2168,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
| 2100 | timeout = 10000; | 2168 | timeout = 10000; |
| 2101 | break; | 2169 | break; |
| 2102 | case ATA_CMD_SMART: | 2170 | case ATA_CMD_SMART: |
| 2103 | /* Change timeout for vendor unique command to 10 secs */ | 2171 | /* Change timeout for vendor unique command to 15 secs */ |
| 2104 | timeout = 10000; | 2172 | timeout = 15000; |
| 2105 | break; | 2173 | break; |
| 2106 | default: | 2174 | default: |
| 2107 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; | 2175 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; |
| @@ -2163,18 +2231,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
| 2163 | req_task->hob_ports[1] = reply->features_ex; | 2231 | req_task->hob_ports[1] = reply->features_ex; |
| 2164 | req_task->hob_ports[2] = reply->sect_cnt_ex; | 2232 | req_task->hob_ports[2] = reply->sect_cnt_ex; |
| 2165 | } | 2233 | } |
| 2166 | |||
| 2167 | /* Com rest after secure erase or lowlevel format */ | ||
| 2168 | if (((fis.command == ATA_CMD_SEC_ERASE_UNIT) || | ||
| 2169 | ((fis.command == 0xFC) && | ||
| 2170 | (fis.features == 0x27 || fis.features == 0x72 || | ||
| 2171 | fis.features == 0x62 || fis.features == 0x26))) && | ||
| 2172 | !(reply->command & 1)) { | ||
| 2173 | mtip_restart_port(dd->port); | ||
| 2174 | } | ||
| 2175 | |||
| 2176 | dbg_printk(MTIP_DRV_NAME | 2234 | dbg_printk(MTIP_DRV_NAME |
| 2177 | "%s: Completion: stat %x," | 2235 | " %s: Completion: stat %x," |
| 2178 | "err %x, sect_cnt %x, lbalo %x," | 2236 | "err %x, sect_cnt %x, lbalo %x," |
| 2179 | "lbamid %x, lbahi %x, dev %x\n", | 2237 | "lbamid %x, lbahi %x, dev %x\n", |
| 2180 | __func__, | 2238 | __func__, |
| @@ -2396,8 +2454,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
| 2396 | * To prevent this command from being issued | 2454 | * To prevent this command from being issued |
| 2397 | * if an internal command is in progress or error handling is active. | 2455 | * if an internal command is in progress or error handling is active. |
| 2398 | */ | 2456 | */ |
| 2399 | if (unlikely(test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) || | 2457 | if (port->flags & MTIP_PF_PAUSE_IO) { |
| 2400 | test_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags))) { | ||
| 2401 | set_bit(tag, port->cmds_to_issue); | 2458 | set_bit(tag, port->cmds_to_issue); |
| 2402 | set_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); | 2459 | set_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); |
| 2403 | return; | 2460 | return; |
| @@ -2726,8 +2783,7 @@ static int mtip_service_thread(void *data) | |||
| 2726 | * is in progress nor error handling is active | 2783 | * is in progress nor error handling is active |
| 2727 | */ | 2784 | */ |
| 2728 | wait_event_interruptible(port->svc_wait, (port->flags) && | 2785 | wait_event_interruptible(port->svc_wait, (port->flags) && |
| 2729 | !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) && | 2786 | !(port->flags & MTIP_PF_PAUSE_IO)); |
| 2730 | !test_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags)); | ||
| 2731 | 2787 | ||
| 2732 | if (kthread_should_stop()) | 2788 | if (kthread_should_stop()) |
| 2733 | break; | 2789 | break; |
| @@ -2735,6 +2791,7 @@ static int mtip_service_thread(void *data) | |||
| 2735 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | 2791 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
| 2736 | &dd->dd_flag))) | 2792 | &dd->dd_flag))) |
| 2737 | break; | 2793 | break; |
| 2794 | |||
| 2738 | set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); | 2795 | set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); |
| 2739 | if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { | 2796 | if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { |
| 2740 | slot = 1; | 2797 | slot = 1; |
| @@ -2773,7 +2830,7 @@ static int mtip_service_thread(void *data) | |||
| 2773 | } | 2830 | } |
| 2774 | clear_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); | 2831 | clear_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); |
| 2775 | 2832 | ||
| 2776 | if (test_bit(MTIP_PF_SVC_THD_SHOULD_STOP_BIT, &port->flags)) | 2833 | if (test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags)) |
| 2777 | break; | 2834 | break; |
| 2778 | } | 2835 | } |
| 2779 | return 0; | 2836 | return 0; |
| @@ -3421,9 +3478,22 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
| 3421 | int nents = 0; | 3478 | int nents = 0; |
| 3422 | int tag = 0; | 3479 | int tag = 0; |
| 3423 | 3480 | ||
| 3424 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) { | 3481 | if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { |
| 3425 | bio_endio(bio, -ENXIO); | 3482 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
| 3426 | return; | 3483 | &dd->dd_flag))) { |
| 3484 | bio_endio(bio, -ENXIO); | ||
| 3485 | return; | ||
| 3486 | } | ||
| 3487 | if (unlikely(test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))) { | ||
| 3488 | bio_endio(bio, -ENODATA); | ||
| 3489 | return; | ||
| 3490 | } | ||
| 3491 | if (unlikely(test_bit(MTIP_DDF_WRITE_PROTECT_BIT, | ||
| 3492 | &dd->dd_flag) && | ||
| 3493 | bio_data_dir(bio))) { | ||
| 3494 | bio_endio(bio, -ENODATA); | ||
| 3495 | return; | ||
| 3496 | } | ||
| 3427 | } | 3497 | } |
| 3428 | 3498 | ||
| 3429 | if (unlikely(!bio_has_data(bio))) { | 3499 | if (unlikely(!bio_has_data(bio))) { |
| @@ -3599,7 +3669,7 @@ start_service_thread: | |||
| 3599 | dd, thd_name); | 3669 | dd, thd_name); |
| 3600 | 3670 | ||
| 3601 | if (IS_ERR(dd->mtip_svc_handler)) { | 3671 | if (IS_ERR(dd->mtip_svc_handler)) { |
| 3602 | printk(KERN_ERR "mtip32xx: service thread failed to start\n"); | 3672 | dev_err(&dd->pdev->dev, "service thread failed to start\n"); |
| 3603 | dd->mtip_svc_handler = NULL; | 3673 | dd->mtip_svc_handler = NULL; |
| 3604 | rv = -EFAULT; | 3674 | rv = -EFAULT; |
| 3605 | goto kthread_run_error; | 3675 | goto kthread_run_error; |
| @@ -3648,7 +3718,7 @@ static int mtip_block_remove(struct driver_data *dd) | |||
| 3648 | struct kobject *kobj; | 3718 | struct kobject *kobj; |
| 3649 | 3719 | ||
| 3650 | if (dd->mtip_svc_handler) { | 3720 | if (dd->mtip_svc_handler) { |
| 3651 | set_bit(MTIP_PF_SVC_THD_SHOULD_STOP_BIT, &dd->port->flags); | 3721 | set_bit(MTIP_PF_SVC_THD_STOP_BIT, &dd->port->flags); |
| 3652 | wake_up_interruptible(&dd->port->svc_wait); | 3722 | wake_up_interruptible(&dd->port->svc_wait); |
| 3653 | kthread_stop(dd->mtip_svc_handler); | 3723 | kthread_stop(dd->mtip_svc_handler); |
| 3654 | } | 3724 | } |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 5ad2d79f7c4b..4ef58336310a 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
| @@ -34,8 +34,8 @@ | |||
| 34 | /* offset of Device Control register in PCIe extended capabilites space */ | 34 | /* offset of Device Control register in PCIe extended capabilites space */ |
| 35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
| 36 | 36 | ||
| 37 | /* # of times to retry timed out IOs */ | 37 | /* # of times to retry timed out/failed IOs */ |
| 38 | #define MTIP_MAX_RETRIES 5 | 38 | #define MTIP_MAX_RETRIES 2 |
| 39 | 39 | ||
| 40 | /* Various timeout values in ms */ | 40 | /* Various timeout values in ms */ |
| 41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 | 41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 |
| @@ -114,22 +114,32 @@ | |||
| 114 | #define __force_bit2int (unsigned int __force) | 114 | #define __force_bit2int (unsigned int __force) |
| 115 | 115 | ||
| 116 | /* below are bit numbers in 'flags' defined in mtip_port */ | 116 | /* below are bit numbers in 'flags' defined in mtip_port */ |
| 117 | #define MTIP_PF_IC_ACTIVE_BIT 0 | 117 | #define MTIP_PF_IC_ACTIVE_BIT 0 /* pio/ioctl */ |
| 118 | #define MTIP_PF_EH_ACTIVE_BIT 1 | 118 | #define MTIP_PF_EH_ACTIVE_BIT 1 /* error handling */ |
| 119 | #define MTIP_PF_SVC_THD_ACTIVE_BIT 2 | 119 | #define MTIP_PF_SE_ACTIVE_BIT 2 /* secure erase */ |
| 120 | #define MTIP_PF_ISSUE_CMDS_BIT 4 | 120 | #define MTIP_PF_DM_ACTIVE_BIT 3 /* download microcde */ |
| 121 | #define MTIP_PF_REBUILD_BIT 5 | 121 | #define MTIP_PF_PAUSE_IO ((1 << MTIP_PF_IC_ACTIVE_BIT) | \ |
| 122 | #define MTIP_PF_SVC_THD_SHOULD_STOP_BIT 8 | 122 | (1 << MTIP_PF_EH_ACTIVE_BIT) | \ |
| 123 | (1 << MTIP_PF_SE_ACTIVE_BIT) | \ | ||
| 124 | (1 << MTIP_PF_DM_ACTIVE_BIT)) | ||
| 125 | |||
| 126 | #define MTIP_PF_SVC_THD_ACTIVE_BIT 4 | ||
| 127 | #define MTIP_PF_ISSUE_CMDS_BIT 5 | ||
| 128 | #define MTIP_PF_REBUILD_BIT 6 | ||
| 129 | #define MTIP_PF_SVC_THD_STOP_BIT 8 | ||
| 123 | 130 | ||
| 124 | /* below are bit numbers in 'dd_flag' defined in driver_data */ | 131 | /* below are bit numbers in 'dd_flag' defined in driver_data */ |
| 125 | #define MTIP_DDF_REMOVE_PENDING_BIT 1 | 132 | #define MTIP_DDF_REMOVE_PENDING_BIT 1 |
| 126 | #define MTIP_DDF_RESUME_BIT 2 | 133 | #define MTIP_DDF_OVER_TEMP_BIT 2 |
| 127 | #define MTIP_DDF_CLEANUP_BIT 3 | 134 | #define MTIP_DDF_WRITE_PROTECT_BIT 3 |
| 128 | #define MTIP_DDF_INIT_DONE_BIT 4 | 135 | #define MTIP_DDF_STOP_IO ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ |
| 136 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | ||
| 137 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)) | ||
| 129 | 138 | ||
| 130 | #define MTIP_DDF_WRITE_PROTECT_BIT 5 | 139 | #define MTIP_DDF_CLEANUP_BIT 5 |
| 131 | #define MTIP_DDF_OVER_TEMP_BIT 6 | 140 | #define MTIP_DDF_RESUME_BIT 6 |
| 132 | #define MTIP_DDF_REBUILD_FAILED_BIT 7 | 141 | #define MTIP_DDF_INIT_DONE_BIT 7 |
| 142 | #define MTIP_DDF_REBUILD_FAILED_BIT 8 | ||
| 133 | 143 | ||
| 134 | __packed struct smart_attr{ | 144 | __packed struct smart_attr{ |
| 135 | u8 attr_id; | 145 | u8 attr_id; |
| @@ -393,6 +403,7 @@ struct mtip_port { | |||
| 393 | * Timer used to complete commands that have been active for too long. | 403 | * Timer used to complete commands that have been active for too long. |
| 394 | */ | 404 | */ |
| 395 | struct timer_list cmd_timer; | 405 | struct timer_list cmd_timer; |
| 406 | unsigned long ic_pause_timer; | ||
| 396 | /* | 407 | /* |
| 397 | * Semaphore used to block threads if there are no | 408 | * Semaphore used to block threads if there are no |
| 398 | * command slots available. | 409 | * command slots available. |
