Repository navigation
wifi: apple: centauri: t6050: harden keep-alive sleep fallback, PME gating, and 27.2 TLV 280 - #2877
DjDeveloperr wants to merge 2 commits into
Conversation
|
Review at b11ae16.
|
b11ae16 to
1fe0a90
Compare
|
@RyanTheTide Thanks for the thorough review — pushed R2 (
|
|
Re-review at 1fe0a90 (87505df + 1fe0a90). Thanks for the split and the fixes. Points 1, 3, 4 and 6 are met in the code. I ran the four host suites on this head (
Assisted-by: LLM (Claude:Opus 5.5) |
…E gating
Harden the T6050 N1 keep-alive deep-sleep path on associated disconnects,
partial keep-alive fallback unwinds, post-quiesce PCI saved state, and
D3hot PME gating:
- Drain in-flight data_tx_busy[] completions during wifi_disconnect(),
and skip keep-alive in favor of the existing warm-reset teardown when
cfg80211_leave_all() just disconnected inside wiphy_suspend()
(centauri_t6050_wifi_pm_disconnected()). With WoWLAN off (the default),
sleeps while associated now take the warm-reset path; keep-alive
applies only to WoWLAN-armed or unassociated sleeps.
- Unwind partial keep-alive ACIPC host-sleep cleanly before falling back
to teardown: centauri_t6050_suspend() wakes Control and Alpha and logs
any unwind failure, marking Wi-Fi failed with
centauri_t6050_wifi_mark_failed() and scheduling recovery with
apple_centauri_sleep_recovery_needed() (also covering aborted suspends
where resume/rewake may not run) so centauri_t6050_quiesce() does not
issue ACIPC commands against sleeping firmware;
centauri_t6050_wifi_suspend() checks alpha_resume_locked() similarly;
and cen_quiesce() wakes Beta ACIPC (clearing running if wake fails)
before hci_unregister_dev().
- Refresh pci_save_state() for fn 1/2 in centauri_t6050_domain_fence()
only when centauri_t6050_stop_dma() succeeded for that function, and
clear state_saved otherwise (or if pci_save_state() fails, handing
suspend_noirq state save and power-state selection back to the PCI
core). Because cen_suspend() runs before centauri_t6050_suspend() and
saves fn 2 PCI config while Bus Master is enabled in keep-alive mode,
an aborted suspend after a Control fallback would otherwise restore Bus
Master and the pre-quiesce header onto a quiesced function whose DMA
arena was already freed, while calling pci_save_state() on a gone or
unreadable function would snapshot 0xffff.
- Gate PCI_PM_CTRL_PME_ENABLE in D3hot on actual wake arming
(centauri_t6050_wifi_wowlan_armed() for fn 0/1, device_may_wakeup() &&
running for fn 2), update the stale D3hot PME_En overview comment, and
add missing (__force u16) casts for PCI_D3hot and PCI_D0 in
btcentauri_t6050.c. Because btcentauri_t6050 does not call
device_init_wakeup() at probe, Bluetooth PME is intentionally off by
default and follows sysfs wakeup policy.
Extend tools/asahi/centauri-{wifi-pm,bt-arena,recovery}-tests.py and
centauri-physical-recovery-tests.c to cover disconnect TX drain,
PM disconnect/WoWLAN/mark-failed helpers, Beta fallback ACIPC unwind,
and post-fence fn 1/2 state_saved refresh/unreadable-function clearing
with negative controls.
Signed-off-by: Diljit Singh <hey@djdev.me>
…h legacy fallback Command 6 TLV 280 currently hardcodes the 85-event legacy mask on wake so older Alpha firmware (which rejects TLV 280 lengths >= 87 and event counts >= 86) accepts the command, leaving newer firmware that supports 91 events without its upper event slots restored after sleep. Keep the sleep command 6 TLV 280 at the existing 86-byte length (1 + 85, carrying the 9 filtered sleep events) on every firmware. On wake, try the 91-event full mask first and fall back to the 85-event legacy mask on -EREMOTEIO while the Alpha transport remains healthy (exec stage == 2). Log the refused firmware status once per Wi-Fi registration via dev_info() when fallback succeeds, without permanently latching the legacy count so a transient unrelated refusal does not pin a registration to 85 events. Extend tools/asahi/centauri-wifi-pm-tests.py to cover legacy fallback with one-shot dev_info logging, transient wake refusal recovery back to 91 events, full-mask wake acceptance, and sleep-length/fallback-log negative controls. Signed-off-by: Diljit Singh <hey@djdev.me>
1fe0a90 to
8ecf51d
Compare
|
@RyanTheTide Thanks for the detailed re-review — pushed R3 (
Verified at |
|
Re-checked at 8ecf51d (6fb60db + 8ecf51d). All six are addressed:
No code concerns left from my side. Before merge it needs the T6050 rows from the matrix on the default cmdline (K116s and M5 Max), including one boot where the wake falls back (showing the log line and healthy firmware afterwards) and one where it doesn't. Assisted-by: LLM (Claude:Opus 5.5) |
|
Bare-metal T6050 default-cmdline sleep matrix verified on Apple MacBook Pro 14-inch M5 Pro (
|
|
K116s (16-inch M5 Pro, firmware 27.2) rows at 8ecf51d. The reset from #2718 is gone. Kernel:
The first two are the case that reset 2 of 2 before. I also ran those two plus the logind one on your first head b11ae16 earlier today, same result. The wake takes the full mask on this firmware, no fallback line: Not run here: WoWLAN armed with a wake on traffic, Bluetooth up across a sleep, a forced keep-alive failure, and a firmware where the wake falls back. No serial capture either, but nothing failed that would need one. |
Follow-up hardening for #2718 on T6050 N1 deep sleep, split into two commits:
Commit 1:
wifi: apple: centauri: t6050: harden keep-alive sleep fallback and PME gating(6fb60db5532e)data_tx_busy[]completions inwifi_disconnect(), and skip keep-alive in favor of the existing warm-reset teardown whencfg80211_leave_all()just disconnected duringwiphy_suspend()(centauri_t6050_wifi_pm_disconnected()). With WoWLAN off (the default), sleeps while associated take the warm-reset path; keep-alive applies only to WoWLAN-armed or unassociated sleeps.centauri_t6050_quiesce(), logging any wake failure, marking Wi-Fi failed (centauri_t6050_wifi_mark_failed()) so teardown skips dead ACIPC commands, and scheduling recovery (apple_centauri_sleep_recovery_needed(), also covering aborted suspends where resume/rewake may not run); checkalpha_resume_locked()unwind insidecentauri_t6050_wifi_suspend()as well. Incen_quiesce(), wake Beta ACIPC (clearingrunningif wake fails) beforehci_unregister_dev().fn1/fn2pci_save_state()refresh: Becausecen_suspend()runs beforecentauri_t6050_suspend()and callspci_save_state(fn2)while Bus Master is enabled in keep-alive mode, refreshpci_save_state()for fn 1/2 incentauri_t6050_domain_fence()only whencentauri_t6050_stop_dma()succeeded for that function, and clearstate_savedotherwise (or ifpci_save_state()fails, handingsuspend_noirqstate save and power-state selection back to the PCI core). This prevents an aborted suspend after a Control fallback from restoring Bus Master and the pre-quiesce header onto a quiesced function whose DMA arena was already freed, while avoiding snapshotting0xffffon an unreadable/gone function.PCI_PM_CTRL_PME_ENABLEin D3hot oncentauri_t6050_wifi_wowlan_armed()(fn 0/1) anddevice_may_wakeup() && running(fn 2), update the stale D3hotPME_Enoverview comment incentauri_pci.c, and add(__force u16)casts forPCI_D3hot/PCI_D0inbtcentauri_t6050.c. Becausebtcentauri_t6050does not calldevice_init_wakeup()at probe, Bluetooth PME is intentionally off by default and follows sysfs wakeup policy.Commit 2:
wifi: apple: centauri: t6050: try full TLV 280 event mask on wake with legacy fallback(8ecf51d29987)1 + 85, carrying the 9 filtered sleep events) on every firmware.CEN_HOST_EVENTS_FULL) first and fall back to the 85-event legacy mask (CEN_HOST_EVENTS_LEGACY) on-EREMOTEIOwhile the Alpha transport remains healthy (exec == 2).dev_info()when fallback succeeds, without permanently latching the legacy count so a transient unrelated refusal does not pin a registration to 85 events.Verification (host-side; bare-metal T6050 matrix pending)
scripts/checkpatch.pl --strict --git 4a17f737e9ca3..HEAD: 0 errors, 0 warnings, 0 checks on both commits.--negative-controls):tools/asahi/centauri-wifi-pm-tests.py: PASS (includingcentauri_t6050_wifi_mark_failed, legacy fallback + one-shotdev_info, transient refusal recovery back to 91 events, full-mask wake,sleep-uses-full-lenandsilent-fallback-lognegative controls)tools/asahi/centauri-bt-arena-tests.py: PASS (including Beta fallback ACIPC unwind +missing-quiesce-acipc-wakenegative control)tools/asahi/centauri-recovery-tests.py: PASS (including post-fencefn1/fn2state_savedrefresh, unreadable-function clearing,negative-stale-state-savedandnegative-save-unreadable-fnnegative controls)tools/asahi/centauri-physical-recovery-tests.py: PASSLLVM=1 W=1(asahiprofile):btcentauri_t6050.o,centauri_pci.o,centauri_wifi.ocompile cleanly with 0 warnings.rtcwake -m mem(warm-reset fallback, reported reset).iw phy wowlan enable any+ wake on traffic (keep-alive).rtcwake -m mem(keep-alive with PME off on all 3 functions).dev_infowith refused status and healthy post-refusal state) and one where 91 succeeds directly.Assisted-by: LLM (Google:Gemini 4 Neon)