* [PATCH v2] iwlwifi: pcie: support shutdown operation
@ 2026-01-21 11:39 Li Chen
2026-11-30 1:11 ` [PATCH v3] wifi: " Jason Perlow
0 siblings, 1 reply; 2+ messages in thread
From: Li Chen @ 2026-01-21 11:39 UTC (permalink / raw)
To: Miri Korenblit, Johannes Berg, Emmanuel Grumbach,
Yedidya Benshimol, linux-wireless, linux-kernel
Cc: Li Chen
Kexec reboot does not reset PCI devices. If iwlwifi is left running,
the next kernel can time out during probe, breaking networking after
kexec:
kernel: iwlwifi 0000:06:00.0: Host monitor block 0x22 vector 0x0
kernel: iwlwifi 0000:06:00.0: value [iter 0]: 0x00000000
kernel: iwlwifi 0000:06:00.0: probe with driver iwlwifi failed with error -110
Register a dedicated PCI shutdown callback:
run the normal teardown path and then disable the PCI function and
transition it to D3hot so the next kernel can re-initialize it reliably.
Signed-off-by: Li Chen <me@linux.beauty>
---
Changes in v2:
- Don't reuse the ->remove callback for shutdown.
- Disable the PCI function and set D3hot after teardown.
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index dc99e7ac4726..e950aab5a39d 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1192,6 +1192,21 @@ static void iwl_pci_remove(struct pci_dev *pdev)
iwl_pcie_gen1_2_remove(trans);
}
+static void iwl_pci_shutdown(struct pci_dev *pdev)
+{
+ struct iwl_trans *trans = pci_get_drvdata(pdev);
+
+ if (trans) {
+ iwl_pcie_gen1_2_remove(trans);
+ pci_set_drvdata(pdev, NULL);
+ }
+
+ pci_save_state(pdev);
+ pci_clear_master(pdev);
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, PCI_D3hot);
+}
+
#ifdef CONFIG_PM_SLEEP
static int iwl_pci_suspend(struct device *device)
@@ -1325,6 +1340,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,
.driver.coredump = iwl_pci_dump,
};
--
2.52.0
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH v3] wifi: iwlwifi: pcie: support shutdown operation
2026-01-21 11:39 [PATCH v2] iwlwifi: pcie: support shutdown operation Li Chen
@ 2026-11-30 1:11 ` Jason Perlow
0 siblings, 0 replies; 2+ messages in thread
From: Jason Perlow @ 2026-11-30 1:11 UTC (permalink / raw)
To: Miri Korenblit, Johannes Berg, Emmanuel Grumbach, Yedidya Benshimol
Cc: Li Chen, Emil Williams, linux-wireless, linux-kernel
From: Li Chen <me@linux.beauty>
Kexec reboot does not reset PCI devices. If iwlwifi is left running,
the next kernel can time out during probe, breaking networking after
kexec:
kernel: iwlwifi 0000:06:00.0: Host monitor block 0x22 vector 0x0
kernel: iwlwifi 0000:06:00.0: value [iter 0]: 0x00000000
kernel: iwlwifi 0000:06:00.0: probe with driver iwlwifi failed with error -110
Register a dedicated PCI shutdown callback:
run the normal teardown path and then disable the PCI function and
transition it to D3hot so the next kernel can re-initialize it reliably.
Signed-off-by: Li Chen <me@linux.beauty>
[jperlow: rebased onto wireless-next; the teardown is now iwl_pci_remove()]
Tested-by: Jason Perlow <jperlow@gmail.com>
Signed-off-by: Jason Perlow <jperlow@gmail.com>
---
Changes since v2 (posted 2026-01-21, no replies that I could find):
- rebased onto wireless-next; the teardown is now iwl_pci_remove()
instead of the removed iwl_pcie_gen1_2_remove()
I am sending this on behalf of Li Chen, whose v1 and v2 I found no
reply to. Li Chen, please say if you would rather resend it yourself.
Testing: ASUS GU502LV, Intel AX201 (8086:06f0), v7.4-rc5, where
pcie/drv.c is identical to wireless-next. The module was loaded into
the running kernel so the shutdown callback ran on the way out.
Without the callback, kexec lost the device: either probe failed with
-110 ("CSR_RESET = 0x10" and the host monitor dump), or an error
interrupt arrived before an op mode was attached and hit the
WARN_ON_ONCE(!trans->op_mode) in iwl_trans_fw_error(). A plain reboot
did not recover it, only a power cycle did. A control run with the
stock module lost the device on the first kexec.
With this patch, associated to an AP with sustained ping traffic, 3
kexec and 2 reboot cycles were all clean: no iwlwifi errors, and no
warnings or traces in the log of the kernel being shut down. The v1
form (.shutdown = iwl_pci_remove) passed the same tests, plus 5 kexec
cycles with the interface down, so I could not tell the two forms apart
on this device. Only this one chip was tested.
The same failure was reported on an AX211 (8086:7a70) on 14 Oct:
<87a4og34vi.fsf@chud.cyou>.
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 2401200..e07d0c6 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1206,6 +1206,21 @@ 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) {
+ iwl_pci_remove(pdev);
+ pci_set_drvdata(pdev, NULL);
+ }
+
+ pci_save_state(pdev);
+ pci_clear_master(pdev);
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, PCI_D3hot);
+}
+
#ifdef CONFIG_PM_SLEEP
static int iwl_pci_suspend(struct device *device)
@@ -1347,6 +1362,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,
.driver.coredump = iwl_pci_dump,
};
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-30 1:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-21 11:39 [PATCH v2] iwlwifi: pcie: support shutdown operation Li Chen
2026-11-30 1:11 ` [PATCH v3] wifi: " Jason Perlow
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®