Repository navigation
Airs: Wi-Fi wake on the M4 Airs, and deep sleep with WoWLAN on - #2662
RyanTheTide wants to merge 4 commits into
Conversation
The BCM4388 in the M4 MacBook Airs wakes the host the way it does in the 15-inch M3 Air: brcmfmac arms the PCIe endpoint's MSI as the wake interrupt, and only when the WLAN node is a wakeup source. The J713's node is not one, so a magic packet cannot end s2idle even with WoWLAN enabled. Mark the node as a wakeup source, as t8112-j413/j415 and t8122-j615 already do. The board also routes a WLAN WAKE# line to AP GPIO 16, as the J615 does; it is left undescribed here, like on the J615. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On the Apple laptops brcmfmac arms the PCIe endpoint's MSI as the Wake-on-WLAN interrupt when the WLAN node is a DT wakeup source. That MSI can only wake the host while the link stays up, so the PCIe suspend callback refuses every system sleep other than suspend-to-idle with -EOPNOTSUPP once WoWLAN is configured. With magic-packet WoWLAN enabled, as user space does by default, that refusal fails the whole suspend-to-RAM (and hibernation) attempt. Mark such a bus as s2idle-only and, in the cfg80211 suspend callback, handle any other target like a suspend without WoWLAN: leave the network and let the firmware power down. Suspend-to-idle keeps WoWLAN as before. The PCIe refusal stays as a guard. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Deep-sleep row on the J615 (M3 Air 15, T8122, BCM4388,
The T8122 sleep itself doesn't complete a power-down yet (see #2572), so this covers suspend and resume through brcmfmac's deep path, not a real wake. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
The change is small and the shape is right. An in-band MSI can't wake the host once the link goes down, so a sleep deeper than suspend-to-idle drops WoWLAN, the way it would without WoWLAN, instead of failing the whole suspend with brcmf_pcie_pm_enter_D3 returns -95. The flag is cleared with the IRQ in brcmf_pcie_release_irq(), and s2idle keeps WoWLAN as before. The J615 row shows both paths.
Before this leaves draft:
- host-tests fails (run 44865785227):
brcmf-suspend-testsexits 1 in the control case and in all six mutations. The harness likely needs the newwowl_s2idle_onlyfield,pm_suspend_target_stateandbphy_info_oncestubs. Since even the control fails, the harness itself is out of step with the driver, not catching a mutation. - Reach:
wowl_s2idle_onlyis set wherever brcmfmac uses the MSI wake path, so every brcmfmac Mac that takes the firmware sleep loses WoWLAN for it, not only the Airs. T8132 (the M4 mini as well as the Airs) and any deep-sleep brcmfmac Mac take this path. Without the commit that suspend fails outright, as on the J615, so this should only turn a failed sleep into a working one. Please confirm with one non-T8122 deep sleep with WoWLAN armed, the M4 mini or J713 if it can, showing the sleep completes, the network comes back, andwowlanis stillmagic-packetafter the resume. - The J713/J715
wakeup-source(the "Wi-Fi wake on the M4 Airs" half): add one J713 s2idle row where a magic packet actually wakes the Mac. The J615 row covers the deep path's suspend and resume, not a wake.
Assisted-by: LLM (Claude:Opus 5.5)
The brcmfmac suspend harness no longer compiled against the driver: struct brcmf_bus gained wowl_s2idle_only and brcmf_cfg80211_suspend() now logs through bphy_info_once(), whose stub referenced a drvr the extracted function does not have. Even the control case failed. Add the field to the stub bus, give bphy_info_once() the driver's argument shape, and cover the new behaviour: with magic-packet WoWLAN on an s2idle-only bus, a deeper sleep target leaves the network as a suspend without WoWLAN does, while suspend-to-idle, or a bus with a real wake line, keeps WoWLAN. A new wowl-s2idle-only mutation, which drops that check, must be killed. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Item 1 (host-tests) fixed in cf3fae5, a new commit on top (no force push). The harness was out of step with the driver, as you said: the stub Local run on the buildbox: Items 2 and 3 need a non-T8122 Mac (M4 mini or J713): deep sleep with WoWLAN armed, and a magic-packet s2idle wake on the J713. They are queued with the J713 side. The J615 can't stand in for either. Assisted-by: LLM (Claude:Opus 5.5) |
|
Status of items 2 and 3 (item 1 is fixed in cf3fae5):
The PR stays a draft until both rows are posted. |
|
Row: deep sleep with WoWLAN armed, M4 MacBook Air (J713), macOS 27.2 stub. Lab kernel = J713 batch-4 + this PR's fix b5f37f8 + the 27.2 deep-sleep fixes (#2660, #2691, #2692).
The s2idle magic-packet row is still to run: s2idle on this J713 is currently refused by the ATC PHY on its tethered port. |
|
Item 3, magic-packet wake from s2idle on the J713 (M4 MacBook Air, T8132, BCM4388), with this PR's
A correction to the item-2 row above: Assisted-by: LLM (Claude:Opus 5.5) |
|
No blockers. The s2idle-only state comes from the wake mechanism (MSI wake source without a HOST_WAKE interrupt), not from the machine, and it is cleared with the IRQ. On every brcmfmac Mac using the MSI wake it only turns a refused deep sleep or hibernation with WoWLAN configured into one without WoWLAN. s2idle is unchanged. The J713 10/10 deep-sleep row and the J713 s2idle magic-packet wake (+30.5/+31.5 s on brcmf_pcie_intr) cover the earlier review items, and CI is green at cf3fae5. One suggestion: in brcmf_cfg80211_suspend(), return 1 (after clearing scan_status, as the other refusal branches do) instead of setting wowl = NULL. wiphy_suspend() then runs cfg80211_leave_all() and calls suspend(NULL) itself. With wowl = NULL the driver returns 0, leave_all is skipped, and only station/P2P-client links are torn down, so an AP or P2P-GO interface that is up while WoWLAN is configured is not stopped through cfg80211 before a deep sleep. Not tested yet: J715, hibernation with WoWLAN on, and a deep sleep with a hotspot up. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed at cf3fae5d99aa.
All three items from the earlier review are satisfied:
host-testsfixed incf3fae5d(dt-checksandhost-testsboth green).- Non-T8122 deep sleep with WoWLAN armed: J713 10/10 real deep sleeps (
suspend_stats10/0), Wi-Fi reassociates and pings gateway after each wake,wowlanstaysmagic-packet. - J713 magic-packet s2idle wake: 2/2 wakes at +30.5/+31.5 s on
brcmf_pcie_intr(RTC fallback at +120 s), link back in 0.01 s / ping 0.02 s.
Commits/DCO, PR attribution, and clean hardware-mechanism gating (wakeup-source without interrupts/interrupts-extended, not a chip/board check) all look good.
Blocking finding before approval
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:5272-5277—wowl = NULLbypassescfg80211_leave_all():
Settingwowl = NULLand falling through to return0tellswiphy_suspend()(net/wireless/sysfs.c:105-118) that WoWLAN succeeded, so cfg80211 skipscfg80211_leave_all(rdev), event/work flushing, and the subsequentrdev_suspend(rdev, NULL). That breaks cfg80211's documented WoWLAN-refusal contract and leaves AP / P2P-GO / mesh interfaces unstopped in cfg80211 when the firmware powers down for deep sleep or hibernation.
Match the other refusal branches inbrcmf_cfg80211_suspend()(cfg80211.c:5301-5317): clearcfg->scan_status = 0;andreturn 1;(and update the new assertion intools/asahi/brcmf-suspend-tests.py:122-130to checkret == 1with!cfg.suspendedononly && deep— or test the two-call sequencesuspend(&magic) == 1followed bysuspend(NULL) == 0).
Minor / still worth tracking
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:1288: defensively clearbus->wowl_s2idle_only = false;right alongsidebus->wowl_wake = pci_pme_capable(...)inbrcmf_pcie_request_irq().- Hardware rows: please also note explicit regression counts (
0 AVC,0 failed units) on the J713 deep-sleep/s2idle boot; J715, hibernation with WoWLAN on, and deep sleep with an AP/hotspot up remain untested (thereturn 1fix directly addresses the AP/hotspot case).
Assisted-by: LLM (Google:Gemini 4 Neon)
On a bus whose only wake signal is the in-band MSI, a sleep deeper than suspend-to-idle cannot be woken by the radio, so brcmf_cfg80211_suspend() dropped the WoWLAN request by setting wowl to NULL and suspending without it. It then returned 0, which tells wiphy_suspend() that WoWLAN was configured: cfg80211 skips cfg80211_leave_all(), the event and work flush and the second suspend(NULL) call. Only station and P2P-client links were torn down by the driver, so an AP, P2P-GO or mesh interface stayed up in cfg80211 while the firmware powered down. Refuse WoWLAN the way the other refusal branches do: clear the scan status and return 1. cfg80211 then leaves every interface and calls the driver again with no WoWLAN, which runs the existing non-WoWLAN suspend. Also clear wowl_s2idle_only where brcmf_pcie_request_irq() resets wowl_wake, so a stale value can never outlive the IRQ setup that derives it. Update the host harness: with WoWLAN supported, a deeper target on an s2idle-only bus must return 1 with nothing configured and the scan status cleared, and the following suspend(NULL) must succeed with WoWLAN off on the bus. The previous wowl = NULL code fails that case. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at cf3fae5 addressed in 005860b, a new commit on top (no force push).
Testing on the buildbox: Hardware rows still to run on the new head (J713, 27.2, default command line), because the deep path now goes through cfg80211's refusal sequence:
J715 and hibernation with WoWLAN on are still untested. Assisted-by: LLM (Claude:Opus 5.5) |
|
J713 rows at 005860b (13-inch M4 Air, macOS 27.2 stub), on the new head. The kernel is 7.3.0-aurora-fleet82: integration/aurora f5fae3c plus open heads, including this PR at 005860b. It booted as a one-shot on the default command line with the J713's configured Stage 2. WoWLAN was armed for the whole boot (
Still to run: a deep sleep with a hotspot up, which is the case the new refusal path covers. On this Air, ssh runs over Wi-Fi, so that row needs a wired path or someone at the Mac. Assisted-by: LLM (Claude:Opus 5.5) |
|
Review at 005860b: no blockers. The blocking item from the cf3fae5 review is fixed. When the bus is s2idle-only and the target is deeper, Not blocking, still open from the earlier review: a deep sleep with a hotspot/AP up (the case the Full review
Assisted-by: LLM (Claude:Opus 5.5) |
Problem
On the M4 MacBook Airs (J713, J715) Wake-on-WLAN cannot end suspend-to-idle. brcmfmac arms the BCM4388's PCIe MSI as a wake interrupt only when the WLAN node is a wakeup source, and the J713/J715 node is not one. The same gap on the 15-inch M3 Air was fixed in #2581.
Change
wifi: brcmfmac: sleep without WoWLAN when only s2idle can wake: when the wake is the in-band MSI, the PCIe suspend callback refuses every system sleep other than suspend-to-idle with WoWLAN configured, which fails the whole suspend-to-RAM or hibernation attempt while magic-packet WoWLAN is on (the user-space default). The bus is now marked s2idle-only and the cfg80211 suspend callback handles any deeper target like a suspend without WoWLAN (leave the network, power the radio down). Suspend-to-idle keeps WoWLAN.arm64: dts: apple: t8132-j713-j715: enable WLAN wake: mark&wifi0int8132-j713-j715.dtsiaswakeup-source, ast8112-j413/j415andt8122-j615already do. The board also has a WLAN WAKE# line on AP GPIO 16, like the J615; it stays undescribed, as on the J615, because the wake that works is the in-band MSI.Testing
power/wakeupis enabled on 01:00.0, WoWLAN magic-packet is enabled, Wi-Fi is unchanged (5 GHz TX 295 / RX 253 Mbit/s, WPA3-SAE joins, BSSID roaming, power save on/off), 0 failed units over several warm boots.brcmf_pcie_intr. Control without the property: the packet did not end the sleep, the RTC alarm woke it at +120 s.make CHECK_DTBS=y apple/t8132-j713.dtb apple/t8132-j715.dtb: no warnings. brcmfmac builds W=1 clean.wowlanstill magic-packet afterwards: Airs: Wi-Fi wake on the M4 Airs, and deep sleep with WoWLAN on #2662 (comment)brcmf_pcie_intr(RTC fallback at +120 s): Airs: Wi-Fi wake on the M4 Airs, and deep sleep with WoWLAN on #2662 (comment)run-host-tests.py --only brcmf-suspend8/8 (control + 7 mutations),--only brcmf46/46.Still to run
Details for reviewers
brcmf_pcie_pm_enter_D3()returns -EOPNOTSUPP), so the system never sleeps.brcmf_pcie_request_irq()only callsdevice_init_wakeup()and setswowl_irqwhen the node haswakeup-sourceand nointerrupts; without itbus->wowl_wakefalls back to PCI PME, which these Macs do not deliver.Assisted-by: LLM (Claude:Opus 5.5)