Search Linux Wireless

[RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux