Skip to content

wifi: brcmfmac: pcie: reset the dongle before freeing host buffers on remove - #1707

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
wifi/brcmf-pcie-remove-quiesce
Nov 12, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
wifi/brcmf-pcie-remove-quiesce

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

brcmf_pcie_remove() unmapped the RX buffers posted to the firmware (in brcmf_detach()) before it reset the chip. The firmware keeps running and associated until that reset, so frames arriving in the gap were DMA'd into unmapped IOVAs. Every unbind or rmmod under traffic logged IOMMU translation faults: 581008000 stream 1 on M1 Pro (BCM4387), "write PTE invalid" on the M4 Pro (BCM4388) DART.

This resets the dongle right after the interrupt is quiesced and before brcmf_detach(), and drops the later reset. Firmware commands from brcmf_detach() already fail at that point because the bus state is DOWN, so nothing relies on the firmware still running.

Probe, s2idle and WoWLAN do not touch this path. Only remove does: unbind, rmmod, and setup failure.

Tests

M1 Pro (j316s), one-shot kernel fleet67 + integration brcm80211, brcmfmac loaded once at boot. Five modprobe -r brcmfmac_wcc brcmfmac; modprobe brcmfmac cycles, each with about 200 UDP packets per second sent to the Mac:

DART faults per reload link back
before 0, 10, 10, 9, 10 (39) 5/5, 6 s
after 0, 0, 0, 0, 0 5/5, 6 s

Same boot: 3 rtc1 s2idle cycles, gateway up after each. Enforcing, 0 AVC.

M2 (j413), same test (DART 681008000):

DART faults per reload link back
before 8, 7, 8, 7, 9 (39) 5/5, 6 s
after 0, 0, 0, 0, 0 5/5, 6 s

3 rtc1 s2idle cycles before the reloads on both kernels, gateway up after each. Enforcing, 0 AVC.

  • checkpatch: 0 errors, 0 warnings. The changed pcie.c is byte-identical to the one built and tested.

🤖 Generated with Claude Code

… remove

brcmf_pcie_remove() marks the bus down and masks the interrupt, then
calls brcmf_detach(), which tears down msgbuf and unmaps the RX buffers
posted to the firmware. The chip is only reset near the end of remove.
In between, the firmware is still running and associated, so frames
that arrive in that window are written into RX buffers that are no
longer mapped. With an IOMMU this shows up on every unbind or rmmod
under traffic, for example on Apple M1 Pro (BCM4387):

  apple-dart 581008000.iommu: translation fault: status:0x81000404
  stream:1 code:0x404 (unknown) at 0xbf5ab2cc

and on M4 Pro (BCM4388) as "write PTE invalid" faults on its DART.

Reset the dongle right after the interrupt is quiesced and before
brcmf_detach(), and drop the later reset. Firmware commands sent from
brcmf_detach() already fail at this point because the bus state is
DOWN, so nothing depends on the firmware staying alive.

Tested on M1 Pro, 5 rmmod/modprobe cycles each with about 200 packets
per second of UDP traffic to the host: 39 DART faults before (0, 10,
10, 9, 10), 0 after, Wi-Fi back within 6 s every time. s2idle and
probe at boot unchanged.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 12, 2026 15:54
@RyanTheTide
RyanTheTide merged commit 26a5a6a into integration/aurora Nov 12, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the wifi/brcmf-pcie-remove-quiesce branch November 12, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant