Repository navigation
soc: apple: sleep: T6040 (M4 Pro, J616s) suspend-to-RAM - #2215
Conversation
38fea0c to
84ab831
Compare
|
Thanks for this series and the clear before/after table. The entry is fail-closed where it matters: display words that stay up, or a missing storage link, refuse the sleep and undo it. We select behaviour by a hardware property rather than by the machines it was tested on, so three things before it can go in:
A suspend-to-RAM row on our own J616s will be the deciding evidence; we'll schedule one on the head once these are addressed. |
|
Thanks for the review. All three are addressed in fast-forward commits on top of 294fd14 (no force-push):
Also in this push:
Checks: every commit builds, |
|
The T6040/T6041 sleep paths in drivers/gpu/drm/apple/dcp.c use a series of fixed waits: msleep(20) after dcp_s2r_stop_streams(), msleep(50) before a readl_poll_timeout() on the same power word, msleep(100) and msleep(25) around the HDMI converter rail and DP PHY in dcp_t6040_fixed_phy_up(), and DCP_S2R_SETTLE_MS/WORDS_MS/STOP_MS documented only as "as measured". Each of these should either wait for the state it is covering (coprocessor status, power-word readback, HPD/link up) with a bounded poll, or cite the hardware/firmware requirement for the value; a delay that cannot be justified should be removed. Fixed waits tuned on one machine tend to fail on the next one. Until then this should stay a draft. |
|
One more commit on top: bbdd785 "arm64: dts: apple: t6040: Add the display clock". The T6040 DCP had no clock, so the firmware's getClockFrequency(0) returned 0 Hz and every start of the internal DCP, at boot and after each wake, logged checkpatch --strict clean, dtbs_check on t6040-j616s adds nothing; two suspend-to-RAM cycles on J616s with the panel, Type-C and HDMI displays back each time and the message gone. |
Thanks, agreed. I sampled the registers each wait could be covering through the unchanged waits over three sleeps on J616s, then replaced them in four fast-forward commits on top of bbdd785 (no force-push):
Tested on J616s with the panel, a Type-C display and an HDMI TV: four suspend-to-RAM cycles in one boot. All three displays came back each time, the panel's backlight level round-tripped, and none of the new timeout messages appeared. checkpatch --strict is clean and every commit builds. Two short waits in the firmware stop are still there: |
|
Thanks, this is what we hoped for. The waits now end on the power words, the idle state, the panel's hotplug report and HPD, and our earlier three points (the board string, the T6040 machine check, the sleep_untested flag) are gone on a10965d. Three small things for when it leaves draft:
We'll run the J616s suspend-to-RAM row once it's ready. |
a10965d to
4e2ca17
Compare
Thanks. Before taking it out of draft I reworked the whole series and force-pushed it: a10965d is replaced by 4e2ca17, on the same base (0abc2f3). The 92 development commits are now 19 logical ones: the bindings first, then the SMC, DART, NVMe, PMP, MCC, sleep driver, PHY, dwc3, GPU and display changes, then the DT. Each commit builds on its own. Your three points
Other changes from two full reviews of the series
Correction In my earlier comments I said
Both are fixed now. apple,pmgr.yaml gets the property in its own patch. On every commit, checkpatch --strict reports only:
Tested on J616s at 4e2ca17 (full kernel build, Rust included), with the panel, a Type-C display and an HDMI TV: five suspend-to-RAM cycles in one boot.
That's everything I had for it. It's ready for your J616s suspend-to-RAM run whenever you can schedule one. |
|
Thanks for the rework and for the correction on checkpatch and dtbs_check. On 4e2ca17 our three points are covered: the 4-5 ms gap is now a wait for no call in flight before the idle, the 5-6 ms wait is Two things before our run: GitHub reports the branch as conflicting with integration/aurora, so please rebase it, and take it out of draft when you're ready. We'll then run the J616s suspend-to-RAM row on that head and post it here. |
|
J616s row on 4e2ca17, merged onto a current integration/aurora build (the only conflict was Result: the kernel hard-hangs early in boot, so no sleep row ran. The sleep controller probes ( Bisection, one boot each:
That port has a USB4 host-to-host link to another Mac (mux state 4 = Suggestion: when Happy to run the full row (s2idle x2, deep x5, s2idle after deep, GPU smoke) on the next head. |
A SoC whose own display_off op takes its display pipes down needs no entry in apple,display-coprocessors, and the core then never marks display[0] bound. Accept ndisp == 0 in the profile check, and only refuse for an unbound display coprocessor when the profile names one. These are the same two hunks as in the T6040 profile (aurora-silicon#2215), so the two branches merge without a conflict in either order. The T6030 profile that follows has ndisp == 0. Signed-off-by: Aron van de Pol <[email protected]> Assisted-by: LLM (Claude:Opus 5.5) Claude-Session: https://claude.ai/code/session_016eHgyJKRZBHRz41DTDHS7m
|
Follow-up on the same J616s: I retested with a local one-hunk guard in But about 3 s after So with a live USB4 link on the port, something in the reworked PHY/dwc3 bring-up still touches the shared CIO side: the USB3/PHY power-up, a reset, or a power domain. On the same machine, the integration PHY driver binds that port and the link stays up. The other two ports bind fine with this branch. Repro: any T6040 port with a USB4 host-to-host (or USB4 device) partner at boot. Happy to run the next head; the full sleep row is ready to go once it boots. |
|
Thanks for the bisection and the guard test. They narrowed it down. Your guard stops Why the CIO branch didn't take the state: it runs only with the CIO tables and an enabled router whose 32af9dc (fast-forward, no force-push) "phy: apple: t6040: Leave a USB4/Thunderbolt port's lanes alone without CIO here":
checkpatch --strict clean apart from the Reported-by tag's missing Closes: link, W=1 adds nothing. My J616s has no USB4 partner, so the USB4 case is untested here. Could you run it on your head with the host-to-host link? I'll also move the router match to whatever links the integration acio node to its PHY, so that such a port gets CIO from this driver as on integration, instead of only being left alone. On the rebase: the branch has to be rewritten onto integration/aurora (macsmc as you resolved it; |
|
Thanks for tracing the bind-time path. On 32af9dc the hang we reported is closed in code. Two things in the new commit:
Still open from before: the branch conflicts with integration/aurora and is in draft. A rebased head is fine. We'll run these J616s rows on it:
Assisted-by: LLM (Claude:Opus 5.5) |
|
@fbalazsy, a tidy-up pass over the open PRs here. These of yours need something:
If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks! |
The T6040 (M4 Pro) enters suspend-to-RAM through the same SoC sleep engine as T8140 and T6050, with three CPU complexes, five display pipes and two storage PCIe lanes. Describe the registers its entry and wake write, in the same shape as apple,t8140-sleep: the CPU start/stop block, the AON watchdog, the CPU complexes' control words, the power gate and retention voters, the PMU's SPMI controllers, the S2R timer, the SOC-East and SOC power-word pages, the wake control, the display pipes' gate and PMC voters and the keep-alive enables. apple,check-ps-b4-sleep lists, per display pipe, the power words that have to read off before the sleep engine is armed. apple,pinctrl names the AP pin controller whose pins the wake restores. Signed-off-by: fbalazsy <[email protected]>
The T6040 and T6041 display complexes are lowered and raised around a sleep by the display driver as T8140's is, but they have an internal pipe and two (T6040) or four (T6041) external pipes, split over a second PS and power-gate page, with a clock protection table (gapf) and the display bridge words. Add both compatibles and their register windows. Signed-off-by: fbalazsy <[email protected]>
Some PMGR blocks have power state registers that only take non-posted writes: the T6040 display PMGR's DISP_CPU word is one. The syscon maps the block with of_iomap(), which honours nonposted-mmio. Allow the property. Signed-off-by: fbalazsy <[email protected]>
Two SMC keys take part in a T6040 sleep: - WKTP, the wake type: the T6041 SMC takes 2 ahead of the other sleep notices, and 0 once a wake is a full one. Without the 0 the SMC treats all the time awake as a power nap; without the 2 it does not run the sleep as one. Write it for the T6041 SMC, and only around a sleep that sent the notices. - pmVC, the VDD_CIO rail request: the SMC drops the rail during the sleep transition unless it was asked for it, and the sleep engine's hand-over of the ATC ports then races the loss. Export apple_smc_request_pmvc() for the sleep controller, which sends it in its .begin, ahead of the device suspend. Signed-off-by: fbalazsy <[email protected]>
The T6041 display DARTs are locked by the display firmware, so the driver's own suspend neither saves nor restores their TCR and TTBR words, and after a real sleep the panel stayed black with everything else up. Add apple_dart_display_keep(): it saves the words of the given streams before the sleep, into per-DART storage under the DART's lock, and writes back after it only what changed, before the display firmware runs again. Streams the DART doesn't have are ignored and nothing past them is read; a restore without a save fails with -ENOENT. Add apple_dart_display_streams_idle(), for the display driver's stop: after apple_dart_display_streams() turned the streams off, it checks that they read disabled and polls until the DART has no TLB command and no transaction outstanding, so the blocks behind it can be powered down without a fixed wait. apple_dart_idle() is split for it so that a pending fault doesn't hold the drain up. Co-developed-by: AxxzyWasTaken <[email protected]> Signed-off-by: AxxzyWasTaken <[email protected]> Signed-off-by: fbalazsy <[email protected]>
The T6040 runs the T8132 ANS controller. Give it T8140's sleep values, as T8132 runs them: the traced firmware stop, a flush of namespace 1 and the same CC.SHN value (both bits set). After a sleep that cut the power its firmware takes the whole endpoint map echoed as the last reply of the warm restart, RTKit's default, so sleep_epmap_last_mask stays 0 instead of T8140's BIT(0). The firmware stop, the cold restart after the wake and the full endpoint map ran on the M4 Pro (J616s) across suspend-to-RAM cycles, with the root filesystem on this controller and its reads and writes checked after every wake. The controller data is shared with every apple,t6041-nvme-ans2 controller, which is the same block. Signed-off-by: fbalazsy <[email protected]>
apple_pmp_report_sleep() withdraws every request it knows of and then waits up to 50 ms for the PMP to stop acknowledging them. On T6040 that includes the always-on CPU cluster entries, and the cluster the boot CPU runs this on can't be released while it does: every sleep ran out the wait and warned PMP still acknowledges withdrawn requests 0x63c00 (ack 0x400) with only pmp-eacc0 (bit 10) left. Keep withdrawing these requests, but leave the always-on entries out of the wait. Nothing in Linux turns their blocks off; whatever the PMP does with them happens at the sleep's commit. Signed-off-by: fbalazsy <[email protected]>
Like T8142's, the J616s ADT has no skip-mcc-off-to-s2r. After a wake every plane of its cache reads 0 ways enabled and 0 powered, so the resume found plane 0 not ready and left allocation off until the next boot. Take the T6041 MCC through the deep sleep as T8142's: ways off after the write-back, and the boot's way count back at the wake before allocation is enabled again. Signed-off-by: fbalazsy <[email protected]>
… sleep On a T6040 Type-C port in USB4/Thunderbolt, the PHY takes CIO down for a system sleep and the Type-C controller brings it back after the wake, when it reads the port again and sets the mux. dwc3-apple restarts a controller that ran before the sleep from its own resume, which can come first: with a USB4 partner attached, the core soft reset then runs on a port with nothing under it, times out, and the port's genpd prepare keeps failing, so every later sleep is refused. Before the USB2 device mode, the controller of such a port never ran (a device role was taken as no role), so nothing restarted at wake. Now a device role from a USB4 partner starts it, and the order shows up. Have the T6040 PHY keep the controller in reset with -ENOLINK from the moment CIO goes down for a sleep until the next mux set, and let the T6040 glue take that as the wait for the PHY that the T6050 start after sleep already has: the start is left to the role switch that the Type-C controller sends right after the mux set. A port without CIO never sees -ENOLINK, so its start after sleep is unchanged. Reported by RyanTheTide, J616s with another Mac on a USB4 cable. Signed-off-by: fbalazsy <[email protected]>
|
@RyanTheTide the fix for the USB4-partner regression is pushed: What it does: when the T6040 PHY takes CIO down for a system sleep, it now keeps the port's controller in reset and returns At this head, on the J616s without a USB4 partner:
I can't exercise the CIO path itself here, so the live-peer row is yours again when you have time: boot with the other Mac on the USB4 cable, a few deep sleeps, and the @petrskuta this head has the fix, if you want to do the Studio Display run. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 26656c37
Blockers:
- Wait for the
29queued CI checks (apple-build,host-tests,kunit, KUnit suites,pr-text,readiness) to finish green at26656c37. - Re-run the lab J616s (
T6040) USB4-attached deep-sleep/resume row at exact head26656c37to confirm the DWC3/CIO resume ordering fix resolves the priorc2c9e3daUSB4-peer regression.
Checked: Delta commit 26656c377b (drivers/phy/apple/t6040-usb2.c, drivers/phy/apple/t6040-recovery-test.c, drivers/usb/dwc3/dwc3-apple.c) over 0f47f270.
Evidence
- Code audit (
0f47f270 -> 26656c37, 0 code blockers):drivers/phy/apple/t6040-usb2.c:tphy->cio_sleepis set undertphy->lockint6040_usb2_sleep()aftert6040_cio_down_locked(), checked int6040_usb2_reset_deassert()viat6040_dwc3_start_allowed()returning-ENOLINKbefore releasing DWC3 reset, and cleared undertphy->lockint6040_dp_mux_set()(andt6040_cio_remove()). Non-CIO ports never setcio_sleepand keep existing resume behavior.drivers/usb/dwc3/dwc3-apple.c: sets.sleep_cio_wait = trueondwc3_apple_t6040_hwsodwc3_apple_start_after_sleep()treats-ENOLINKas the existingsleep_phy_waitdeferral path until the Type-C controller re-sets the mux and sends the role switch.drivers/phy/apple/t6040-recovery-test.c: addst6040_sleep_cio_wait_testKUnit coverage.
There was a problem hiding this comment.
Verdict: FINISH at 26656c3
The T6040 PHY now holds controller start after CIO teardown and the DWC3 glue defers to the role-switch path. The predicate fixture and no-peer J616s cycles cover the defer flag and the ordinary port path. Please repeat the J616s live USB4-peer row and show mux and role-switch recovery, working USB, and consecutive deep wakes. Include detach across sleep if practical, because the wait also depends on the follow-up mux notification. Current hosted checks remain due.
|
@fbalazsy row at Your wait works: at the first wake the glue logs The difference from the boot is the USB2 PHY. At boot the device start on this port runs the USB2 sequence first: After any of the wakes, At the second wake the mux set came first ( Possible fixes, your call: clear Everything else after each completed wake: eDP connected, Wi-Fi ping 3/3, BT powered, NVMe 2.9 GB/s, vkcube OK, 0 GPU firmware crashes. The J616s was restored to its saved default afterwards. Full kernel log and per-cycle rows were kept. |
|
@fbalazsy thank you for all the rounds on this. To stop the back-and-forth we're merging #2215 as it stands at |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: per the maintainers' ruling this merges at |
There was a problem hiding this comment.
Verdict: MERGE at 26656c3 after hosted CI and the J616s no-USB4 row
Ryan waived the attached USB4 peer row for this PR. The remaining live-link failure is tracked in #3574 and stays with the follow-up. Keep exact-head hosted checks and the J616s boot, s2idle and deep-sleep regression without a USB4 device as merge gates.
|
@fbalazsy one more data point from the no-regression row at
I can't tell whether it needs the USB4 partner, because ours can't be unplugged remotely. Could you run a few s2idle cycles on yours without a partner? If it also hangs there, the wake IRQ or deep-WFI handling in s2idle is the place to look. If it doesn't, it's the partner case again, near the s2idle awake-path handling for a running PHY coprocessor. |
There was a problem hiding this comment.
Verdict: FINISH at 26656c3
Checked: The lab J616s with its USB4 peer attached failed two RTC s2idle wake attempts on this head and required recovery both times. The same machine woke from RTC s2idle on its saved Edge kernel. This supersedes my conditional approval because the new result concerns s2idle wake.
Blocker: Identify or fix the s2idle regression and post a successful exact-head comparison with the same RTC and attached topology. Keep the previously tracked deep-sleep issue #3574 in view when interpreting the results.
|
@fbalazsy paired comparison for the s2idle hang, same J616s, same USB4 partner, same method (console suspended,
So it comes with this series, and it isn't the Bluetooth or SD reader changes. Left in the diff for s2idle: the T6040 sleep profile (does any of it, e.g. deep WFI or the AIC handling, run on an s2idle entry?), |
…leep With a USB4 partner on a T6040 Type-C port, the controller of that port is stopped for a system sleep (its USB2 side powered off), then the PHY takes CIO down. After the wake the Type-C controller sets the mux, CIO comes back, and the role switch starts the controller. Its core soft reset then times out (-110), in the device and the host role alike, and from then on genpd refuses every sleep at prepare. The soft reset runs before dwc3_core_init() powers the PHY on. At boot the boot loader leaves the USB2 side running, so it passes; after the CIO sleep nothing has powered it again. Note at the sleep that USB2 was off, and power it up in the mode dwc3-apple selected before the next release of the controller's reset. dwc3's own power_on then finds it powered. Ports that never had CIO up are unchanged. J616s with a J473 on a USB4 cable, port in the device role: 5/5 deep s2r with RTC wake, no dwc3 errors, USB tree and USB4 link back after each (was: 2 wakes, then -110 and every later sleep refused). Link: aurora-silicon#3574
|
@fbalazsy a fix for the live-USB4 deep-sleep case (#3574) is ready, as one commit fast-forward from your head The cause, from an instrumented row: after the CIO sleep the controller's core soft reset runs before Row on the J616s with the J473 on the USB4 cable: 5/5 deep s2r with RTC wake, no dwc3 errors, USB tree, USB4 link and eDP back after each (was 2 wakes, then -110 and every later sleep refused). The tested build had the same code with a OK to fast-forward it onto |
There was a problem hiding this comment.
Verdict: FIX, then re-review at 22fc93081139
Blockers:
- Open J616s
s2idlewake regression (carried forward from26656c37): Paired testing on J616s (rtcwake -d rtc1 -m freeze -s 15, console suspended) wakes 3/3 onmain(ed00bd11) and hangs 4/4 on26656c37(still hangs withhci_bcm4377andsdhci-pciunbound). Keep this blocked until thes2idlefix lands on top and an exact-head J616ss2idlepass row is posted. - USB2 pre-power unwind gap in
22fc9308(drivers/phy/apple/t6040-usb2.c:3492-3504):t6040_usb2_reset_deassert()now powers USB2 on (t6040_usb2_on_locked()+tphy->powered = true) beforet6040_dwc3_reset_release_locked()and beforedwc3_core_init()takes aphy_power_on()reference:- If
t6040_dwc3_reset_release_locked()returns-EIO(t6040-usb2.c:3502),tphy->poweredstaystrue;dwc3-apple.c:986-1027then triesphy_set_mode(usb2_phy, PHY_MODE_USB_HOST)inrestore_usb2_mode, which fails with-EBUSY(t6040-usb2.c:482). - If
dwc3_apple_core_init()(dwc3-apple.c:1001) fails beforedwc3_core_init()callsphy_power_on()(e.g.,dwc3_core_soft_reset()fails),appledwc->core_activeis stillfalsesodwc3_apple_core_stop()only callsreset_control_assert()(t6040_usb2_reset_assert()). Becausetphy->poweredis alreadytrue,if (!tphy->powered)(t6040-usb2.c:3447) skips restoringPHY_MODE_USB_HOSTand leaves USB2 powered with nophy->power_countowner, locking the port out of host mode with-EBUSY. - Fix: roll back
t6040_usb2_off_locked()+tphy->powered = falsewhent6040_dwc3_reset_release_locked()fails after pre-powering, and track unadopted pre-power (cleared int6040_usb2_power_on()) sot6040_usb2_reset_assert()powers USB2 off and restores host mode ifdwc3_core_init()fails beforephy_power_on().
- If
- Exact-head hosted CI:
readinesswas cancelled at22fc9308; rerun the full hosted CI suite once thes2idleand unwind fixes are pushed.
Checked:
- Audited
22fc9308(drivers/phy/apple/t6040-usb2.c+20/-0) in context witht6040_usb2_power_on(),t6040_usb2_set_mode(),t6040_usb2_reset_assert(),t6040_cio_remove(), anddrivers/usb/dwc3/dwc3-apple.c:- Lock and runtime PM discipline in
t6040_usb2_reset_deassert()(PM_RUNTIME_ACQUIRE+guard(mutex)(&tphy->lock)) are sound. t6040_usb2_power_on()returns0cleanly whentphy->poweredis alreadytrue, anddwc3-apple.c:951selectsusb2_phymode beforereset_control_deassert()(L985), so the happy path matches the#3574J616s 5/5 live-USB4 deep S2R pass row.t6040_cio_remove()properly clearscio_sleep_usb2.
- Lock and runtime PM discipline in
- Checked for Apple material, tool attribution, private serials, and gating: clean.
Evidence
- Head:
22fc93081139(base: main,mergeable: MERGEABLE, incremental commit22fc9308+20/-0indrivers/phy/apple/t6040-usb2.c). - Unwind paths checked:
drivers/phy/apple/t6040-usb2.c:3405-3450,3467-3511,472-487;drivers/usb/dwc3/dwc3-apple.c:858-908,950-1033. - Hosted CI at
22fc9308:11P/1F/0Q(readinesscancelled).
t6040_usb2_suspend() took CIO down for every system sleep, s2idle included. On main its .suspend only keeps a running coprocessor's power domains on for s2idle, and s2idle wakes. With the teardown, the J616s stays in the s2idle loop with no wake (RTC alarm, 4 of 4 tries, reset needed), with or without a USB4 partner. Device suspend and resume alone (pm_test=devices) pass. Main's base on the same Mac wakes 3 of 3. Leave s2idle as on main: no CIO teardown, keep the domains of a running coprocessor on. Firmware-driven suspend and hibernation keep the teardown. J616s with a J473 on the USB4 cable: s2idle 5/5 then deep s2r 3/3 on the same boot, USB4 link, eDP and Wi-Fi back after each.
…port 22fc930 powers USB2 before a CIO port's controller start only after CIO went down for a sleep. The same soft reset timeout comes on any start of that controller after a stop while the port is in CIO: after an s2idle wake the Type-C controller revalidates the cable, the controller stops and starts again, and the core soft reset times out (-110) with USB2 off, three times in a row, after which the next sleep is refused. Note in power_off that USB2 went off while CIO was up, and power it in the reset deassert of the next start while the port is in CIO. The boot, where the boot loader leaves USB2 running, and ports without CIO are unchanged. J616s with a J473 on the USB4 cable: s2idle 5/5 then deep s2r 3/3 on the same boot, no dwc3 errors (was: -110 after the first s2idle wake).
There was a problem hiding this comment.
Verdict: FINISH at 448e9f5.
Checked: The s2idle path now keeps CIO up, and the change broadens USB2 pre-power to ordinary controller stops on a CIO port. The prior unwind blocker remains: reset release still returns on failure after setting powered, and the delta adds no cleanup for pre-power that the PHY core has not adopted. Cover both failure paths so host mode can be restored. Please post the current-head paired J616s RTC wake row with the attached topology and hosted CI.
|
Exact-head row at
After every wake: USB tree, USB4 link, eDP, Bluetooth, Wi-Fi and Vulkan were back, with 0 dwc3 errors and 0 GPU firmware crashes. The only kernel error was brcmfmac What the three commits on top of your series do:
|
448e9f5 powers USB2 in the reset deassert of a CIO port's controller start, before dwc3_core_init() takes it over with power_on. When that start fails in between (the reset release does not read back, or the core init fails and dwc3-apple asserts the reset again), no power_off comes for it: USB2 stays up and reads powered, the reset assert keeps the device mode, and set_mode() to host returns -EBUSY, so the port cannot go back to host. Track the early power-up until power_on adopts it. If the reset release fails, hold the reset again and power USB2 off; the reset assert does the same for a start that failed before power_on. Both then return the port to host mode and leave the next start powering USB2 first again. Successful starts are unchanged.
There was a problem hiding this comment.
Verdict: MERGE at cbb7738 after hosted CI and the planned J616s sanity row.
Checked: Both failed reset release and reset assertion before PHY adoption now hold controller reset and unwind early USB2 power. The PHY adoption clears the early flag, so reset assertion does not power off an owned PHY. If shutdown readback fails, the existing shutdown_failed guard keeps later mode and power operations fail-closed. The prior J616s wake evidence was at 448e9f5. Keep the exact-head boot and linked s2idle/deep sanity planned by SLEEP-2215.
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
|
Exact-head sanity row at
Separately, the data point you asked for on the s2idle wake regression: at Thanks for |
|
No-regression M4 Max (
|
What: suspend-to-RAM on the T6040 (M4 Pro, J616s): the sleep controller's entry and wake sequences, with the board data and register windows in the device tree, and the display pipes, Type-C USB hosts, PCIe ports, GPU firmware and radios brought back after the wake. Current
mainis merged in.Tested: J616s M4 Pro (T6040) at
5467f0f9f694, default command line: suspend-to-RAM 5/5 pass,suspend_statssuccess 5 fail 0, no err-level kernel line, connectors, Wi-Fi, SD, NVMe and Bluetooth back after every wake, 0 failed units. Builds with no new warnings (alsoW=1on the changed objects),checkpatch.pl --strictclean,dtbs_checkclean on all seven T6040/T6041 boards, the Apple display KUnit suite 146 of 147 pass and 1 skipped, the host tests fail only wheremainfails on the same toolchain. This run had HDMI attached; the panel and DP over Type-C were covered by the row at27adf9ac(5/5, three displays).dt_binding_checkis clean too.Risk: one-way (adds DT bindings) · M4 Pro; the shared Apple drivers it changes (sleep core, DCP, DART, PCIe host, NVMe, dwc3 glue, SMC, MCC, BCM4377, brcmfmac) run on all Macs
Not yet: other Macs (none here with these blocks; the T6040 sleep refuses a watchdog or a board it does not know, see below); hibernation is not part of this series.
Details
Adds the T6040 (M4 Pro, J616s) to the sleep driver in the way the T6050 is carried: the entry and wake sequences in
sleep-t6040.hwired to the core ops, with the board data and every register window in the device tree and the binding.On top of the sleep controller itself:
apple,pinctrlrestore (apple,pinctrl-skip-pinsfor the pins the sleep leaves alone);apple,sram-keep);Display. The internal and both external display pipes are stopped before the sleep and restarted after it by the display driver:
apple,t8140-display-powergains the T6041);USB. A Type-C port's xHCI host is kept over the sleep when nothing else uses the PHY: the PHY holds the controller in reset with its sides down, and at the wake the controller and the PHY are set up again and xHCI starts over, so the USB core reset-resumes the devices. They keep their device numbers and their block and network devices; nothing is disconnected or enumerated again. The power domains of the PHY and the controller go off during the sleep, so the root hubs do lose power and a reset-resume is the lightest resume available. A port that carries DisplayPort, a four-lane DP mode or USB4 is still stopped and started as before. The dwc3 glue now suspends and resumes asynchronously, so the hosts no longer wait for the display's resume.
Merge of
main. Four files conflicted; both sides are kept in each (details in the merge commit):hci_bcm4377.c: both sides stopped treating a deferred reprobe after a command timeout as a failure;dcp.c: the T6041 display power note andmain's iBoot-only probe, which returns before the note as it did onmain;pcie-apple.c: both new fields;mainreplaced the cold-train helper withapple_pcie_adopted_link_trained_by();t6040-usb2.c: this series' suspend, resume, freeze, poweroff and restore callbacks, now also callingmain's suspend-to-idle helper from.suspendand a new.suspend_noirq. The helper returns early for a sleep the platform takes part in, so suspend-to-RAM is unchanged.The PHY series includes a commit by @RyanTheTide (busy recovery domain handling), cherry-picked with his authorship.
The commit messages were later reworded without changing any tree:
17137a07e2c4and27adf9acwere3f6abac57c40and1c958d23, where the results below were recorded.Since the merge.
drm/apple: Report a display back to the T604x wake only on T604x:dcp_hotplug()completedt6041_pluggedon every DCP, butdcp_start()initialises it only after the T8132 firmware's early return, so a T8132 DCP and the KUnit hotplug fixture completed an uninitialised completion (the three failingapple-display-hotplugcases). It is now completed only wheredcp_t604x_relinks()is true, the only case in whichdcp_t6041_recommit()waits for it.Since the review.
soc: apple: sleep: t6040: Take the VDD_CIO request from the device tree: the SMC pmVC request is an optional DT property (apple,vdd-cio-request), documented in the binding and set to0x101on the J616s, instead of a value chosen from the board name. A board without it warns once and makes no request.drm/apple: Release the T604x display-power phandle on unload:dcp_unregister()now puts theapple,display-powerphandle the first DCP kept.PCI: apple: Drop the s2r_conventional parameter: whether the ports lose power in the sleep is now only the host's match data and its DT (no tunnel, no managed SIDs, no PIO DMA supplier, not root-bus only).drm/apple: Ask the T6040 Type-C PHY for its DP tunnel clock by name: the T6040 PHY exportsapple_t6040_dp_tunnel_rate()instead of defining the ATC PHY's symbols when that driver is not built, so both PHYs can be built together. The display driver asks the T6040 PHY first and the ATC PHY when the PHY is not the T6040's (-ENODEV).soc: apple: sleep: t6040: Refuse a watchdog the wake stub does not restart: probe fails when the DT's watchdog is not the AON one the wake stub restarts, instead of falling back to a resume that the watchdog would reset.soc: apple: sleep: t6040: Take the GP PCIe ports from the DT: the GP host's ports come from its child nodes (J616s: 0 and 1, as before); up to four.soc: apple: sleep: t6040: Pass the board's VDD_CIO request to the SMC: pmVC's value is the caller's; the T6040 sends the J616s's 0x101 only on the J616s and warns on any other board.smaller ones: the AOP power word listed twice, dwc3 match data checked, the unused Type-C PHY sleep wrappers dropped, the HDMI +5 V rail kept on when its PHY fails to come back (as the sleep entry leaves it), a comment on the SMC's polled replies after the noirq resume (the poll and the interrupt drain the mailbox under one lock), and two comment and kernel-doc fixes.
This series includes nine commits from #1664 by @AxxzyWasTaken (the G17 GPU sleep and the T6041 display stop/restart with its DART helper), cherry-picked unchanged with their original authorship, so that the series can be built and tested on its own. They will be dropped once #1664 lands.
Known: the longer resume is the USB core's reset-resume of the hubs behind the kept ports (port power-on and debounce times, about 0.4 s per hub level); the devices are usable as soon as it ends.
Evidence
At
17137a07e2c4(merge ofmain037f7bca6822into27adf9ac), J616s, 26.6.2 boot firmware, one-shot test boot with the default arguments pluspanic=10(loglevel=7instead ofloglevel=3 quiet):checkpatch.pl --stricton the four merged files againstmain: 0 errors, 0 warnings, 0 checks;apple-sleep 502888000.sleep-controller: deep sleep is the default,/sys/power/mem_sleep=s2idle [deep];systemctl --failed: 0 units; no SELinux on this install;After it, at the current head (the five commits above), not on hardware:
display.kunitconfig, arm64, LLVM): 147 cases, 146 pass, 1 skipped; the hotplug caseshotplug_connected,hotplug_forced_offandhotplug_without_hpdno longer oops;main;iomfb.obuilds withW=1and no warning;checkpatch.pl --stricton the five commits: 0 errors, 0 warnings, 0 checks.At
27adf9ac, J616s, 5 suspend-to-RAM cycles in one boot (rtcwake -m mem), with the panel, DP over Type-C and HDMI attached:rtcwakereturn code/sys/power/suspend_statsACL packet for unknown connection handle, one failed HCI command)Earlier, on the series before
mainmoved: two suspend-to-RAM cycles with a USB disk (read-only), an Ethernet dock and two external displays (DP over Type-C, HDMI):dpm_prepareThe internal panel (backlight restored), both external displays, the GPU and the graphical session, the PMP, the audio codec, NVMe, the USB disk and the dock's Ethernet came back.
dt_binding_checkanddtbs_checkfor the touched bindings are clean.