diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 79fdb063f9c0..be96626accec 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -708,6 +708,14 @@ static void mtip_completion(struct mtip_port *port, | |||
708 | complete(waiting); | 708 | complete(waiting); |
709 | } | 709 | } |
710 | 710 | ||
711 | static void mtip_null_completion(struct mtip_port *port, | ||
712 | int tag, | ||
713 | void *data, | ||
714 | int status) | ||
715 | { | ||
716 | return; | ||
717 | } | ||
718 | |||
711 | /* | 719 | /* |
712 | * Helper function for tag logging | 720 | * Helper function for tag logging |
713 | */ | 721 | */ |
@@ -992,8 +1000,6 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) | |||
992 | } | 1000 | } |
993 | } | 1001 | } |
994 | 1002 | ||
995 | dev_warn(&dd->pdev->dev, "IRQ status 0x%x ignored.\n", port_stat); | ||
996 | |||
997 | return; | 1003 | return; |
998 | } | 1004 | } |
999 | 1005 | ||
@@ -1161,7 +1167,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1161 | * -EAGAIN Time out waiting for command to complete. | 1167 | * -EAGAIN Time out waiting for command to complete. |
1162 | */ | 1168 | */ |
1163 | static int mtip_exec_internal_command(struct mtip_port *port, | 1169 | static int mtip_exec_internal_command(struct mtip_port *port, |
1164 | void *fis, | 1170 | struct host_to_dev_fis *fis, |
1165 | int fis_len, | 1171 | int fis_len, |
1166 | dma_addr_t buffer, | 1172 | dma_addr_t buffer, |
1167 | int buf_len, | 1173 | int buf_len, |
@@ -1190,14 +1196,17 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1190 | set_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1196 | set_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); |
1191 | 1197 | ||
1192 | if (atomic == GFP_KERNEL) { | 1198 | if (atomic == GFP_KERNEL) { |
1193 | /* wait for io to complete if non atomic */ | 1199 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
1194 | if (mtip_quiesce_io(port, 5000) < 0) { | 1200 | /* wait for io to complete if non atomic */ |
1195 | dev_warn(&port->dd->pdev->dev, | 1201 | if (mtip_quiesce_io(port, 5000) < 0) { |
1196 | "Failed to quiesce IO\n"); | 1202 | dev_warn(&port->dd->pdev->dev, |
1197 | release_slot(port, MTIP_TAG_INTERNAL); | 1203 | "Failed to quiesce IO\n"); |
1198 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1204 | release_slot(port, MTIP_TAG_INTERNAL); |
1199 | wake_up_interruptible(&port->svc_wait); | 1205 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, |
1200 | return -EBUSY; | 1206 | &port->flags); |
1207 | wake_up_interruptible(&port->svc_wait); | ||
1208 | return -EBUSY; | ||
1209 | } | ||
1201 | } | 1210 | } |
1202 | 1211 | ||
1203 | /* Set the completion function and data for the command. */ | 1212 | /* Set the completion function and data for the command. */ |
@@ -1207,7 +1216,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1207 | } else { | 1216 | } else { |
1208 | /* Clear completion - we're going to poll */ | 1217 | /* Clear completion - we're going to poll */ |
1209 | int_cmd->comp_data = NULL; | 1218 | int_cmd->comp_data = NULL; |
1210 | int_cmd->comp_func = NULL; | 1219 | int_cmd->comp_func = mtip_null_completion; |
1211 | } | 1220 | } |
1212 | 1221 | ||
1213 | /* Copy the command to the command table */ | 1222 | /* Copy the command to the command table */ |
@@ -1273,12 +1282,14 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1273 | } else { | 1282 | } else { |
1274 | /* Spin for <timeout> checking if command still outstanding */ | 1283 | /* Spin for <timeout> checking if command still outstanding */ |
1275 | timeout = jiffies + msecs_to_jiffies(timeout); | 1284 | timeout = jiffies + msecs_to_jiffies(timeout); |
1276 | 1285 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | |
1277 | while ((readl( | 1286 | & (1 << MTIP_TAG_INTERNAL)) |
1278 | port->cmd_issue[MTIP_TAG_INTERNAL]) | 1287 | && time_before(jiffies, timeout)) { |
1279 | & (1 << MTIP_TAG_INTERNAL)) | 1288 | if (mtip_check_surprise_removal(port->dd->pdev)) { |
1280 | && time_before(jiffies, timeout)) { | 1289 | rv = -ENXIO; |
1281 | if (mtip_check_surprise_removal(port->dd->pdev) || | 1290 | goto exec_ic_exit; |
1291 | } | ||
1292 | if ((fis->command != ATA_CMD_STANDBYNOW1) && | ||
1282 | test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, | 1293 | test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, |
1283 | &port->dd->dd_flag)) { | 1294 | &port->dd->dd_flag)) { |
1284 | rv = -ENXIO; | 1295 | rv = -ENXIO; |
@@ -1289,8 +1300,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1289 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1300 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
1290 | & (1 << MTIP_TAG_INTERNAL)) { | 1301 | & (1 << MTIP_TAG_INTERNAL)) { |
1291 | dev_err(&port->dd->pdev->dev, | 1302 | dev_err(&port->dd->pdev->dev, |
1292 | "Internal command did not complete [%d]\n", | 1303 | "Internal command did not complete [atomic]\n"); |
1293 | atomic); | ||
1294 | rv = -EAGAIN; | 1304 | rv = -EAGAIN; |
1295 | if (test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, | 1305 | if (test_bit(MTIP_DD_FLAG_REMOVE_PENDING_BIT, |
1296 | &port->dd->dd_flag)) { | 1306 | &port->dd->dd_flag)) { |
@@ -2758,7 +2768,9 @@ static int mtip_service_thread(void *data) | |||
2758 | 2768 | ||
2759 | clear_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); | 2769 | clear_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); |
2760 | } else if (test_bit(MTIP_FLAG_REBUILD_BIT, &port->flags)) { | 2770 | } else if (test_bit(MTIP_FLAG_REBUILD_BIT, &port->flags)) { |
2761 | mtip_ftl_rebuild_poll(dd); | 2771 | if (!mtip_ftl_rebuild_poll(dd)) |
2772 | set_bit(MTIP_DD_FLAG_REBUILD_FAILED_BIT, | ||
2773 | &dd->dd_flag); | ||
2762 | clear_bit(MTIP_FLAG_REBUILD_BIT, &port->flags); | 2774 | clear_bit(MTIP_FLAG_REBUILD_BIT, &port->flags); |
2763 | } | 2775 | } |
2764 | clear_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); | 2776 | clear_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); |
@@ -3067,7 +3079,7 @@ static int mtip_hw_exit(struct driver_data *dd) | |||
3067 | */ | 3079 | */ |
3068 | if (!test_bit(MTIP_DD_FLAG_CLEANUP_BIT, &dd->dd_flag)) { | 3080 | if (!test_bit(MTIP_DD_FLAG_CLEANUP_BIT, &dd->dd_flag)) { |
3069 | 3081 | ||
3070 | if (test_bit(MTIP_FLAG_REBUILD_BIT, &dd->dd_flag)) | 3082 | if (!test_bit(MTIP_FLAG_REBUILD_BIT, &dd->port->flags)) |
3071 | if (mtip_standby_immediate(dd->port)) | 3083 | if (mtip_standby_immediate(dd->port)) |
3072 | dev_warn(&dd->pdev->dev, | 3084 | dev_warn(&dd->pdev->dev, |
3073 | "STANDBY IMMEDIATE failed\n"); | 3085 | "STANDBY IMMEDIATE failed\n"); |
@@ -3657,6 +3669,11 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3657 | * from /dev | 3669 | * from /dev |
3658 | */ | 3670 | */ |
3659 | del_gendisk(dd->disk); | 3671 | del_gendisk(dd->disk); |
3672 | |||
3673 | spin_lock(&rssd_index_lock); | ||
3674 | ida_remove(&rssd_index_ida, dd->index); | ||
3675 | spin_unlock(&rssd_index_lock); | ||
3676 | |||
3660 | blk_cleanup_queue(dd->queue); | 3677 | blk_cleanup_queue(dd->queue); |
3661 | dd->disk = NULL; | 3678 | dd->disk = NULL; |
3662 | dd->queue = NULL; | 3679 | dd->queue = NULL; |
@@ -3686,6 +3703,11 @@ static int mtip_block_shutdown(struct driver_data *dd) | |||
3686 | 3703 | ||
3687 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 3704 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
3688 | del_gendisk(dd->disk); | 3705 | del_gendisk(dd->disk); |
3706 | |||
3707 | spin_lock(&rssd_index_lock); | ||
3708 | ida_remove(&rssd_index_ida, dd->index); | ||
3709 | spin_unlock(&rssd_index_lock); | ||
3710 | |||
3689 | blk_cleanup_queue(dd->queue); | 3711 | blk_cleanup_queue(dd->queue); |
3690 | dd->disk = NULL; | 3712 | dd->disk = NULL; |
3691 | dd->queue = NULL; | 3713 | dd->queue = NULL; |