Skip to content

Commit f090209

Browse files
Xiang Chenmartinkpetersen
authored andcommitted
scsi: hisi_sas: Relocate DMA unmap of SMP task
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>
1 parent bc22f9c commit f090209

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,15 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
219219
task->lldd_task = NULL;
220220

221221
if (!sas_protocol_ata(task->task_proto)) {
222-
if (slot->n_elem)
222+
if (slot->n_elem) {
223223
if (task->task_proto & SAS_PROTOCOL_SSP)
224224
dma_unmap_sg(dev, task->scatter,
225225
task->num_scatter,
226226
task->data_dir);
227+
else
228+
dma_unmap_sg(dev, &task->smp_task.smp_req,
229+
1, DMA_TO_DEVICE);
230+
}
227231
if (slot->n_elem_dif) {
228232
struct sas_ssp_task *ssp_task = &task->ssp_task;
229233
struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;

drivers/scsi/hisi_sas/hisi_sas_v1_hw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,6 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,
12821282

12831283
ts->stat = SAS_SAM_STAT_GOOD;
12841284

1285-
dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
1286-
DMA_TO_DEVICE);
12871285
memcpy(to + sg_resp->offset,
12881286
hisi_sas_status_buf_addr_mem(slot) +
12891287
sizeof(struct hisi_sas_err_record),

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,8 +2428,6 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
24282428

24292429
ts->stat = SAS_SAM_STAT_GOOD;
24302430

2431-
dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
2432-
DMA_TO_DEVICE);
24332431
memcpy(to + sg_resp->offset,
24342432
hisi_sas_status_buf_addr_mem(slot) +
24352433
sizeof(struct hisi_sas_err_record),

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,8 +2311,6 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
23112311

23122312
ts->stat = SAS_SAM_STAT_GOOD;
23132313

2314-
dma_unmap_sg(dev, &task->smp_task.smp_req, 1,
2315-
DMA_TO_DEVICE);
23162314
memcpy(to + sg_resp->offset,
23172315
hisi_sas_status_buf_addr_mem(slot) +
23182316
sizeof(struct hisi_sas_err_record),

0 commit comments

Comments
 (0)