Linux wireless drivers development
 help / color / mirror / Atom feed
From: Soeren Coremans <sorencoremans@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: arend.vanspriel@broadcom.com, brcm80211@lists.linux.dev,
	brcm80211-dev-list.pdl@broadcom.com,
	Soeren Coremans <sorencoremans@gmail.com>
Subject: [PATCH wireless-next 0/3] wifi: brcmfmac: pcie: recover from fatal PCIe errors
Date: Thu,  5 Nov 2026 22:59:51 +0100	[thread overview]
Message-ID: <20261105215954.184290-1-sorencoremans@gmail.com> (raw)

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
-- 
2.53.0


             reply	other threads:[~2026-11-05 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 21:59 Soeren Coremans [this message]
2026-11-05 21:59 ` [PATCH wireless-next 1/3] wifi: brcmfmac: pcie: stop console read on invalid write index Soeren Coremans
2026-11-26 14:29   ` Arend van Spriel
2026-11-05 21:59 ` [PATCH wireless-next 2/3] wifi: brcmfmac: pcie: bound memdump to the mapped TCM window Soeren Coremans
2026-11-26 14:29   ` Arend van Spriel
2026-11-05 21:59 ` [PATCH wireless-next 3/3] wifi: brcmfmac: pcie: recover from fatal PCIe errors Soeren Coremans
2026-11-26 14:29   ` Arend van Spriel
2026-11-26 14:29 ` [PATCH wireless-next 0/3] " Arend van Spriel

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=20261105215954.184290-1-sorencoremans@gmail.com \
    --to=sorencoremans@gmail.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=linux-wireless@vger.kernel.org \
    /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