Repository navigation
phy: apple: atc-t6050: keep active combo PHY domains powered across s2idle - #2664
RyanTheTide merged 3 commits into
Conversation
|
The approach looks right: on s2idle, hold the active combo-PHY domains and DP tunnel gates out of genpd's system suspend, release exactly what was recorded at POST_SUSPEND (abort included), and select it all from what is active, with no switch. The J775c before/after, with no
Assisted-by: LLM (Claude:Opus 5.5) |
eebba1f to
843c5f5
Compare
|
Codex GPT-6.2 Sol on @satchlj's behalf The local revision moves the s2idle snapshot into the PHY's suspend_late callback under the PHY mutex and releases the recorded holds in resume_early, including the PM unwind after a successful late callback. It bounds both u8 masks and documents that the existing deep-sleep board gate is left for the deep-sleep work. The local revision compiled and the cand-11 trial containing it booted. It returned to known-good Aura with direct Thunderbolt connectivity. That boot did not exercise s2idle, so it does not establish the late-to-noirq ordering under live tunnel activity or validate resume/abort release on hardware. The earlier domain-hold and PHY restart observations apply to the earlier implementation. The separate link-training drop remains open. |
|
Codex GPT-6.2 Sol on @satchlj's behalf Updated to J775c cand-11 integration boot |
|
Re-review of 6fb5e78: Blockers: 1. Earlier points:
New in 6fb5e78:
Commits have a human Signed-off-by and no agent trailers. The PR body ends with the Assisted-by line. HW row: J775c on 6fb5e78 plus fix 1, default command line. Run 5 RTC s2idle cycles with an active DP tunnel through the XDomain/dock port, one cycle with the cable pulled while asleep, and one suspend abort injected after the PHY's late suspend. Pass: no PHY stop -62, no SError, no "Deferred DP tunnel clock" warning, the display comes back, and 0 AVC, 0 failed units, 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
|
J714s (Apple M5 Pro / T6050) combined-stack
Assisted-by: LLM (Gemini 4 Neon) |
|
Claude Opus 5.5 on @satchlj's behalf J775c (Mac Studio, M5 Max) rows for #2664 at head Stack.
Without this PR, the same stack and DTB:
With Limits.
|
|
Claude Opus 5.5 on @satchlj's behalf Current-tip J775c row for #2664 at
#2592 is closed in favour of this PR. |
|
Claude Opus 5.5 on @satchlj's behalf Follow-up to the current-tip row above (#2664): the same Image (
|
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at 6fb5e78: BLOCKERS. Not merging until the blockers below are fixed or answered; the details give file:line and a failure case. Full review#2664 phy: apple: atc-t6050: keep active combo PHY domains powered across s2idle @6fb5e78fVERDICT: BLOCKERS The head is unchanged since Ryan's re-review of 6fb5e78. Its blocker 1 is still open, and I reproduced it from the code. Blockers:
Nits:
Hygiene: both commits have only Missing rows:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at 6fb5e78f9b46b3c69c6032303f17c07c2f25b81b: REQUEST_CHANGES (1 open code blocker reproduced from source; CI host-tests: pass; mergeable/clean).
Blockers
- Deferred DP tunnel clock stop can outlive USB4/CIO mode and write
banks[39]MMIO after domains are powered off (drivers/phy/apple/atc-t6050-dp.c:622-634,:806-835,:864-876;drivers/phy/apple/atc-t6050-combo.h:431-434)- While
dp->s2idle_frozenis set, a rate-0 call toapple_t6050_dp_tunnel_clock()setsdp->s2idle_clock_stops |= BIT(clock - 1)and returns0(atc-t6050-dp.c:865-870), causingdcp_route_clock_rate()(drivers/gpu/drm/apple/dcp-fabric.c:479-480) to setroute->tunnel_rate = 0. atc_dp_tunnels_stop()(atc-t6050-dp.c:622-634), invoked fromcombo_stop()(atc-t6050-combo.h:151) andapple_t6050_phy_cio_off()(atc-t6050-dp.c:1313), zeroesdp->tunnel_rate[]and drops the gates, but does not cleardp->s2idle_clock_stops.- On resume,
combo_s2idle_release()(atc-t6050-combo.h:432-433) queuesdp->s2idle_clock_workontosystem_freezable_wq— the same workqueue used bytipd(drivers/usb/typec/tipd/core.c:1662,:2733), with no ordering guarantee. If the cable was unplugged while asleep andtipd'sresume_workruns first,combo_mux(SAFE)->combo_stop()tears down CIO toCOMBO_SAFEand powers off the PHY domains. atc_s2idle_clock_work()then runsatc_s2idle_clock_stop()->atc_dp_tunnel_apply(dp, i + 1, NULL)->atc_dp_tunnel_switch()(atc-t6050-dp.c:521-545), writingdp->banks[39](ATC_CFG_DP_SWITCH/ATC_CFG_DP_ENABLE) and pollingATC_CFG_DP_STATUSfor 10 ms outsideCOMBO_CIOwith the PHY domains off — risking an asynchronous SError.- A subsequent
apple_t6050_dp_tunnel_clock()call on that clock also hits the stale bit atatc-t6050-dp.c:872-875and performs the same switch write. - Fix: Clear
dp->s2idle_clock_stops = 0inatc_dp_tunnels_stop(), and inatc_s2idle_clock_stop()skipbanks[39]switch writes whendp->faulted || dp->combo_mode != COMBO_CIO(only releasingdp_gate[i]if still active, then clearing the bit).
- While
Checklist audit (§1–§4, §6) & non-blocking nits
- §1 / §2 / §3 / §4 / §6: Pass. No new chip/board/firmware gates (
combo_sleep_board()is pre-existing and noted atatc-t6050-combo.h:775); default-cmdline safe;u8bitmask widths are bounded at probe (atc-t6050-dp.c:1141-1143); both commits (843c5f5c,6fb5e78f) carry human-onlySigned-off-by: Satya Benson <satya@benson.earth>with no agent trailers; PR body ends withAssisted-by: LLM (Codex:GPT-6.2). - Nits:
atc-t6050-dp.c:812:atc_s2idle_clock_stop()calls single-clockatc_dp_tunnel_apply()instead ofatc_dp_tunnels_apply(dp, i + 1, NULL), diverging from the comment at:751-752and immediate stop at:777.- Adding a
dev_dbg()whens2idle_frozenrefuses a call with-EBUSYwould make any unexpected late/noirq caller visible. apple_t6050_phy_cio_finish()andapple_t6050_phy_cio_lost()are unfenced unlike the other CIO exports (deep-sleep only today; worth a brief comment).- Commit
843c5f5cdescribes the supersededPM_SUSPEND_PREPAREnotifier design replaced by6fb5e78f; squashing or rewording avoids a misleading bisect point.
§5 HW evidence needed after fixing the blocker
- J775c (default cmdline, isolated PR on current tip with the fix):
- 5 RTC
s2idlecycles with an active DP tunnel through the XDomain/dock port; - 1
s2idlecycle with the cable pulled while asleep (exercises thes2idle_clock_workvstipdSAFE ordering); - 1 suspend abort injected after
t6050_dp_suspend_late(). - Pass criteria: 0 PHY stop
-62, 0 SError, 0Deferred DP tunnel clockwarnings, display recovery, and 0 SELinux denials / 0 failed units / 0 new kernel errors.
- 5 RTC
- Additional T6050 combo-PHY board coverage (e.g. J716c or standalone J714s
s2idle+deepregression; the existing J714s row is a combined stack with#2007/#2592/#2557/#2739).
Assisted-by: LLM (Gemini 4 Neon)
|
Claude Opus 5.5 on @satchlj's behalf. @DjDeveloperr @RyanTheTide
Testing: Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Checked b0fb7aa. The first two commits are unchanged; only the new commit is added. Earlier points:
I found nothing new in the delta. Still needed before merge: the J775c rows at b0fb7aa on the default command line. Run 5 RTC s2idle cycles with an active DP tunnel through the XDomain/dock port, one cycle with the cable pulled while asleep, and one suspend abort injected after the PHY's Assisted-by: LLM (Claude:Opus 5.5) |
…2idle On T6050, t6050_dp_suspend_late() quiesces the combo PHY only for firmware deep sleep. During suspend-to-idle an active combo PHY keeps running, but genpd_suspend_noirq() still powered off its virtual genpd devices (atc1_phymxwrap among them) under the running PHY CPU. On resume, the first CIO-to-SAFE transition timed out with "PHY firmware stop failed: -62" and marked the PHY faulted, wedging the port (-5) until reboot. In t6050_dp_suspend_late(), on a suspend without platform support (pm_suspend_no_platform()), take a snapshot of the active domains and DP tunnel gates under the PHY lock and hold each of them out of genpd's system suspend with dev_pm_syscore_device(..., true), recording them in bounded masks. t6050_dp_resume_early() releases exactly the recorded holds, which also covers a suspend that unwinds after late suspend. Between the two, mode, tunnel-clock and CIO changes are fenced (s2idle_frozen), including from work that can still run after the freezer. A zero-rate tunnel clock request during the fence records a stop, so DCP can release the route; the stop runs after the thaw, or before the clock is used again, and its pending state is cleared only once the clock is parked and its gate released. The firmware deep-sleep handling (combo_pm_notify(), on the boards combo_sleep_board() names) is unchanged. Signed-off-by: Satya Benson <satya@benson.earth>
A tunnel clock that DCP asks to stop while the PHY is frozen for s2idle is only marked in s2idle_clock_stops, and the stop runs from s2idle_clock_work after the thaw. atc_dp_tunnels_stop(), which stops every clock when the PHY leaves USB4 mode, did not clear those marks. If tipd's resume work took the PHY to SAFE first (a cable pulled during the sleep), the deferred stop then wrote the tunnel switch registers in banks[39] and polled their status with the PHY out of USB4 mode and its domains off, and so did the next call for that clock. Clear the marks in atc_dp_tunnels_stop(), where every clock is stopped anyway. A deferred stop that finds the PHY out of USB4 mode, or faulted, releases only the clock's gate and writes no switch. It stops through atc_dp_tunnels_apply(), as an immediate stop does, rather than the single-clock helper. Also log, at debug level, a clock start refused while the PHY is frozen. Signed-off-by: Satya Benson <satya@benson.earth>
b0fb7aa to
56bc4eb
Compare
|
Claude Opus 5.5 on @satchlj's behalf. @DjDeveloperr Following your nit, I squashed
Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Checked 56bc4eb. It is a squash only: 02e964d has 6fb5e78's tree, and 56bc4eb has b0fb7aa's. The new message for 02e964d describes the final design, so the stale-message point is fixed. Left: the short comment on why Assisted-by: LLM (Claude:Opus 5.5) |
…fenced apple_t6050_phy_cio_finish() and apple_t6050_phy_cio_lost() do not check s2idle_frozen, unlike the other CIO calls. Say why in a comment: they write no PHY register and change no mode, clock or domain, and their one caller, the Thunderbolt host's CIO sleep, runs them only for a suspend-to-RAM it prepared (PM_SUSPEND_MEM), never across s2idle. No functional change. Signed-off-by: Satya Benson <satya@benson.earth>
|
Claude Opus 5.5 on @satchlj's behalf. @RyanTheTide
There is no functional change, and I did not build it. I also corrected the body: the one RTC-backed s2idle cycle there ran at Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. J775c row, 2026-11-23 15:58–16:10Z. This is DP alt mode (a USB-C→HDMI cable), not a DP tunnel, so the tunnelled deferred-stop path these rows target was not exercised. The kernel logged no Kernel:
Across all cycles: no New against the same kernel with no display attached:
Still owed:
Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. The DP-tunnel rows (5 × s2idle with an active tunnel, a cable pull while asleep, and an abort after Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review at fcb27ed757813ea4d386e217a1d5c5895e2501a4 against the pre-PR checklist (§1–§6): APPROVE.
Prior blocker & nits resolved
- Deferred DP tunnel clock stop outliving USB4/CIO mode (blocker from review
6011118748at6fb5e78f) — RESOLVED in56bc4ebcfb53:atc_dp_tunnels_stop()(drivers/phy/apple/atc-t6050-dp.c:628) now clearsdp->s2idle_clock_stops = 0underdp->lock.atc_s2idle_clock_stop()(atc-t6050-dp.c:819-823) skipsbanks[39]switch writes whendp->faulted || dp->combo_mode != COMBO_CIO(releasing onlydp->dp_gate[i]if present) and stops viaatc_dp_tunnels_apply(dp, i + 1, NULL)when inCOMBO_CIO, matching the immediate-stop path.
- All 4 prior nits resolved:
- Deferred stop uses
atc_dp_tunnels_apply(dp, i + 1, NULL)(56bc4ebc). - Refused clock start while frozen logs via
dev_dbg()(atc-t6050-dp.c:878,56bc4ebc). - Unfenced
apple_t6050_phy_cio_finish()/apple_t6050_phy_cio_lost()asymmetry is clearly documented (atc-t6050-dp.c:1375-1382,fcb27ed7). - Superseded
PM_SUSPEND_PREPAREcommit squashed into02e964d1with an accurate commit message.
- Deferred stop uses
Checklist & integration verification (§1–§6)
- Merge / tip interaction: Merges cleanly onto current
integration/aurora(880a97a3dca2), not superseded; orthogonal to468200cd4c5d(combo_dp2_join_usb()runs insidecombo_mux(), which is fenced bydp->s2idle_frozen). - Live CI:
host-testspassed atfcb27ed75781(run 45072567685). - §1 / §2 / §3 / §4 / §6: Pass cleanly. Hardware-state driven (no new chip/board/firmware gates; pre-existing
combo_sleep_board()deep-sleep gate documented atatc-t6050-combo.h:774-777), default-cmdline safe, boundedu8bitmasks, all 3 commits carry human author/committer +Signed-off-by:only with zero AI commit trailers, PR body includesAssisted-by:. - §5 Evidence (non-blocking note): J775c DP-alt row on
56bc4ebc + fcb27ed7(5/5 RTCs2idle, cable pull while asleep,pm_test=platform, 0-62, 0 SError, 0 failed units), earlier J775c default-cmdline A/B (5a2b7d50vs8281ecb1), and J714s combined-stack TB-dock 3/3s2idle+ 1/1deeprows are on record. Becauselobatahas no TB/USB4 dock, the active DP-tunnel deferred-stop and injected-abort rows remain to be run on a TB/USB4-dock M5 Mac (e.g., J714s/J716c).
Assisted-by: LLM (Gemini 4 Neon)
Problem
On T6050,
t6050_dp_suspend_late()only quiesces the combo PHY for firmware deep sleep (pm_suspend_no_platform() == false). Durings2idle, an active combo PHY remains running, anddrivers/thunderbolt/apple.cholds ACIO's virtual genpd devices out of system suspend withdev_pm_syscore_device(..., true).However,
combo_pm_notify()indrivers/phy/apple/atc-t6050-combo.hwas gated oncombo_sleep_board()(j714s/j716c) and only helddomain[0]during firmware deep sleep. Durings2idle,genpd_suspend_noirq()powered off active combo PHY virtual genpd devices (includingatc1_phymxwrap) under the still-running PHY RTKit CPU. On resume, the first CIO-to-SAFE transition timed out withapple-t6050-dp-phy 2ab000000.phy: PHY firmware stop failed: -62and marked the PHY faulted (dp->faulted = true), permanently wedging the port (-5) until reboot.Fix
combo_pm_notify()for allapple,t6050-combo-phyinstances (not gated oncombo_sleep_board()).PM_SUSPEND_PREPAREwhenpm_suspend_no_platform()is true (set inenter_state()beforesuspend_prepare()invokes notifiers, merged in T6050: a "freeze" with mem_sleep at deep is a suspend-to-idle (no dock teardown, no -67) #2510), hold every activedp->domain[]anddp->dp_gate[]virtual genpd device out of system suspend withdev_pm_syscore_device(..., true)and record the held devices in bitmasks (s2idle_domain_syscore,s2idle_gate_syscore).PM_POST_SUSPEND, release every device recorded in those bitmasks unconditionally (covering both normal resume and suspend abort viapm_notifier_call_chain_robust, independent of whetheractivechanged in the meantime).Hardware verification (J775c / Mac Studio M5 Max, T6050, ATC1 XDomain,
s2idle)Tested on
cand-11(8f345b748824) on the default command line (s2idle_teardown=N) acrossrtcwake -d rtc0 -m freeze:apple-t6050-dp-phy 2ab000000.phy: PHY firmware stop failed: -62(dp->faulted = true), leaving the PHY wedged (-5) even after a USB-C PD replug succeeded.pmgr-pwrstatedynamic debug confirmed zeroatc1_phymxwraporatc1_*power-off transitions acrosss2idle(only idleatc0/2/3_phymxwrapcycled).10ee7606-bb95-48ac-aae9-022620fed01f), post-resumeset cable state: 0cleanly receivedPHY firmware ep20: 8000010000000001(zero-62), cycledatc1_phymxwrap0x0 -> 0xf, and restarted2ab000000.phytoCIO mode up: UC_TNBL_DONE (0), reverse orientation, 11 ms.drivers/phy/apple/atc-t6050-dp.obuilds cleanly onintegration/aurora107047f61826.(Note: This PR fixes the combo PHY
s2idledomain power-off and-62stop wedge. On the J775c↔macOS XDomain pair,2a9ac0000.aciostill hitsTraining TO HL0 -> Dead End~2 s intos2idleseparately; that link-drop cause is being isolated independently.)Review follow-up at 6fb5e78 (now squashed into
02e964d1, same tree; the deferred-stop blocker fix is56bc4ebc): the late snapshot and mutation fence now share the PHY mutex. Early resume releases the saved masks. Zero-rate requests during the fence are queued for stop after thaw, and a pending stop must complete before reuse. The deep-sleep board gate remains separate.The
6fb5e78frevision (now02e964d1, same tree; before the deferred-stop fix56bc4ebc, so not the current head's tree) completed one RTC-backed XDomain s2idle cycle on a cand-11 J775c integration build with 1 success and 0 failures, no logged ATC1 PMGR power-off and no PHY stop -62. The HL0 timeout still dropped the link. An active DP tunnel, injected suspend abort and matched forced PHY restart were outside this run.Assisted-by: LLM (Codex:GPT-6.2)