Skip to content

wifi: apple: centauri: Quiesce Alpha for sleep on every N1 board - #2385

Merged
RyanTheTide merged 3 commits into
mainfrom
spec-m5neo/t8142-air-parity-n1
Dec 1, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
spec-m5neo/t8142-air-parity-n1

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

centauri_wifi_suspend() and centauri_wifi_resume() (drivers/net/wireless/apple/centauri/centauri_wifi.c:2713,2726) only run on apple,j813. The host-power and ACIPC sleep requests they send are the N1 firmware's protocol. J815 has the same N1 behind the same PCI functions and its own entry in the driver's board table (4cca392, "wifi: apple: centauri: quiesce Alpha for J813 system sleep").

Change

  • Suspend runs on any board where the native driver bound (c->wifi set, which needs a centauri_board() entry). It stays behind the existing TEST-ONLY apple_centauri.alpha_sleep_untested switch.
  • Resume drops its board check: it only undoes requests that suspend sent (alpha_resume_locked() returns at once when none were sent).

Testing

  • Compiled centauri_wifi.c before and after with the release config's kbuild command line and W=1, as a module: no compiler warnings on either side.
  • Default behaviour (switch off) is identical on every board: suspend returns before doing anything, and resume finds nothing to undo. With the switch on, J815 and J873g (T8152) now also send the handshake.

Still to run

  • @m0d16l14n1 (J815): with apple_centauri.alpha_sleep_untested=1, Wi-Fi disconnected, one s2idle and one deep cycle. Expected: no "Alpha transport remains paused" error, Wi-Fi scans after resume.
  • @sithglan (J813): the same row. Expected: unchanged.
  • J873g owners: the same row if you can, or tell me if T8152's N1 needs a different sequence and I will key it on that.
Details
  • btcentauri.c (Bluetooth side, the same pattern) is handled in a separate change.
  • Credit: the sleep handshake is sithglan's (4cca392).

The Alpha host-power and ACIPC sleep requests are the N1 firmware's
protocol, but suspend and resume only ran them on apple,j813. J815 has
the same N1 behind the same PCI functions and its own entry in the
driver's board table.

Run suspend wherever the native driver bound (c->wifi is set, which
needs a board entry), still behind the TEST ONLY alpha_sleep_untested
switch, and drop resume's board check: it only undoes requests suspend
sent and returns at once otherwise. With the switch off nothing changes
on any board.

Fixes: 4cca392 ("wifi: apple: centauri: quiesce Alpha for J813 system sleep")
Suggested-by: Thomas Glanzmann <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
@gig3m

gig3m commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5), macOS 27.2 stub, apple_centauri.alpha_sleep_untested=1. No change from before. Wi-Fi was still connected, not disconnected as the row asks.

Two deep cycles with a 30 s alarm: each one logged the full handshake, and there was no Alpha transport remains paused:

TEST: Alpha firmware host LPNA: ret=0 status=0 exec=2
TEST: Alpha ACIPC host sleep: ret=0 status=3 exec=2 ipc=2
TEST: Alpha ACIPC host wake: ret=0 status=0 exec=2 ipc=2
TEST: Alpha firmware host awake: ret=0 status=0 exec=2

After each wake, the interface kept its addresses and pinged the gateway (3/3), and Bluetooth stayed powered.

s2idle: not run.

🤖 Generated with Claude Code

@sithglan

Copy link
Copy Markdown
Contributor

A J813 data point for this series. #2385 does not cause it, but it shows how the handshake it widens can fail.

