wifi: brcmfmac: pcie: recover from fatal PCIe errors
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | wifi: brcmfmac: pcie: stop console read on invalid write indexdrivers/ | +8 | 0 replies | |
| 2/3 | wifi: brcmfmac: pcie: bound memdump to the mapped TCM windowdrivers/ | +8 | 0 replies | |
| 3/3 | wifi: brcmfmac: pcie: recover from fatal PCIe errorsdrivers/ | +127 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH wireless-next 0/3] wifi: brcmfmac: pcie: recover from fatal PCIe errors
On a desktop board with a BCM4366/4 (14e4:43c3, firmware 10.28.2), the firmware traps every few days, at the same address in every trap I checked. The driver's reset recovered from 10 of 12 traps in five weeks. In the other two, the downstream port reported a fatal FCP error about 0.7 s after the trap:
pcieport 0000:16:01.0: PCIe Bus Error: severity=Uncorrectable (Fatal)
pcieport 0000:16:01.0: [13] FCP (First)
brcmfmac 0000:18:00.0: AER: can't recover (no error_detected callback)
brcmfmac: brcmf_chip_get_raminfo: RAM size is incorrect brcmfmac 0000:18:00.0: brcmf_pcie_setup: Dongle setup failed
WiFi then stayed dead until reboot, and brcmf_pcie_bus_console_read() kept logging 0xff characters at about 2,800 lines per second.
Patch 1 stops that console loop. Patch 2 fixes a fault in the memdump that patch 1 uncovers on CONFIG_BRCMDBG builds. Patch 3 adds PCI error handlers and re-probes the device after the link reset.
Patches 1 and 2 are fixes and could go through wireless instead. Patch 3 depends on patch 1: without it, error_detected() waits forever for a reset that is stuck in the console loop. I sent them together against wireless-next for that reason, and am happy to split them if you prefer.
Testing
-------
All runs used a test kernel built from the Ubuntu 7.0.0-42 source (based on v7.0.14), with CONFIG_PCIEAER_INJECT and, unless noted, CONFIG_BRCMDBG. On the stock Ubuntu kernel the series has only run for about an hour, which did not exercise the error paths. Results on the test kernel:
- aer_inject with FCP on the downstream port 0000:16:01.0, alone (5 runs) and 0.3 s after a debugfs-triggered bus reset, which mimics the trap-then-FCP order seen in the field (10 runs), plus one plain reset:
WiFi back within 6-12 s in 16 of 16 runs.
- The final series, built without CONFIG_BRCMDBG: 5 of 5 injected-only runs recovered in 6-12 s. The combined reset-and-inject case needs the debugfs reset file, so it only ran on the debug build, shortly before two small cleanups (no markers, kzalloc_obj()).
- Real FCP errors, no injection (aer_inject unloaded): debugfs-triggered resets under a ping flood over WiFi produced 3 real fatal errors in 47 resets. All 3 recovered: "device recovery successful", one re-probe, and WiFi back within 4-11 s of the error. The log order matches the field failures, including the "delete_flowring: timed out" about 60 ms before the error. These runs used the debug build.
- Without the series, the injected error reproduces the dead device and the log flood.
Not done:
- No runtime test on wireless-next. I only compiled pcie.c from wireless-next with the series applied (W=1, no new warnings), against 7.0 headers; the rest of the driver does not build against those.
- The real errors above came from resets on healthy firmware. I have only run the series for about a day, so a firmware trap followed by an FCP error is still unverified.
Open points
-----------
1. Patch 3 re-probes because brcmf_pcie_reset() alone was not enough after a link reset: in 5 of 9 runs the firmware came up, but scan results showed the guest network's SSID under the main network's BSSID, and association failed with status 16. I did not find which part of the probe-time setup is missing.
2. The FCP error may come from the driver's own chip reset. It arrived 0.6-0.7 s after teardown started in every real case, about when brcmf_pcie_reset_device() writes the watchdog register. That is timing only, I have no proof of the cause. Frequency: 2 of 12 firmware traps, 3 of 47 debugfs resets, 2 of 20 module unloads. An error during unload leaves the device dead, as no driver is bound to recover it; this series does not address that.
3. brcmf_pcie_reset() and brcmf_pcie_remove() free the DMA rings before brcmf_pcie_reset_device() stops the chip. In one of those unloads, the device wrote into freed buffers first (8 AMD-Vi IO_PAGE_FAULTs). The other real errors showed no such faults, so this looks separate. This series does not touch the order; you may know whether it is deliberate.
Tool use
--------
I developed this series with an AI coding assistant, Claude Opus 5.5 (Anthropic), in one long session. I asked it why my WiFi kept disappearing. It read the logs and the driver source, proposed the analysis and the fixes, wrote the code, commit messages and test scripts, and set up the aer_inject test kernel. I ran every test on my hardware, chose between the options it offered (for example re-probing after the internal reset failed the tests), and reviewed the patches before sending.
Soeren Coremans (3):
wifi: brcmfmac: pcie: stop console read on invalid write index
wifi: brcmfmac: pcie: bound memdump to the mapped TCM window
wifi: brcmfmac: pcie: recover from fatal PCIe errors
.../broadcom/brcm80211/brcmfmac/pcie.c | 144 +++++++++++++++++- 1 file changed, 143 insertions(+), 1 deletion(-)
base-commit: b8e5b0ae8ff47240366d38e5d12c65f878724316
Signature · 1 line
2.53.0