diff mbox series

[net-queue,v1] igc: Fix possible system crash when loading module

Message ID 20230417221839.292728-1-vinicius.gomes@intel.com
State Accepted
Delegated to: Anthony Nguyen
Headers show
Series [net-queue,v1] igc: Fix possible system crash when loading module | expand

Commit Message

Vinicius Costa Gomes April 17, 2023, 10:18 p.m. UTC
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")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Zulkifli, Muhammad Husaini April 18, 2023, 12:05 a.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Vinicius Costa Gomes
> Sent: Tuesday, 18 April, 2023 6:19 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> 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.
> 
> 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")
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

Reviewed-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>

> ---
>  drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index 25fc6c65209b..2544bb06246c 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -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
> 
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
naamax.meir May 8, 2023, 4:36 a.m. UTC | #2
On 4/18/2023 01:18, Vinicius Costa Gomes wrote:
> 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")
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
>   1 file changed, 3 insertions(+)

Tested-by: Naama Meir <naamax.meir@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 25fc6c65209b..2544bb06246c 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -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);