Default J813 boot (integration/aurora with #2135 and #2142, apple_centauri.alpha_sleep_untested=1), 2026-11-19:

  • 10:43:03: lid closed, deep sleep committed, woke about 3 s later on an SMC wake (a USB-C plug change). Wi-Fi re-associated at 10:43:10.
  • The lid was still closed, so logind suspended again at 10:43:34. LPNA returned 0 at exec=2, then the ACIPC host-sleep write was never acknowledged:
    Alpha ACIPC host sleep: ret=-5 status=0 exec=3 ipc=2
    
    The Alpha firmware aborted (stage 2 -> 3) during the handshake. Three earlier cycles in the same boot had passed the same sequence.
  • The restore in centauri_wifi_suspend() cannot wake a firmware at exec 3, because the transport check requires exec 2:
    Alpha transport remains paused after refused sleep: -5
    
    transport_paused stays set, so every later suspend returns -EBUSY and every scan fails (rc=-16, data ring setup -5) until reboot. logind retried every 30 s until the lid opened, and each retry was refused.

So one failed handshake costs Wi-Fi until reboot, not just that one sleep. This doesn't block #2385, which stays behind the TEST-ONLY switch. But a J815 or J873g row that passes two cycles does not rule this out; a wake followed by an immediate second suspend (lid closed, cable change) is the case that hit it here. The fix belongs in the driver: recover an Alpha at exec 3, or at least clear the pause so it can be restarted. That is separate from this PR.

@sithglan

Copy link
Copy Markdown
Contributor

J873g: I can't run this row yet. The J873g's kernel configs (the integration-based PR stack and the private desktop one) build without CONFIG_SUSPEND, so there's no /sys/power/mem_sleep, and system sleep hasn't been brought up on the J873g at all. The board also describes no RTC for an alarm wake.

So there's no T8152-specific sequence to key on yet. Today's J873g kernel binds the same N1 functions as the J813: Wi-Fi reaches interface started, and Bluetooth paired with a J813 for #2330. With the switch off, this change does nothing on the J873g, as you describe. Once the J873g has suspend, I'll run this row there.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks @gig3m and @sithglan.

  • @gig3m: two deep cycles on the J813 with the switch on, the full handshake both ways, no paused transport, and Wi-Fi and Bluetooth fine after wake. That covers the J813 deep half of the row; staying connected doesn't change what it shows. One s2idle cycle would complete it.
  • @sithglan: thanks for the failure trace. Agreed, this PR doesn't cause it, but it does widen the handshake to more boards, so it matters here. A firmware that drops to exec 3 during the handshake leaves transport_paused set until reboot. That needs its own driver fix (recover the Alpha from exec 3, or at least clear the pause so it can be restarted), and I'll open it as a separate change. A wake followed at once by a second suspend is the test for it.
  • J873g: understood, no CONFIG_SUSPEND and no RTC wake yet, so there's nothing to run there. With the switch off this change does nothing on the J873g, and nothing gets keyed on T8152 until its suspend is up.
  • Still open: the J815 row (@m0d16l14n1), one s2idle and one deep cycle with the switch on.

@gig3m

gig3m commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5), macOS 27.2 stub, s2idle with apple_centauri.alpha_sleep_untested=1, the tree from my deep rows (#2385 on #2135's merged head) plus #1906's new head. One cycle of 2 min 23 s, woken by a key press (havok has no RTC alarm).

The full handshake both ways, no paused transport:

TEST: Alpha firmware host LPNA: ret=0 status=0 exec=2
TEST: Alpha ACIPC host sleep: ret=0 status=3 exec=2 ipc=2
TEST: Alpha ACIPC host wake: ret=0 status=0 exec=2 ipc=2
TEST: Alpha firmware host awake: ret=0 status=0 exec=2

Wi-Fi re-associated about 3.4 s after PM: suspend exit and pinged the gateway (3/3); Bluetooth stayed powered. suspend_stats: success=1 fail=0.

With the deep rows above, that completes the J813 row.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The J813 rows are complete (two deep cycles and one s2idle cycle with the full handshake). The handshake still runs only behind the test-only alpha_sleep_untested module parameter; for this to be production-ready it should run by default where the device tree describes the Alpha sleep path, with the parameter removed. Then a J815 row on the default command line (one s2idle and one deep cycle with no "Alpha transport remains paused", Wi-Fi scanning after resume), a review and ready-marking.

@m0d16l14n1

Copy link
Copy Markdown
Contributor

J815 (MacBook Air 15" M5) row at b1c3392ad232, in a batched candidate.

Candidate: m0d16l14n1/linux j815/prtest-r6 8ad9358 = main 70381bd with these PR heads merged unchanged: #2384 f9d03e8, #2385 b1c3392, #2192 c5daf57, #2193 8be9e73, #3123 227c89b, #3124 1a272ce, #3125 4ad71b8, #3129 6d5ec4d, #3130 76bf36c, plus the open J815 PRs. Stage 2: aura main 508390223 + aura#391/#165/#363. Command line: default + pcie_aspm=off apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 apple_sep.xart_writes=0 apple_sep.provision_keybag=0.

One timed deep sleep and wake (Timekeeping suspended for 24.464 seconds, 9 cores in one burst, CPUs 0-9): Wi-Fi wlp1s0f0 was up 5 s after the wake on the same 5 GHz network, no reconnect, no recovery needed. The Bluetooth side of the same N1 needed #3130 (Beta was still gated on J813).

Regression on the same boot (6aaae3d9, after the wake): 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

@m0d16l14n1

Copy link
Copy Markdown
Contributor

J815 (MacBook Air 15" M5) row at b1c3392ad232 unchanged: PASS.

Candidate: m0d16l14n1/linux j815/prtest-r7 d70fd05 = main a60fef7 with these PR heads merged unchanged: #2384 f9d03e8, #2385 b1c3392, #2192 c5daf57, #2193 8be9e73, #3123 822a1dd, #3124 1a272ce, #3125 4ad71b8, #3129 6d5ec4d, #3130 76bf36c, plus the open J815 PRs (r6 + #3123's new head). Stage 2 as on r6. Command line: default + pcie_aspm=off apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 apple_sep.xart_writes=0 apple_sep.provision_keybag=0 apple_sleep.t8142_wake_s=0 (the last one turns off the timed PMU wake, so the sleep lasts until a key).

One deep sleep with no timer, woken by a key on the built-in keyboard after about 10 minutes (boot 9325546c): Timekeeping suspended for 603.654 seconds, 9 cores started in one burst, CPUs 0-9 online, suspend_stats success=1 fail=0; the wake source is the built-in keyboard/trackpad. Panel, NVMe, Wi-Fi (up 5 s after the wake) and Bluetooth (LE mouse still connected, 0 TX/RX errors, exec 2 / IPC 2) back.

Regression on the same boot, after the wake: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

Alpha's host-power and ACIPC sleep handshake ran only with
apple_centauri.alpha_sleep_untested=1. Without it the N1 firmware is not
told the host goes to sleep, and a deep sleep is aborted and the Mac woken
about a minute in. The handshake runs through full deep sleeps and wakes
on J813 and J815 (MacBook Air 13" and 15" M5).

Default it on, for a deep sleep only: across s2idle the firmware keeps
running and nothing is sent, as before. alpha_sleep_untested=0 skips it.

Signed-off-by: Nick <[email protected]>
…fault

wifi: apple: centauri: Send the Alpha sleep handshake by default

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at e65cbcb

Drops the J813 machine gate and makes the Alpha sleep handshake the default for firmware (deep) sleep; s2idle is untouched (pm_suspend_via_firmware() is false there). Better than before: without the handshake the N1 firmware aborts deep sleep about a minute in.

Checked: centauri_wifi_resume() without the board gate is a no-op unless suspend sent a request (alpha_resume_locked() returns early when neither *_sleep_sent flag is set), so s2idle and boards that never sent it are unaffected. Suspend still refuses with -EBUSY while Wi-Fi is associated; NetworkManager disconnects before device suspend (the J815 row slept connected-at-request), and a refused deep sleep is no worse than today's aborted one. Rows: J815 PASS at f63bd68 (handshake + 185 s sleep + reconnect) and at b1c3392. J813 row still open (owner).

Blockers: none. Follow-up from B1-GATES removes the alpha_sleep_untested parameter itself.

@RyanTheTide
RyanTheTide marked this pull request as ready for review December 1, 2026 04:32
@RyanTheTide
RyanTheTide requested review from a team as code owners December 1, 2026 04:32
@RyanTheTide
RyanTheTide merged commit b2cd21f into main Dec 1, 2026
5 checks passed
@RyanTheTide
RyanTheTide deleted the spec-m5neo/t8142-air-parity-n1 branch December 1, 2026 04:32
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged as b2cd21f under the 12-01 one-Mac rule (J815 row PASS at f63bd68). J813 row still welcome; regressions get a same-day revert.

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.

5 participants