public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: do not wait for port reset timeout after link down
@ 2026-04-16 15:54 Sagar Biradar
  0 siblings, 0 replies; only message in thread
From: Sagar Biradar @ 2026-04-16 15:54 UTC (permalink / raw)
  To: Martin K . Petersen, James Bottomley, Jack Wang
  Cc: linux-scsi, stable, Brian King, Don Brace, Raja VS,
	Kumar Meiyappan, Abhinav Kuchibhotla, Uday kumar Bagam,
	Advait Churi, Sagar Biradar

From: Kumar Meiyappan <kumar.meiyappan@microchip.com>

During SATA hot removal with I/O in flight, commands may time out
and enter the abort path. As part of abort handling, the driver
issues a local PHY reset and then waits for the PORT_RESET_TMO
event from firmware.

However, once the link is already down, firmware does not generate
that event. The abort path then waits for a completion that will
never arrive, which can lead to a call trace or stalled recovery
during device removal.

Avoid waiting for port reset completion when the PHY link is
already down.

Signed-off-by: Kumar Meiyappan <kumar.meiyappan@microchip.com>
Signed-off-by: Sagar Biradar <sagar.biradar@microchip.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 36 +++++++++++++++++---------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 645524f3fe2d..5d45c489d7f6 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -1148,24 +1148,26 @@ int pm8001_abort_task(struct sas_task *task)
 				phy->reset_completion = NULL;
 			} else {
 				/* 3. Wait for Port Reset complete or
-				 * Port reset TMO
+				 * Port reset TMO, if Phy Link is still up
 				 */
-				pm8001_dbg(pm8001_ha, MSG,
-					   "Waiting for Port reset\n");
-				ret = wait_for_completion_timeout(
-					&completion_reset,
-					PM8001_TASK_TIMEOUT * HZ);
-				if (!ret)
-					phy->reset_completion = NULL;
-				WARN_ON(phy->port_reset_status ==
-						PORT_RESET_TMO);
-				if (phy->port_reset_status == PORT_RESET_TMO) {
-					pm8001_dev_gone_notify(dev);
-					PM8001_CHIP_DISP->hw_event_ack_req(
-						pm8001_ha, 0,
-						0x07, /*HW_EVENT_PHY_DOWN ack*/
-						port_id, phy_id, 0, 0);
-					goto out;
+				if (phy->phy_state != PHY_LINK_DISABLE) {
+					pm8001_dbg(pm8001_ha, MSG,
+						   "Waiting for Port reset\n");
+					ret = wait_for_completion_timeout(
+						&completion_reset,
+						PM8001_TASK_TIMEOUT * HZ);
+					if (!ret)
+						phy->reset_completion = NULL;
+					WARN_ON(phy->port_reset_status ==
+							PORT_RESET_TMO);
+					if (phy->port_reset_status == PORT_RESET_TMO) {
+						pm8001_dev_gone_notify(dev);
+						PM8001_CHIP_DISP->hw_event_ack_req(
+							pm8001_ha, 0,
+							0x07, /*HW_EVENT_PHY_DOWN ack*/
+							port_id, phy_id, 0, 0);
+						goto out;
+					}
 				}
 			}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-16 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 15:54 [PATCH] scsi: pm8001: do not wait for port reset timeout after link down Sagar Biradar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox