Skip to contentSkip to conversation

e1000e: Fix possible HW unit hang after an s0ix exit

PATCH New Sasha Neftin 3 participants 3 messages Jan 25, 2022 – Jan 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e1000e: Fix possible HW unit hang after an s0ix exit

Disable the OEM bit/Gig Disable/restart AN impact and disable the PHY (LCD) reset during power management flows.
Fix possible HW unit hangs on the s0ix exit on some corporate ADL platforms.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214821

Fixes 3e55d231716e ("e1000e: Add handshake with the CSME to support S0ix)
---
 drivers/net/ethernet/intel/e1000e/hw.h      |  1 +
 drivers/net/ethernet/intel/e1000e/ich8lan.c |  4 ++++
 drivers/net/ethernet/intel/e1000e/ich8lan.h |  1 +
 drivers/net/ethernet/intel/e1000e/netdev.c  | 26 +++++++++++++++++++++
 4 files changed, 32 insertions(+)
drivers/net/ethernet/intel/e1000e/hw.h +1 -0
index bcf680e83811..13382df2f2ef 100644
@@ -630,6 +630,7 @@ struct e1000_phy_info {
 	bool disable_polarity_correction;
 	bool is_mdix;
 	bool polarity_correction;
+	bool reset_disable;
 	bool speed_downgraded;
 	bool autoneg_wait_to_complete;
 };
drivers/net/ethernet/intel/e1000e/ich8lan.c +4 -0
index c908c84b86d2..e298da712758 100644
@@ -2050,6 +2050,10 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
 	bool blocked = false;
 	int i = 0;
 
+	/* Check the PHY (LCD) reset flag */
+	if (hw->phy.reset_disable)
+		return true;
+
 	while ((blocked = !(er32(FWSM) & E1000_ICH_FWSM_RSPCIPHY)) &&
 	       (i++ < 30))
 		usleep_range(10000, 11000);
drivers/net/ethernet/intel/e1000e/ich8lan.h +1 -0
index 2504b11c3169..638a3ddd7ada 100644
@@ -271,6 +271,7 @@
 #define I217_CGFREG_ENABLE_MTA_RESET	0x0002
 #define I217_MEMPWR			PHY_REG(772, 26)
 #define I217_MEMPWR_DISABLE_SMB_RELEASE	0x0010
+#define I217_MEMPWR_MOEM		0x1000
 
 /* Receive Address Initial CRC Calculation */
 #define E1000_PCH_RAICC(_n)	(0x05F50 + ((_n) * 4))
drivers/net/ethernet/intel/e1000e/netdev.c +26 -0
index 6fb3437f68e0..fa06f68c8c80 100644
@@ -6987,8 +6987,21 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)
 	struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct e1000_hw *hw = &adapter->hw;
+	u16 phy_data;
 	int rc;
 
+	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+	    hw->mac.type >= e1000_pch_adp) {
+		/* Mask OEM Bits / Gig Disable / Restart AN (772_26[12] = 1) */
+		e1e_rphy(hw, I217_MEMPWR, &phy_data);
+		phy_data |= I217_MEMPWR_MOEM;
+		e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+		/* Disable LCD reset */
+		hw->phy.reset_disable = true;
+	}
+
 	e1000e_flush_lpic(pdev);
 
 	e1000e_pm_freeze(dev);
@@ -7010,6 +7023,8 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)
 	struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct e1000_hw *hw = &adapter->hw;
+	u16 phy_data;
 	int rc;
 
 	/* Introduce S0ix implementation */
@@ -7020,6 +7035,17 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)
 	if (rc)
 		return rc;
 
+	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+	    hw->mac.type >= e1000_pch_adp) {
+		/* Unmask OEM Bits / Gig Disable / Restart AN 772_26[12] = 0 */
+		e1e_rphy(hw, I217_MEMPWR, &phy_data);
+		phy_data &= ~I217_MEMPWR_MOEM;
+		e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+		/* Enable LCD reset */
+		hw->phy.reset_disable = false;
+	}
+
 	return e1000e_pm_thaw(dev);
 }
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 e1000e: Fix possible HW unit hang after an s0ix exit

Dear Sasha,

Thank you for the patch.

Am 25.01.22 um 18:31 schrieb Sasha Neftin:

Quoted 2 lines

Disable the OEM bit/Gig Disable/restart AN impact and disable the PHY (LCD) reset during power management flows.

