Skip to content

wifi: brcmfmac: add capability-gated LPAS associated sleep - #1216

Closed
RyanTheTide wants to merge 6 commits into
integration/aurorafrom
wifi/brcmf-lpas
Closed

RyanTheTide wants to merge 6 commits into
integration/aurorafrom
wifi/brcmf-lpas

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Some BCM4378/BCM4387 firmware advertises lpas but rejects the public
wowl iovar. Teach brcmfmac to use a capability-gated associated-sleep
fallback without claiming standard WoWLAN features that the firmware cannot
report.

This series:

  • separates firmware retention from the platform wake route;
  • reuses the existing PCIe D3 inform/ack and hot D0/HOSTREADY path;
  • arms a DT-selected in-band MSI wake only for s2idle;
  • maps the firmware cap token lpas to BRCMF_FEAT_LPAS;
  • advertises only WIPHY_WOWLAN_ANY for LPAS-only firmware; and
  • makes LPAS setup transactional, returning 1 to cfg80211's normal
    disconnect fallback after any setup failure.

The LPAS path saves PM, ARP/ND, packet-filter, event-mask and nolinkup
state. It selects PM_MAX, keeps the existing ARP/ND host-address tables
active, installs the public minimal unicast packet filter, enables the
disconnect/security event mask, and sets lpas last. Resume clears LPAS,
restores the saved policy, and reports an unspecified wake reason. Standard
firmware continues to use the existing wowl path; firmware without lpas
does not expose the fallback.

No chip-ID LPAS allowlist, Apple-only mailbox bit, GPIO wake path, PME quirk,
beacon tuning, TKO setup, flowring deletion, or firmware reload is added.

Build verification

Authoritative controller build receipt:

h-50969
source: aurora-silicon/linux wifi/brcmf-lpas
commit: ac142792219d1221088d5d5a28d7d4bb32a98d6d
command: arm64 LLVM=1, defconfig + arch/arm64/configs/asahi.config,
         W=1 -j8 Image modules
result: rc=0; requested artifacts present; brcmfmac warning/error matches=0
build.log: 1390135 bytes
build.log sha256: 799f8dd82a873d469e942edea697ffec10a3bb17bc78f687bff72144fb667675
Image sha256: 4cf4a61c33469e0cb37f037c6d9fb075719ef323752b7924704b113bf6573afc
brcmfmac.ko sha256: bb328483efb6092e575954ed1b6e27c99e9c8c438ff798e7634580e4579e761e
tail: LD [M] net/qrtr/qrtr-mhi.ko
      make[1]: Leaving directory '/srv/aurora/fast/o/ctl-h-50969/out'

This worker did not use target hardware.

Hardware verification plan

All target work must use controller-approved one-shots. Preserve
speakerguardd, the M2 macOS volume, and the read-only xART ledger. Do not add
display, presence, idle, playback, or time-of-day gates.

Preflight on each reference Mac

  1. Record the exact board, chip/revision, firmware banner/FWID, kernel commit,
    cap tokens, wowl result, LPAS gate, MSI number/count, PCI state, wakeup
    state, association/BSSID, station connected time, IP addresses, routes,
    flowring inventory, and error counters.
  2. Prove RTC wake independently with the qualified RTC alarm path.
  3. Confirm the production network profile enables WoWLAN any and that
    iw phy ... wowlan show reflects it.
  4. Arm an RTC fallback before every real s2idle cycle.

