Skip to content

PCI: apple: T6050: reset an unarmed N1 before firmware sleep - #2022

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
j714s/n1-entry-reset
Nov 15, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
j714s/n1-entry-reset

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

On the J714s (MacBook Pro 14" M5 Pro), a deep sleep with Wi-Fi or Bluetooth up ends early: the SMC records the wifibt wake source well before the RTC alarm, typically 16 to 28 s after the commit. The firmware-sleep path tears both radios' host drivers down and arms no wake, but leaves the N1 firmware running without its host.

This makes the N1's driver ask the PCIe host, for that path, to replay the DT's warm-reset sequence for the N1 right after the link shuts down in the host's noirq suspend. If that reset fails, the host attempts to bring its port and DART back the way a wake does and returns the original error, so the sleep is refused. When that restoration succeeds, the radios are enumerated again as after an abandoned suspend; when it fails, the existing lost-port handling keeps the port's functions unreachable until a restart.

  • pcie-apple: apple_pcie_t6050_sleep_reset() for the endpoint's driver; the replay in the noirq suspend after apple_pcie_t6050_sleep_down(); apple_pcie_t6050_warm_reset() returns its error.
  • centauri T6050: the request from both firmware-sleep branches of its suspend.
  • macsmc: comments only (apple_smc_write_noirq() is now also called from a noirq suspend).

J714s only: the host's T6050 sleep path is set up only on apple,j714s, and only that board's DT has the warm-reset writes. Other boards and SoCs, the T8140 included, run none of the changed code.

Does not change

Not in this PR: wake on WLAN and wake from a paired Bluetooth device. The drivers implement neither (iw phy ... wowlan show returns EOPNOTSUPP), before and after this change; a configured radio wake needs a firmware sleep handover that does not exist yet.

Testing

J714s, this head plus private test/board-data commits only (no other code), built natively; Wi-Fi associated and Bluetooth powered before every sleep; RTC alarm about 29 s after entry.

Sleep Asleep / alarm due (s) SMC wake source After the wake
1 29.1 / 28.6 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
2 29.4 / 28.9 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
3 29.4 / 28.9 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
4 29.3 / 28.9 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
5 29.4 / 28.9 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
6 29.4 / 28.9 none (RTC alarm) Wi-Fi rejoined, Bluetooth l2ping 3/3
7 forced .enter refusal (after the replay) none back to normal; Wi-Fi rejoined, Bluetooth l2ping 3/3
  • Each sleep lasted until its alarm, within the RTC's 1 s resolution; the warm-reset replay ran before every entry (endpoint warm reset replayed before sleep).
  • After every wake the Wi-Fi interface and hci0 came back, NetworkManager reconnected, and the GPU, AOP, SIO and camera were back as before.

Without this change, on the same board and test setup, the same kind of run ended on wifibt in 5 of 6 sleeps in one run and 6 of 6 in another, up to 5.5 s before the alarm.

Not run on hardware: the refusal path when the warm reset itself fails (no fault injection).

Checks

  • A full cross build (make ARCH=arm64 LLVM=1 Image modules) of this commit with the M5 kit's configuration: links (vmlinux, Image, 1771 modules), no warnings in the touched files.
  • checkpatch (--strict): 0 errors, 1 warning (the author name against the sign-off's), 0 checks.
  • The board's native build of its test head for the run above.

🤖 Generated with Claude Code

On the J714s, a firmware sleep tears Wi-Fi and Bluetooth down without
arming any radio wake, but leaves the N1 firmware running without its
host. That firmware can then wake the system through the SMC's wifibt
wake source long before the sleep's own wake time; in our runs it did
so 16 to 28 s after the sleep's commit.

Let the N1's driver request the DT-provided warm-reset sequence for
this path. The host replays it in its noirq suspend, right after the
link shuts down. This is a warm reset before the sleep; no reset
signal is held asserted through the sleep. The existing reset and
firmware reboot at the wake are unchanged.

If the warm reset fails, refuse the sleep and restore the host before
returning the error: the PM core does not run the noirq resume callback
of the device whose noirq suspend failed. Recovery uses the existing
link and DART restoration and its lost-port handling, so the children's
noirq resume finds the port either up or marked unreachable.

This covers only a sleep in which no radio wake is armed, which is
every sleep with these drivers: they implement neither WoWLAN (magic
packet or patterns) nor a paired Bluetooth device wake, and those
remain unsupported.

Signed-off-by: Diljit Singh <[email protected]>
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