What does LCD mean?

Quoted 2 lines

Fix possible HW unit hangs on the s0ix exit on some corporate ADL platforms.

As this issue caused a lot of grieve and will affect thousands of devices, please elaborate much more. Please start with the problem description, and then explain, why the fix (first sentence) is supposed to work and even specify in what datasheet this behavior is defined.

Lastly, please list, how this patch was tested (device, ME firmware version, how many cycles).

Quoted 18 lines

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214821

Fixes 3e55d231716e ("e1000e: Add handshake with the CSME to support S0ix)
---
  drivers/net/ethernet/intel/e1000e/hw.h      |  1 +
  drivers/net/ethernet/intel/e1000e/ich8lan.c |  4 ++++
  drivers/net/ethernet/intel/e1000e/ich8lan.h |  1 +
  drivers/net/ethernet/intel/e1000e/netdev.c  | 26 +++++++++++++++++++++
  4 files changed, 32 insertions(+)
drivers/net/ethernet/intel/e1000e/hw.h +0 -0
index bcf680e83811..13382df2f2ef 100644

drivers/net/ethernet/intel/e1000e/hw.h struct e1000_phy_info { · line 633

Quoted 4 lines
drivers/net/ethernet/intel/e1000e/hw.h +1 -0
@@ -630,6 +630,7 @@ struct e1000_phy_info {
  	bool disable_polarity_correction;
  	bool is_mdix;
  	bool polarity_correction;
+	bool reset_disable;

Above disable_polarity_correction is used as a name. Maybe use disable_reset then. As you add comments with LCD around the variable usage, maybe even disable_lcd_reset.

Quoted 8 lines
drivers/net/ethernet/intel/e1000e/hw.h +0 -0
  	bool speed_downgraded;
  	bool autoneg_wait_to_complete;
  };
drivers/net/ethernet/intel/e1000e/ich8lan.c +0 -0
index c908c84b86d2..e298da712758 100644

drivers/net/ethernet/intel/e1000e/ich8lan.c static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) · line 2056

Quoted 7 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +4 -0
@@ -2050,6 +2050,10 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
  	bool blocked = false;
  	int i = 0;
 
+	/* Check the PHY (LCD) reset flag */
+	if (hw->phy.reset_disable)
+		return true;
+

When/how is e1000_check_reset_block_ich8lan() called in relation to e1000e_pm_suspend() and e1000e_pm_resume()?

drivers/net/ethernet/intel/e1000e/ich8lan.h line 274

Quoted 12 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +0 -0
  	while ((blocked = !(er32(FWSM) & E1000_ICH_FWSM_RSPCIPHY)) &&
  	       (i++ < 30))
  		usleep_range(10000, 11000);
drivers/net/ethernet/intel/e1000e/ich8lan.h +1 -0
index 2504b11c3169..638a3ddd7ada 100644
@@ -271,6 +271,7 @@
  #define I217_CGFREG_ENABLE_MTA_RESET	0x0002
  #define I217_MEMPWR			PHY_REG(772, 26)
  #define I217_MEMPWR_DISABLE_SMB_RELEASE	0x0010
+#define I217_MEMPWR_MOEM		0x1000

Be clear and use MEMPWR_MASK_OEM?

Quoted 7 lines
drivers/net/ethernet/intel/e1000e/ich8lan.h +0 -0
  /* Receive Address Initial CRC Calculation */
  #define E1000_PCH_RAICC(_n)	(0x05F50 + ((_n) * 4))
drivers/net/ethernet/intel/e1000e/netdev.c +0 -0
index 6fb3437f68e0..fa06f68c8c80 100644

drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6996

Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5 -0
@@ -6987,8 +6987,21 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)
  	struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
  	struct e1000_adapter *adapter = netdev_priv(netdev);
  	struct pci_dev *pdev = to_pci_dev(dev);
+	struct e1000_hw *hw = &adapter->hw;
+	u16 phy_data;
  	int rc;
 
+	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+	    hw->mac.type >= e1000_pch_adp) {
+		/* Mask OEM Bits / Gig Disable / Restart AN (772_26[12] = 1) */

What is AN?

Quoted 28 lines
drivers/net/ethernet/intel/e1000e/netdev.c +14 -0
+		e1e_rphy(hw, I217_MEMPWR, &phy_data);
+		phy_data |= I217_MEMPWR_MOEM;
+		e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+		/* Disable LCD reset */
+		hw->phy.reset_disable = true;
+	}
+
  	e1000e_flush_lpic(pdev);
 
  	e1000e_pm_freeze(dev);