M2 j413 / BCM4387

  1. Run three control s2idle cycles with WoWLAN disabled and confirm the
    current disconnect/reassociate behaviour.
  2. Run twenty RTC-woken candidate cycles. Each cycle must show one D3 inform
    and one D3 acknowledgement, no firmware reload/cold reprobe, the same BSSID
    with increasing connected time, retained peer/flowring identities, retained
    IP lease and immediately usable gateway traffic, restored LPAS/PM/event
    state, and no brcmfmac error, txstatus underflow, D3 timeout, warning, or new
    AVC.
  3. With RTC still armed as fallback, send a unicast frame that passes the
    ANY filter. Require the WLAN MSI count to increase and the machine to wake
    before RTC; preserve the first packet or explicitly account for it.
  4. Inject an LPAS setup failure before D3 and an IRQ-wake arming failure. Both
    must roll back to a usable connected or deliberately disconnected interface,
    and neither may leave firmware in host sleep.

M1 Pro / claimed BCM4378

  1. Resolve identity with a fresh controller read. If the machine is BCM4387/7,
    report that and do not call it a BCM4378 qualification.
  2. For genuine BCM4378 firmware, repeat the capability read, three controls,
    twenty candidate cycles, and the same invariants used on M2.
  3. A missing lpas token, different ND payload version, or absent in-band MSI
    route must suppress only the LPAS fallback; it must not weaken the BCM4387
    path or introduce a chip-ID quirk.

Review notes

  • The branch intentionally touches only
    drivers/net/wireless/broadcom/brcm80211/brcmfmac/.
  • Qualification requires the DT-selected wakeup-source MSI route used by the
    existing wake series; this PR does not add board DT changes.
  • The final two warning-only commits should be squashed into the LPAS commit
    before this draft is marked ready.

The BCM4378 and BCM4387 on Apple Arm systems retain firmware across the existing D3 path, but their endpoint does not advertise standard D3hot PME. The platform has a separate wake route, so using PME as the firmware feature-probe gate prevents cfg80211 from ever keeping an association.

Split transport retention from host wake routing, retain the standard PME test, and opt only the public Apple Arm BCM4378/4387 identities into the platform wake route. Require successful wowl and wowl_cap probes before advertising anything.

Make WoWLAN setup transactional. Check each retained-state operation and unwind to cfg80211's ordinary disconnect fallback on failure. Restore the bus WoWLAN state on resume. Firmware without the public capability therefore keeps the previous behavior.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Replace the Apple machine quirk with wakeup-source permission and an
allocated MSI. Keep the firmware capability gate and the ordinary PCI
PME path.

After the firmware host-sleep acknowledgment, arm the IRQ and keep the
PCI function in D0 using pci_save_state(), so PCI PM also retains its
upstream bridges. Limit this in-band route to s2idle. Account for an
early interrupt before suspend_device_irqs(), and balance wake arming on
resume, thaw, suspend failure and IRQ teardown.

Use explicit enable_irq_wake() rather than automatic wakeirq arming so
an arming failure can refuse suspend and restore the bus. The wiphy
resume callback then clears the firmware policy on the PM unwind.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Track the wakeup source created for a DT-selected MSI separately from
pre-existing PCI wake capability. On IRQ teardown, remove only the
source we created and restore the original capability. Leave an already
enabled source owned by the bus or platform intact.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Firmware with the lpas capability can retain an association without the standard wowl iovar. Advertise only the generic WoWLAN any trigger when retained transport and a wake route are both available.\n\nSave PM, ARP/ND, packet-filter, event-mask and link-event policy, install a minimal public unicast filter, and enable lpas last. Unwind every completed step on failure so cfg80211 can use its ordinary disconnect fallback. Restore the saved policy after the existing D0/HOSTREADY path and report an unspecified wake reason.\n\nSigned-off-by: Ryan Murray <[email protected]>\nAssisted-by: LLM

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Build the two-byte mask and pattern through the dynamically allocated packet-filter buffer rather than indexing past the protocol structure's historical one-byte tail declaration.\n\nSigned-off-by: Ryan Murray <[email protected]>\nAssisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #1218 (rebased onto current integration/aurora, conflict with #1081 resolved, warning-only commits squashed). This draft stays open until #1218 lands.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #1232.

@RyanTheTide RyanTheTide closed this Nov 8, 2026
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