From: Niklas Cassel <cassel@kernel.org>
To: Jack Wang <jinpu.wang@cloud.ionos.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Viswas G <Viswas.G@microsemi.com>,
Deepak Ukey <deepak.ukey@microsemi.com>
Cc: Igor Pylypiv <ipylypiv@google.com>,
Terrence Adams <tadamsjr@google.com>,
Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
Jack Wang <jinpu.wang@profitbricks.com>,
linux-scsi@vger.kernel.org
Subject: [PATCH 4/5] scsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander
Date: Wed, 13 Aug 2025 13:41:11 +0200 [thread overview]
Message-ID: <20250813114107.916919-11-cassel@kernel.org> (raw)
In-Reply-To: <20250813114107.916919-7-cassel@kernel.org>
For a direct attached device, attached_phy contains the local phy id.
For a device behind an expander, attached_phy contains the remote phy id,
not the local phy id.
The pm8001_ha->phy array only contains the phys of the HBA.
It does not contain the phys of the expander.
Thus, you cannot use attached_phy to index the pm8001_ha->phy array,
without first verifying that the device is directly attached.
Use the pm80xx_get_local_phy_id() helper to make sure that we use the
local phy id to index the array, regardless if the device is directly
attached or not.
Fixes: 869ddbdcae3b ("scsi: pm80xx: corrected SATA abort handling sequence.")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/scsi/pm8001/pm8001_sas.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 56d0309d5984..b3bd61827ad6 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -1065,7 +1065,7 @@ int pm8001_abort_task(struct sas_task *task)
struct pm8001_hba_info *pm8001_ha;
struct pm8001_device *pm8001_dev;
int rc = TMF_RESP_FUNC_FAILED, ret;
- u32 phy_id, port_id;
+ u32 port_id;
struct sas_task_slow slow_task;
if (!task->lldd_task || !task->dev)
@@ -1074,7 +1074,6 @@ int pm8001_abort_task(struct sas_task *task)
dev = task->dev;
pm8001_dev = dev->lldd_dev;
pm8001_ha = pm8001_find_ha_by_dev(dev);
- phy_id = pm8001_dev->attached_phy;
if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
// If the controller is seeing fatal errors
@@ -1106,7 +1105,8 @@ int pm8001_abort_task(struct sas_task *task)
if (pm8001_ha->chip_id == chip_8006) {
DECLARE_COMPLETION_ONSTACK(completion_reset);
DECLARE_COMPLETION_ONSTACK(completion);
- struct pm8001_phy *phy = pm8001_ha->phy + phy_id;
+ u32 phy_id = pm80xx_get_local_phy_id(dev);
+ struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
port_id = phy->port->port_id;
/* 1. Set Device state as Recovery */
--
2.50.1
next prev parent reply other threads:[~2025-08-13 11:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 11:41 [PATCH 0/5] scsi: pm80xx: Fix expander support Niklas Cassel
2025-08-13 11:41 ` [PATCH 1/5] scsi: pm80xx: Restore support for expanders Niklas Cassel
2025-08-13 19:42 ` Igor Pylypiv
2025-08-13 11:41 ` [PATCH 2/5] scsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod Niklas Cassel
2025-08-13 19:43 ` Igor Pylypiv
2025-08-13 11:41 ` [PATCH 3/5] scsi: pm80xx: Add helper function to get the local phy id Niklas Cassel
2025-08-13 19:44 ` Igor Pylypiv
2025-08-14 2:03 ` Damien Le Moal
2025-08-13 11:41 ` Niklas Cassel [this message]
2025-08-13 19:47 ` [PATCH 4/5] scsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander Igor Pylypiv
2025-08-13 11:41 ` [PATCH 5/5] scsi: pm80xx: Use pm80xx_get_local_phy_id() to access phy array Niklas Cassel
2025-08-13 19:48 ` Igor Pylypiv
2025-08-14 2:12 ` Damien Le Moal
2025-08-14 8:26 ` [PATCH 0/5] scsi: pm80xx: Fix expander support Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250813114107.916919-11-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Viswas.G@microsemi.com \
--cc=deepak.ukey@microsemi.com \
--cc=dlemoal@kernel.org \
--cc=ipylypiv@google.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=jinpu.wang@profitbricks.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=tadamsjr@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.