@@ -7010,6 +7023,8 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)
  	struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
  	struct e1000_adapter *adapter = netdev_priv(netdev);
  	struct pci_dev *pdev = to_pci_dev(dev);
+	struct e1000_hw *hw = &adapter->hw;
+	u16 phy_data;
  	int rc;
 
  	/* Introduce S0ix implementation */
@@ -7020,6 +7035,17 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)
  	if (rc)
  		return rc;
 
+	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+	    hw->mac.type >= e1000_pch_adp) {
+		/* Unmask OEM Bits / Gig Disable / Restart AN 772_26[12] = 0 */
+		e1e_rphy(hw, I217_MEMPWR, &phy_data);

drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_resume(struct device *dev) · line 7051

Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +7 -0
+		phy_data &= ~I217_MEMPWR_MOEM;
+		e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+		/* Enable LCD reset */
+		hw->phy.reset_disable = false;
+	}
+
  	return e1000e_pm_thaw(dev);
  }
 

Kind regards,

Paul

#2 lore raw

PATCH 1/1 e1000e: Fix possible HW unit hang after an s0ix exit

Quoted 10 lines · Paul Menzel

Dear Sasha,

Thank you for the patch.

Am 25.01.22 um 18:31 schrieb Sasha Neftin:

Quoted 2 lines

Disable the OEM bit/Gig Disable/restart AN impact and disable the PHY (LCD) reset during power management flows.

What does LCD mean?

LCD - LAN connected device. External Low Power 1 Gigabit Ethernet PHY. (I thought you already asked me about it if I recall correctly)

Quoted 9 lines
Quoted 3 lines

Fix possible HW unit hangs on the s0ix exit on some corporate ADL platforms.

As this issue caused a lot of grieve and will affect thousands of devices, please elaborate much more. Please start with the problem description, and then explain, why the fix (first sentence) is supposed to work and even specify in what datasheet this behavior is defined.

The problem described on Bugzilla: "HW unit hang on some ADL corporate platforms". It could happen upon s0ix flow exit.

Quoted 2 lines

Lastly, please list, how? this patch was tested (device, ME firmware version, how many cycles).

1.ADL
2.Not sure how to expose the CSME version. I don't think I am the right person to answer this question. This is not the same version as MEI cat /sys/class/mei/mei0/fw_ver
I will check how we can communicate this.
3.thousands cycles (on my platform)

Quoted 15 lines
Quoted 15 lines

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214821

Fixes 3e55d231716e ("e1000e: Add handshake with the CSME to support

S0ix)

---

? drivers/net/ethernet/intel/e1000e/hw.h????? |? 1 +
? drivers/net/ethernet/intel/e1000e/ich8lan.c |? 4 ++++
? drivers/net/ethernet/intel/e1000e/ich8lan.h |? 1 +
? drivers/net/ethernet/intel/e1000e/netdev.c? | 26 +++++++++++++++++++++

? 4 files changed, 32 insertions(+)

Quoted 14 lines

