Skip to content

Commit

Permalink
scsi: hisi_sas: Pass abort structure for internal abort
Browse files Browse the repository at this point in the history
[ Upstream commit 08c61b5 ]

To help factor out code in future, it's useful to know if we're executing
an internal abort, so pass a pointer to the structure. The idea is that a
NULL pointer means not an internal abort.

Link: https://lore.kernel.org/r/1639579061-179473-4-git-send-email-john.garry@huawei.com
Reviewed-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>
Stable-dep-of: 8aa580c ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
John Garry authored and Greg Kroah-Hartman committed May 2, 2025
1 parent 9ebfa3e commit 6587850
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions drivers/scsi/hisi_sas/hisi_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ struct hisi_sas_rst {
bool done;
};

struct hisi_sas_internal_abort {
unsigned int flag;
unsigned int tag;
};

#define HISI_SAS_RST_WORK_INIT(r, c) \
{ .hisi_hba = hisi_hba, \
.completion = &c, \
Expand Down
21 changes: 12 additions & 9 deletions drivers/scsi/hisi_sas/hisi_sas_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ static void hisi_sas_task_prep_ata(struct hisi_hba *hisi_hba,
}

static void hisi_sas_task_prep_abort(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot,
int device_id, int abort_flag, int tag_to_abort)
struct hisi_sas_internal_abort *abort,
struct hisi_sas_slot *slot, int device_id)
{
hisi_hba->hw->prep_abort(hisi_hba, slot,
device_id, abort_flag, tag_to_abort);
device_id, abort->flag, abort->tag);
}

static void hisi_sas_dma_unmap(struct hisi_hba *hisi_hba,
Expand Down Expand Up @@ -1968,8 +1968,9 @@ static int hisi_sas_query_task(struct sas_task *task)

static int
hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
struct sas_task *task, int abort_flag,
int task_tag, struct hisi_sas_dq *dq)
struct hisi_sas_internal_abort *abort,
struct sas_task *task,
struct hisi_sas_dq *dq)
{
struct domain_device *device = task->dev;
struct hisi_sas_device *sas_dev = device->lldd_dev;
Expand Down Expand Up @@ -2026,8 +2027,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
memset(hisi_sas_status_buf_addr_mem(slot), 0,
sizeof(struct hisi_sas_err_record));

hisi_sas_task_prep_abort(hisi_hba, slot, device_id,
abort_flag, task_tag);
hisi_sas_task_prep_abort(hisi_hba, abort, slot, device_id);

spin_lock_irqsave(&task->task_state_lock, flags);
task->task_state_flags |= SAS_TASK_AT_INITIATOR;
Expand Down Expand Up @@ -2065,9 +2065,12 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
{
struct sas_task *task;
struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_sas_internal_abort abort = {
.flag = abort_flag,
.tag = tag,
};
struct device *dev = hisi_hba->dev;
int res;

/*
* The interface is not realized means this HW don't support internal
* abort, or don't need to do internal abort. Then here, we return
Expand All @@ -2092,7 +2095,7 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
add_timer(&task->slow_task->timer);

res = hisi_sas_internal_abort_task_exec(hisi_hba, sas_dev->device_id,
task, abort_flag, tag, dq);
&abort, task, dq);
if (res) {
del_timer(&task->slow_task->timer);
dev_err(dev, "internal task abort: executing internal task failed: %d\n",
Expand Down

0 comments on commit 6587850

Please sign in to comment.