From: Tao Liu <ltao@redhat.com>
To: gregory.greenman@intel.com, kvalo@kernel.org,
johannes.berg@intel.com, mukesh.sisodiya@intel.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Tao Liu <ltao@redhat.com>
Subject: [RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver
Date: Thu, 3 Aug 2023 10:32:58 +0800 [thread overview]
Message-ID: <20230803023257.9260-1-ltao@redhat.com> (raw)
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
next reply other threads:[~2023-08-03 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 2:32 Tao Liu [this message]
2023-08-03 8:45 ` [RFC][PATCH] iwlwifi: Add pci .shutdown() hook for iwlwifi driver Tao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230803023257.9260-1-ltao@redhat.com \
--to=ltao@redhat.com \
--cc=gregory.greenman@intel.com \
--cc=johannes.berg@intel.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mukesh.sisodiya@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).