drivers/net/ethernet/intel/e1000e/hw.h struct e1000_phy_info { · line 633

Quoted 10 lines
drivers/net/ethernet/intel/e1000e/hw.h +1 -0
index bcf680e83811..13382df2f2ef 100644
@@ -630,6 +630,7 @@ struct e1000_phy_info {
 ????? bool disable_polarity_correction;
 ????? bool is_mdix;
 ????? bool polarity_correction;
+??? bool reset_disable;

Above disable_polarity_correction is used as a name. Maybe use disable_reset then. As you add comments with LCD around the variable usage, maybe even disable_lcd_reset.

simple 'grep -Irn "disable_reset" drivers/net/ethernet/*/ will show you that it is a convention. I prefer keep it as it.

Quoted 12 lines
Quoted 12 lines
drivers/net/ethernet/intel/e1000e/hw.h +0 -0
 ????? bool speed_downgraded;
 ????? bool autoneg_wait_to_complete;
 ? };
drivers/net/ethernet/intel/e1000e/ich8lan.c +0 -0
index c908c84b86d2..e298da712758 100644
@@ -2050,6 +2050,10 @@ static s32 
 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
 ????? bool blocked = false;
Quoted 8 lines

drivers/net/ethernet/intel/e1000e/ich8lan.c static s32 · line 2056

Quoted 5 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +4 -0
 ????? int i = 0;
+??? /* Check the PHY (LCD) reset flag */
+??? if (hw->phy.reset_disable)
+??????? return true;
+

When/how is e1000_check_reset_block_ich8lan() called in relation to e1000e_pm_suspend() and e1000e_pm_resume()?

This is legacy code and called as part of PHY workarounds.

Quoted 16 lines
Quoted 10 lines

????? while ((blocked = !(er32(FWSM) & E1000_ICH_FWSM_RSPCIPHY)) && ???????????? (i++ < 30))
????????? usleep_range(10000, 11000);

drivers/net/ethernet/intel/e1000e/ich8lan.h +0 -0
index 2504b11c3169..638a3ddd7ada 100644
@@ -271,6 +271,7 @@
Quoted 4 lines

? #define I217_CGFREG_ENABLE_MTA_RESET??? 0x0002 ? #define I217_MEMPWR??????????? PHY_REG(772, 26) ? #define I217_MEMPWR_DISABLE_SMB_RELEASE??? 0x0010 +#define I217_MEMPWR_MOEM??????? 0x1000

Be clear and use MEMPWR_MASK_OEM?

I prefer to keep the current definition. It is clear.

Quoted 13 lines
Quoted 13 lines

? /* Receive Address Initial CRC Calculation */ ? #define E1000_PCH_RAICC(_n)??? (0x05F50 + ((_n) * 4))

drivers/net/ethernet/intel/e1000e/netdev.c +0 -0
index 6fb3437f68e0..fa06f68c8c80 100644
@@ -6987,8 +6987,21 @@ static __maybe_unused int 
 e1000e_pm_suspend(struct device *dev)
 ????? struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
 ????? struct e1000_adapter *adapter = netdev_priv(netdev);
 ????? struct pci_dev *pdev = to_pci_dev(dev);
Quoted 8 lines

drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int · line 6996

Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5 -0
+??? struct e1000_hw *hw = &adapter->hw;
+??? u16 phy_data;
 ????? int rc;
+??? if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+??????? hw->mac.type >= e1000_pch_adp) {
+??????? /* Mask OEM Bits / Gig Disable / Restart AN (772_26[12] = 1) */

What is AN?

auto negotiation

Quoted 41 lines
Quoted 27 lines
drivers/net/ethernet/intel/e1000e/netdev.c +10 -0
+??????? e1e_rphy(hw, I217_MEMPWR, &phy_data);
+??????? phy_data |= I217_MEMPWR_MOEM;
+??????? e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+??????? /* Disable LCD reset */
+??????? hw->phy.reset_disable = true;
+??? }
+
 ????? e1000e_flush_lpic(pdev);
 ????? e1000e_pm_freeze(dev);
@@ -7010,6 +7023,8 @@ static __maybe_unused int 
 e1000e_pm_resume(struct device *dev)
 ????? struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
 ????? struct e1000_adapter *adapter = netdev_priv(netdev);
 ????? struct pci_dev *pdev = to_pci_dev(dev);
+??? struct e1000_hw *hw = &adapter->hw;
+??? u16 phy_data;
 ????? int rc;

????? /* Introduce S0ix implementation */

drivers/net/ethernet/intel/e1000e/netdev.c +3 -0
@@ -7020,6 +7035,17 @@ static __maybe_unused int 
 e1000e_pm_resume(struct device *dev)
 ????? if (rc)
 ????????? return rc;
+??? if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
+??????? hw->mac.type >= e1000_pch_adp) {
+??????? /* Unmask OEM Bits / Gig Disable / Restart AN 772_26[12] = 0 */

drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int · line 7050

Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +8 -0
+??????? e1e_rphy(hw, I217_MEMPWR, &phy_data);
+??????? phy_data &= ~I217_MEMPWR_MOEM;
+??????? e1e_wphy(hw, I217_MEMPWR, phy_data);
+
+??????? /* Enable LCD reset */
+??????? hw->phy.reset_disable = false;
+??? }
+
 ????? return e1000e_pm_thaw(dev);
 ? }

Kind regards,

Quoted 1 line

Paul

Sasha