Repository navigation
soc: apple: sleep: clock back the PCIe ports no host restores after a wake - #1966
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks. Two things.
apcie_port_clocksis a module parameter that picks between the old and the new wake behaviour, and we don't merge those any more. Where the behaviour applies, it should simply be on.- To your question: keep the port handling in the host (#1962's second commit) and drop this one. The exception is a measured wake showing that the DARTs need their port clocks before the host's noirq resume runs; in that case, say so in the commit message and keep only that part. Two places re-clocking the same ports after a wake, in different orders, are harder to reason about than one.
It's also worth saying in the description that this is inert on our tree today. It acts only on a T8132 host without apple,managed-sids, and every T8132 board inherits that property from t8132-jxxx.dtsi. So it follows whatever is decided on #1962.
bf2a2ea to
20b8779
Compare
|
Pushed 20b8779: |
|
Blockers: 2.
The description says this "clears the PHY glue's reference-buffer-off bit that the commit set", but HW row: none can prove this on the current tree. Every T8132 board inherits Assisted-by: LLM (Claude:Opus 5.5) |
… wake A real sleep takes the APCIe block's power, and the commit path stops port 0 first: its application clock and its PHY glue clocks go off. On the wake apple_sleep_raise_apcie() brings the shared block back as the loader set it up at boot, but not the ports. Where the managed radio contract is in force the radio's host restores its port before the DART, and where a host calls apple_dart_set_host_resumes() the DART waits for it. A host with neither, as on the J604 with its radio port and SD card port, leaves the ports unclocked, and the DART in each port's unit, clocked by the port, aborts the first register read its resume makes even though its power state reads on. When PCIe's node has no apple,managed-sids, give each port it names (port0/phy0, port2/phy2) its application clock and PHY glue clocks back in the loader's order, right after the shared block. PERST# and the link stay as the wake left them; the host still owns retraining. If a PHY glue clock doesn't ack, stop there, before the reset release and the PHY enables, as the shared block's raise path does for its own clocks. The wake's report names the port. This acts only on a T8132 host without apple,managed-sids. Every T8132 board in the tree inherits that property from t8132-jxxx.dtsi, so it is inert there. Signed-off-by: Dylan Ironside <[email protected]>
20b8779 to
f8a3c10
Compare
|
Both fixed at f8a3c10.
I dropped the reference-buffer sentence from the description: this code doesn't write that bit. Agreed on the HW row: nothing on the current tree reaches this code, so I have no row to offer. Rechecked on 5b596e6: checkpatch --strict 0 errors, 0 warnings, 0 checks; |
|
Re-review of f8a3c10: No blockers. Points from the last review:
Nothing else changed since the last review. The code is still unreachable on the current tree (every T8132 board inherits Assisted-by: LLM (Claude:Opus 5.5) |
|
The description now ends with the full line, vendor and model included. Agreed on the HW row: none is possible while every T8132 board inherits |
4c9f147
into
aurora-silicon:integration/aurora
integration/aurora now carries aurora-silicon#1966, which maps port 2 and its PHY on every host and gives their clocks back after a wake on hosts without the managed radio contract (apcie_ports_unowned). This branch maps port 2 only when the host has an available pci@2,0, so that the stop at the commit never touches port 2 on a host that doesn't use it. Conflict in drivers/soc/apple/sleep.c, in the struct and in apple_sleep_map_apcie(). Keep both: port 2 is mapped on every host as integration/aurora does, so the clock restore from aurora-silicon#1966 is unchanged, and the "available pci@2,0" test moves into a new apcie_port2_enabled flag that sleep_apcie_port2_stop_once() checks. The stop still runs only on a host that describes and enables port 2. Nothing else conflicts. Signed-off-by: Dylan Ironside <[email protected]>
A real sleep takes the APCIe block's power, and the commit path stops port 0 first: its application clock and its PHY glue clocks go off. On the wake
apple_sleep_raise_apcie()brings the shared block back as the loader set it up at boot, but not the ports. Where the managed radio contract is in force the radio's host restores its port before the DART, and where a host callsapple_dart_set_host_resumes()the DART waits for it. A host with neither leaves the ports unclocked, and the DART in each port's unit, clocked by the port, aborts the first register read its resume makes even though its power state reads on.When the PCIe node has no
apple,managed-sids, this gives each port it names (port0/phy0,port2/phy2) its application clock and PHY glue clocks back in the loader's order, right after the shared block. PERST# and the link stay as the wake left them; the host still owns retraining. If a PHY glue clock doesn't ack, the sequence stops before the reset release and the PHY enables, and the wake's report names the port. There is no parameter.Measured on the J604 (MacBook Pro 14" M4, T8132): on our 1.922 this commit and the first commit of #1962 together took the J604 from dying in resume to its first full deep sleep and wake (back alive on the same boot, Wi-Fi, Bluetooth, audio, NVMe and display back; the panel lighting again at a key press on the lock screen after a sleep that began with it blanked is not proven yet). In that kernel the host relink did not yet clear the reference-buffer bit, so this commit is what cleared it before the ports got their reference clock. On our 1.923, with both of #1962's commits, the J604 slept three times in a row on one boot, the last for 10 minutes, with no reset (2026-11-15).
Open item (updated 2026-11-15): on our 1.922, about 7 minutes after the first full wake, the resumed system cold-reset while our tooling reloaded a module; the same steps on a boot that had not slept did not. The earlier guess that the wake leaves kernel text write-protected is ruled out (kernel text writes after a wake returned on 1.922 and on 1.923). On our 1.923 the same steps, replayed one at a time on a resumed boot, did not reset it; one clean replay does not prove it gone, so we will call it gone after three (details on #1961).
Where this goes: as asked, the port handling moves into the host on #1962, and this PR stays open until #1962 has it. It acts only on a T8132 host without
apple,managed-sids; every T8132 board in Aurora's tree inherits that property fromt8132-jxxx.dtsi, so on that tree it is inert and follows what is decided on #1962. Every wake we measured ran with both this and the host relink in, so we have no measured wake showing the DARTs need their port clocks before the host's noirq resume, and this does not claim it.Checked on top of
integration/aurora5b596e6: checkpatch --strict 0 errors, 0 warnings, 0 checks;drivers/soc/apple/sleep.obuilds with W=1, no warnings.Tested on the J604 only: our linux-aurora-next 1.922 and linux-aurora 1.923 carry it with the parameter (on by default). This version drops the parameter and checks the clock acks. It has not run on the J604, and on the current tree it can't: every T8132 board inherits
apple,managed-sids, so the new code isn't reached.Assisted-by: LLM (Claude:Opus 5.5, Claude:Fable 5.2)