Skip to content

Commit c763ec4

Browse files
John Garrymartinkpetersen
authored andcommitted
scsi: hisi_sas: Fix setting of hisi_sas_slot.is_internal
The hisi_sas_slot.is_internal member is not set properly for ATA commands which the driver sends directly. A TMF struct pointer is normally used as a test to set this, but it is NULL for those commands. It's not ideal, but pass an empty TMF struct to set that member properly. Link: https://lore.kernel.org/r/1643627607-138785-1-git-send-email-john.garry@huawei.com Fixes: dc313f6 ("scsi: hisi_sas: Factor out task prep and delivery code") Reported-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 df7abca commit c763ec4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,7 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,
400400
struct hisi_sas_slot *slot,
401401
struct hisi_sas_dq *dq,
402402
struct hisi_sas_device *sas_dev,
403-
struct hisi_sas_internal_abort *abort,
404-
struct hisi_sas_tmf_task *tmf)
403+
struct hisi_sas_internal_abort *abort)
405404
{
406405
struct hisi_sas_cmd_hdr *cmd_hdr_base;
407406
int dlvry_queue_slot, dlvry_queue;
@@ -427,8 +426,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,
427426
cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue];
428427
slot->cmd_hdr = &cmd_hdr_base[dlvry_queue_slot];
429428

430-
slot->tmf = tmf;
431-
slot->is_internal = tmf;
432429
task->lldd_task = slot;
433430

434431
memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
@@ -587,7 +584,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
587584
slot->is_internal = tmf;
588585

589586
/* protect task_prep and start_delivery sequence */
590-
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL, tmf);
587+
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL);
591588

592589
return 0;
593590

@@ -1380,12 +1377,13 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)
13801377
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
13811378
struct device *dev = hisi_hba->dev;
13821379
int s = sizeof(struct host_to_dev_fis);
1380+
struct hisi_sas_tmf_task tmf = {};
13831381

13841382
ata_for_each_link(link, ap, EDGE) {
13851383
int pmp = sata_srst_pmp(link);
13861384

13871385
hisi_sas_fill_ata_reset_cmd(link->device, 1, pmp, fis);
1388-
rc = hisi_sas_exec_internal_tmf_task(device, fis, s, NULL);
1386+
rc = hisi_sas_exec_internal_tmf_task(device, fis, s, &tmf);
13891387
if (rc != TMF_RESP_FUNC_COMPLETE)
13901388
break;
13911389
}
@@ -1396,7 +1394,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)
13961394

13971395
hisi_sas_fill_ata_reset_cmd(link->device, 0, pmp, fis);
13981396
rc = hisi_sas_exec_internal_tmf_task(device, fis,
1399-
s, NULL);
1397+
s, &tmf);
14001398
if (rc != TMF_RESP_FUNC_COMPLETE)
14011399
dev_err(dev, "ata disk %016llx de-reset failed\n",
14021400
SAS_ADDR(device->sas_addr));
@@ -2067,7 +2065,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
20672065
slot->port = port;
20682066
slot->is_internal = true;
20692067

2070-
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort, NULL);
2068+
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort);
20712069

20722070
return 0;
20732071

0 commit comments

Comments
 (0)