scsi: hisi_sas: Relocate DMA unmap of SMP task
authorXiang Chen <chenxiang66@hisilicon.com>
Thu, 14 Jul 2022 18:23:20 +0000 (02:23 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 19 Jul 2022 03:04:12 +0000 (23:04 -0400)
Currently SMP tasks are DMA unmapped only when cq of SMP I/O is returned
normally. If the cq of SMP I/O is returned with exception actually SMP TAS
is never unmapped. Relocate DMA unmap of SMP task to fix the issue.

Link: https://lore.kernel.org/r/1657823002-139010-4-git-send-email-john.garry@huawei.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index bd62e441f94755b6933ab531fb660f21507c9cde..33af5b8dede206725e278263ef0913d80541c6e7 100644 (file)
@@ -219,11 +219,15 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
                task->lldd_task = NULL;
 
                if (!sas_protocol_ata(task->task_proto)) {
-                       if (slot->n_elem)
+                       if (slot->n_elem) {
                                if (task->task_proto & SAS_PROTOCOL_SSP)
                                        dma_unmap_sg(dev, task->scatter,
                                                     task->num_scatter,
                                                     task->data_dir);
+                               else
+                                       dma_unmap_sg(dev, &task->smp_task.smp_req,
+                                                    1, DMA_TO_DEVICE);
+                       }
                        if (slot->n_elem_dif) {
                                struct sas_ssp_task *ssp_task = &task->ssp_task;
                                struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;
index 4582791def328ff6524d93c644e5f4262b535175..349546bacb2b0c7d46ad7098c5cff5aebcde35c0 100644 (file)
@@ -1282,8 +1282,6 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,
 
                ts->stat = SAS_SAM_STAT_GOOD;
 
-               dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
-                            DMA_TO_DEVICE);
                memcpy(to + sg_resp->offset,
                       hisi_sas_status_buf_addr_mem(slot) +
                       sizeof(struct hisi_sas_err_record),
index 18297ab5a32b884f0fbe448a4b263b1c31aa8df8..70e401fd432a04d46b73ed84ae8c29451044a1f1 100644 (file)
@@ -2428,8 +2428,6 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
 
                ts->stat = SAS_SAM_STAT_GOOD;
 
-               dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
-                            DMA_TO_DEVICE);
                memcpy(to + sg_resp->offset,
                       hisi_sas_status_buf_addr_mem(slot) +
                       sizeof(struct hisi_sas_err_record),
index 76c4173e277d3d3bf2373d05b58a58071e8bf55f..4d3eb53a8209478bd133e88b5e42125b9eba2708 100644 (file)
@@ -2311,8 +2311,6 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
 
                ts->stat = SAS_SAM_STAT_GOOD;
 
-               dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
-                            DMA_TO_DEVICE);
                memcpy(to + sg_resp->offset,
                        hisi_sas_status_buf_addr_mem(slot) +
                       sizeof(struct hisi_sas_err_record),