Skip to contentSkip to conversation

scsi: pm80xx: Fatal error checks

PATCH Superseded Pranav Prasad 3 participants 7 messages May 23, 2023 – May 24, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover scsi: pm80xx: Fatal error checks

This patch series adds fatal error checks for pm8001 driver functions pm8001_phy_control() and pm8001_lu_reset().

1. Added a fatal error check in pm8001_phy_control().

2. Added a fatal error check in pm8001_lu_reset().

Changyuan Lyu (1):
scsi: pm80xx: Add fatal error check for pm8001_phy_control()

Igor Pylypiv (1):
scsi: pm80xx: Add fatal error check for pm8001_lu_reset()

 drivers/scsi/pm8001/pm8001_sas.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Signature · 1 line
2.40.1.698.g37aff9b760-goog
#1 lore raw

PATCH 1/2 scsi: pm80xx: Add fatal error check for pm8001_phy_control()

From: Changyuan Lyu <[email protected]>

This patch adds a fatal error check for the pm8001_phy_control() function.

---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +10 -0
index e5673c774f66..b153f0966e5d 100644
@@ -167,6 +167,16 @@ 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;
Signature · 1 line
2.40.1.698.g37aff9b760-goog
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] scsi: pm80xx: Add fatal error check for pm8001_phy_control()

Quoted 7 lines · Pranav Prasad

From: Changyuan Lyu <[email protected]>

This patch adds a fatal error check for the pm8001_phy_control() function.

Quoted 28 lines
---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +10 -1
index e5673c774f66..b153f0966e5d 100644
@@ -167,6 +167,16 @@ 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;
--

2.40.1.698.g37aff9b760-goog

#3 lore raw

Re: [PATCH 1/2] scsi: pm80xx: Add fatal error check for pm8001_phy_control()

In reply to Pranav Prasad
Quoted 15 lines · Pranav Prasad

From: Changyuan Lyu <[email protected]>

This patch adds a fatal error check for the pm8001_phy_control() function.

---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +0 -0
index e5673c774f66..b153f0966e5d 100644

drivers/scsi/pm8001/pm8001_sas.c int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, · line 174

Quoted 8 lines
drivers/scsi/pm8001/pm8001_sas.c +5 -0
@@ -167,6 +167,16 @@ 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
+		 */

Multi-line comment style: must start with an empty "/*" line.

drivers/scsi/pm8001/pm8001_sas.c int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, · line 176

Quoted 2 lines
drivers/scsi/pm8001/pm8001_sas.c +2 -0
+		pm8001_dbg(pm8001_ha, FAIL,
+				"Phy control failed due to fatal errors\n");

Please align the args together.

Quoted 6 lines
drivers/scsi/pm8001/pm8001_sas.c +3 -0
+		return -EFAULT;
+	}
+
 	switch (func) {
 	case PHY_FUNC_SET_LINK_RATE:
 		rates = funcdata;
Signature · 2 lines
Damien Le Moal
Western Digital Research
#4 lore raw

PATCH 2/2 scsi: pm80xx: Add fatal error check for pm8001_lu_reset()

In reply to Pranav Prasad

From: Igor Pylypiv <[email protected]>

This patch adds a fatal error check for pm8001_lu_reset().

---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +10 -0
index b153f0966e5d..e302d5879bb7 100644
@@ -918,6 +918,16 @@ 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);
Signature · 1 line
2.40.1.698.g37aff9b760-goog
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] scsi: pm80xx: Add fatal error check for pm8001_lu_reset()

Quoted 7 lines · Pranav Prasad

From: Igor Pylypiv <[email protected]>

This patch adds a fatal error check for pm8001_lu_reset().

Quoted 28 lines
---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +10 -1
index b153f0966e5d..e302d5879bb7 100644
@@ -918,6 +918,16 @@ 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

#6 lore raw

Re: [PATCH 2/2] scsi: pm80xx: Add fatal error check for pm8001_lu_reset()

In reply to Pranav Prasad
Quoted 18 lines · Pranav Prasad

From: Igor Pylypiv <[email protected]>

This patch adds a fatal error check for pm8001_lu_reset().

---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/pm8001/pm8001_sas.c +0 -0
index b153f0966e5d..e302d5879bb7 100644
@@ -918,6 +918,16 @@ 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);

drivers/scsi/pm8001/pm8001_sas.c int pm8001_lu_reset(struct domain_device *dev, u8 *lun) · line 930

Quoted 10 lines
drivers/scsi/pm8001/pm8001_sas.c +10 -0
+
+	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;
+	}
+

Same comments as patch 1. And does this really need to be a separate patch ? both patches touch the same file, and add a similar change to 2 functions, so I would fold this in patch 1.

Quoted 3 lines
drivers/scsi/pm8001/pm8001_sas.c +0 -0
 	if (dev_is_sata(dev)) {
 		struct sas_phy *phy = sas_get_local_phy(dev);
 		sas_execute_internal_abort_dev(dev, 0, NULL);
Signature · 2 lines
Damien Le Moal
Western Digital Research