Skip to contentSkip to conversation

igc: Fix possible system crash when loading module

PATCH In review Vinicius Costa Gomes 3 participants 3 messages Apr 17, 2023 – May 8, 2023

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

PATCH 1/1 igc: Fix possible system crash when loading module

Guarantee that when probe() is run again, PTM and PCI busmaster will be in the same state as it was if the driver was never loaded.

Avoid an i225/i226 hardware issue that PTM requests can be made even though PCI bus mastering is not enabled. These unexpected PTM requests can crash some systems.

So, "force" disable PTM and busmastering before removing the driver, so they can be renabled in the right order during probe(). This is more like a workaround and should be applicable for i225 and i226, in any platform.

Fixes 1b5d73fb8624 ("igc: Enable PCIe PTM")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +3 -0
index 25fc6c65209b..2544bb06246c 100644
@@ -6712,6 +6712,9 @@ static void igc_remove(struct pci_dev *pdev)
 
 	igc_ptp_stop(adapter);
 
+	pci_disable_ptm(pdev);
+	pci_clear_master(pdev);
+
 	set_bit(__IGC_DOWN, &adapter->state);
 
 	del_timer_sync(&adapter->watchdog_timer);
Signature · 6 lines
2.39.2

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Vinicius Costa Gomes
Sent: Tuesday, 18 April, 2023 6:19 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-queue v1] igc: Fix possible system crash when loading module

Guarantee that when probe() is run again, PTM and PCI busmaster will be in the same state as it was if the driver was never loaded.

Avoid an i225/i226 hardware issue that PTM requests can be made even though PCI bus mastering is not enabled. These unexpected PTM requests can crash some systems.

Quoted 6 lines

So, "force" disable PTM and busmastering before removing the driver, so they can be renabled in the right order during probe(). This is more like a workaround and should be applicable for i225 and i226, in any platform.

Fixes 1b5d73fb8624 ("igc: Enable PCIe PTM")
Quoted 22 lines
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +3 -1
index 25fc6c65209b..2544bb06246c 100644
@@ -6712,6 +6712,9 @@ static void igc_remove(struct pci_dev *pdev)
 
 	igc_ptp_stop(adapter);
 
+	pci_disable_ptm(pdev);
+	pci_clear_master(pdev);
+
 	set_bit(__IGC_DOWN, &adapter->state);
 
 	del_timer_sync(&adapter->watchdog_timer);
--

2.39.2

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Tested-by on v1 1/1
#2 lore raw
In reply to Vinicius Costa Gomes
Quoted 12 lines · Vinicius Costa Gomes

Guarantee that when probe() is run again, PTM and PCI busmaster will be in the same state as it was if the driver was never loaded.

Avoid an i225/i226 hardware issue that PTM requests can be made even though PCI bus mastering is not enabled. These unexpected PTM requests can crash some systems.

So, "force" disable PTM and busmastering before removing the driver, so they can be renabled in the right order during probe(). This is more like a workaround and should be applicable for i225 and i226, in any platform.

Quoted 5 lines
Fixes 1b5d73fb8624 ("igc: Enable PCIe PTM")
---
  drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
  1 file changed, 3 insertions(+)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan