All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi: pm80xx: Add fatal error checks
@ 2023-05-26 23:51 Pranav Prasad
  2023-06-01  0:05 ` Martin K. Petersen
  2023-06-08  1:42 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Pranav Prasad @ 2023-05-26 23:51 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Changyuan Lyu, Pranav Prasad

From: Changyuan Lyu <changyuanl@google.com>

This patch adds a fatal error check for the pm8001_phy_control()
and pm8001_lu_reset() functions.

Changes compared to v1:
- Changed the patch series to a single patch.
- Added empty "/*" line to the comments as requested
  by Damien Le Moal.
- Aligned function arguments in pm8001_dbg() as
  requested by Damien Le Moal.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Signed-off-by: Pranav Prasad <pranavpp@google.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index e5673c774f66..a5a31dfa4512 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -167,6 +167,17 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 	pm8001_ha = sas_phy->ha->lldd_ha;
 	phy = &pm8001_ha->phy[phy_id];
 	pm8001_ha->phy[phy_id].enable_completion = &completion;
+
+	if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
+		/*
+		 * If the controller is in fatal error state,
+		 * we will not get a response from the controller
+		 */
+		pm8001_dbg(pm8001_ha, FAIL,
+			   "Phy control failed due to fatal errors\n");
+		return -EFAULT;
+	}
+
 	switch (func) {
 	case PHY_FUNC_SET_LINK_RATE:
 		rates = funcdata;
@@ -908,6 +919,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
 	struct pm8001_device *pm8001_dev = dev->lldd_dev;
 	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
 	DECLARE_COMPLETION_ONSTACK(completion_setstate);
+
+	if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
+		/*
+		 * If the controller is in fatal error state,
+		 * we will not get a response from the controller
+		 */
+		pm8001_dbg(pm8001_ha, FAIL,
+			   "LUN reset failed due to fatal errors\n");
+		return rc;
+	}
+
 	if (dev_is_sata(dev)) {
 		struct sas_phy *phy = sas_get_local_phy(dev);
 		sas_execute_internal_abort_dev(dev, 0, NULL);
-- 
2.40.1.698.g37aff9b760-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: pm80xx: Add fatal error checks
  2023-05-26 23:51 [PATCH v2] scsi: pm80xx: Add fatal error checks Pranav Prasad
@ 2023-06-01  0:05 ` Martin K. Petersen
  2023-06-08  1:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-06-01  0:05 UTC (permalink / raw)
  To: Pranav Prasad
  Cc: Jack Wang, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, linux-kernel, Changyuan Lyu


Pranav,

> This patch adds a fatal error check for the pm8001_phy_control() and
> pm8001_lu_reset() functions.

Applied to 6.5/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: pm80xx: Add fatal error checks
  2023-05-26 23:51 [PATCH v2] scsi: pm80xx: Add fatal error checks Pranav Prasad
  2023-06-01  0:05 ` Martin K. Petersen
@ 2023-06-08  1:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-06-08  1:42 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Pranav Prasad
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, Changyuan Lyu

On Fri, 26 May 2023 23:51:55 +0000, Pranav Prasad wrote:

> This patch adds a fatal error check for the pm8001_phy_control()
> and pm8001_lu_reset() functions.
> 
> Changes compared to v1:
> - Changed the patch series to a single patch.
> - Added empty "/*" line to the comments as requested
>   by Damien Le Moal.
> - Aligned function arguments in pm8001_dbg() as
>   requested by Damien Le Moal.
> 
> [...]

Applied to 6.5/scsi-queue, thanks!

[1/1] scsi: pm80xx: Add fatal error checks
      https://git.kernel.org/mkp/scsi/c/4851c39aae3a

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-08  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 23:51 [PATCH v2] scsi: pm80xx: Add fatal error checks Pranav Prasad
2023-06-01  0:05 ` Martin K. Petersen
2023-06-08  1:42 ` Martin K. Petersen

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.