mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver
@ 2023-08-03  2:32 Tao Liu
  2023-08-03  8:45 ` Tao Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Liu @ 2023-08-03  2:32 UTC (permalink / raw)
  To: gregory.greenman, kvalo, johannes.berg, mukesh.sisodiya
  Cc: linux-wireless, linux-kernel, Tao Liu

Previously no .shutdown() hook is implemented for iwlwifi driver, a
ETIMEDOUT error will occur during the kexec kernel bootup. As a
consequence, wifi is unusable after kexec into the new kernel.

This issue is observed and patch tested on the following wireless cards:

1) Network controller: Intel Corporation Comet Lake PCH-LP CNVi WiFi,
   Subsystem: Intel Corporation Wi-Fi 6 AX201 160MHz
2) Network controller: Intel Corporation Wireless-AC 9260,
   Subsystem: Intel Corporation Device e014

Signed-off-by: Tao Liu <ltao@redhat.com>
---

Hi folks,

This is a RFC patch and I'm not sure about the correctness of the code,
especially about the pci_clear_master() part. What I want is to stop any
ongoing DMA access, in case if the memory overwritting during kexec
kernel bootup. But there is already pci_clear_master(pci_dev) in
drivers/pci/pci-driver.c:pci_device_shutdown(), so I'm not sure if it is
still needed in the driver side. And I only tested the patch against the
above 2 wireless cards and worked OK, not sure if it can work for others.
Please review the patch, thanks in advance!

Thanks,
Tao Liu

---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 73c1fb3c0c5e..24c4c2dd7cb0 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1513,6 +1513,18 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 	iwl_trans_pcie_free(trans);
 }
 
+static void iwl_pci_shutdown(struct pci_dev *pdev)
+{
+	struct iwl_trans *trans = pci_get_drvdata(pdev);
+
+	if (!trans)
+		return;
+
+	iwl_drv_stop(trans->drv);
+
+	pci_clear_master(pdev);
+}
+
 #ifdef CONFIG_PM_SLEEP
 
 static int iwl_pci_suspend(struct device *device)
@@ -1583,6 +1595,7 @@ static struct pci_driver iwl_pci_driver = {
 	.id_table = iwl_hw_card_ids,
 	.probe = iwl_pci_probe,
 	.remove = iwl_pci_remove,
+	.shutdown = iwl_pci_shutdown,
 	.driver.pm = IWL_PM_OPS,
 };
 
-- 
2.40.1


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

end of thread, other threads:[~2023-08-03  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03  2:32 [RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver Tao Liu
2023-08-03  8:45 ` Tao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®