Repository navigation
wifi: brcmfmac: pcie: keep Apple firmware in D0 across s2idle - #1722
Merged
Merged
Conversation
Without WoWLAN, s2idle sends HOST_D3_INFORM and lets PCI PM put the
function into D3hot. The Apple BCM4387 firmware (20.96.31.0.8.7.148)
acknowledges D3 while a DMA is still in flight; its console then reads
TX: pend count is 1
pciedev_d3_ack: dma in progress
After resume and the next association its TX FIFO 1 stalls ("flush
timeout", TXPEND 360), the firmware starts a fatal-error reinit and
traps in it (TRAP 4, data abort). It never reports the trap, so every
dongle command times out and Wi-Fi stays down until reboot, typically
5 to 16 s after the address is assigned.
cfg80211 has already left the network before the driver suspends and
the radio is off (mpc), so the D3 handshake buys nothing in s2idle.
Keep the function in D0 like the WoWLAN sleep does (save the PCI state
so PCI PM leaves the power state alone) and resume without D0_INFORM.
Hibernation and non-Apple firmware keep the D3 handshake.
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Run the Apple-firmware s2idle sleep against the PCIe PM stubs: no HOST_D3_INFORM, saved PCI state, TX fenced and restored, a hot resume without D0_INFORM or reprobe, rollback when saving the PCI state fails, and the D3 handshake outside s2idle. The s2idle-d3 mutation drops the D0 branch and must fail. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without WoWLAN, s2idle sends
HOST_D3_INFORMand lets PCI PM put the Wi-Fi function into D3hot. On the M1 Pro (BCM4387, firmware 20.96.31.0.8.7.148) the firmware sometimes acknowledges D3 while a DMA is still in flight. Its console, read from TCM at the failure:The trap is never reported to the host, so every dongle command times out (
brcmf_msgbuf_query_dcmd_len: Timeout on response, thenFailed to reserve space in commonring) and Wi-Fi stays down until reboot, 5-16 s after the address is assigned. The same signature shows up on the J616s (BCM4388).cfg80211 has already left the network before the driver suspends and the radio is off (mpc), so the D3 handshake buys nothing in s2idle. With this change Apple firmware (
fw_seed) stays in D0 across s2idle, as in the WoWLAN sleep: the PCI state is saved so PCI PM leaves the power state alone, and resume skipsD0_INFORM. Hibernation and other firmware keep the D3 handshake.Tests (one-shot kernels on fleet67 c6c15ac + brcm80211 at integration 3a7a3f9, which carries #1653, #1679 and #1707; s2idle on the PMU RTC; WoWLAN off unless stated):
pcie.cbyte-identical)M1 Pro with this change, magic-packet wake while asleep: unicast 10/10, broadcast 9/10, no packet 0 wakes. 0 IOMMU faults, 0 ioctl timeouts, 0 AVC in every row; association kept through the armed sleeps, reconnect after every WoWLAN-off sleep.
Production fleet67 for scale: M1 Pro 1 hang in about 110 s2idle, M2 0 in 260, J616s 3 in about 45 (fast sleep loops).
tools/asahi/brcmf-suspend-tests.pycovers the new path (no D3 inform, saved PCI state, TX fenced and restored, resume without D0_INFORM or reprobe, rollback when saving the state fails, D3 handshake outside s2idle); thes2idle-d3mutation fails it. checkpatch: clean; W=1: no new warnings.🤖 Generated with Claude Code