Skip to content

arm64: dts: apple: t6041-j575c: deep sleep on the Mac Studio - #3653

Open
7robertodantas wants to merge 18 commits into
aurora-silicon:mainfrom
7robertodantas:j575c-deep-sleep
Open

7robertodantas wants to merge 18 commits into
aurora-silicon:mainfrom
7robertodantas:j575c-deep-sleep

Conversation

@7robertodantas

@7robertodantas 7robertodantas commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What: Deep sleep (suspend-to-RAM) on the Mac Studio (J575c, M4 Max), on top of #3626: the J575c DT that turns it on (PCIe windows, SMC rail mask, port controller sleep states, display power chains, apple,no-refclk-gating on port 2), the display pieces a Mac without a panel needs (the internal DCP as a headless sleep host; the external DCPs restarted after the wake through #2215's T6040 path, opted in per chain with apple,dcp), a t6040-usb2 fix for a port the SoC's power loss leaves with a cold USB2 PHY, an atlantic fix so a failed resume doesn't hang the next sleep, and the #3694 fix for intermittent AQC113 10 GbE loss on wake (wait for PORT_LINKSTS_L2 before asserting PERST# in t6041-sleep, keep clocks ungated during S2R training and honor apple,no-refclk-gating in pcie-apple).
Tested: J575c M4 Max at c44c44441649 (7.3.0-1-155-ARCH, tree 3b05466f2f0b, on main 5a870d0f0b3f, default cmdline, aura 1.0.0b17-g1f77cab4 Stage 2): (1) standalone exact-head boot without #3626/diag: boots cleanly, all 10 PR DT properties live (/dcp@306e00000 headless sleep host enabled, apple,dcp chains 0–3, apple,no-refclk-gating on pci@2,0, apple,sleep-pmvc, apple,sleep-ssps), mem_sleep=[s2idle], s2idle 1/1 (rtcwake -d rtc1 -m mem -s 6), both displays (DP-2, HDMI-A-1), pci=9/9, end0 + wld0 UP, 0 new kernel errors, 0 WARNING/SError/DART faults; (2) same 7.3.0-1-155-ARCH kernel + #3626 DT (no diag): 3/3 consecutive deep wakes (rtcwake -d rtc1 -m mem -s 10, pci=9/9, aqc=1, end0=UP, wld0=UP, DP-2 + HDMI-A-1 back each cycle, 0 WARNING/SError/DART/L2 timeouts). Prior deep-sleep soak on 9d6e098ef736 (k154 with #3626 + diag): 84/84 consecutive rtcwake -m mem deep sleeps with 0 Ethernet losses. J616s M4 Pro 3/3 deep sleep carried over from #3666 (fresh J616s/J773g rows queued by reviewer).
Risk: one-way for the two new optional DT properties (apple,dcp and apple,no-refclk-gating bindings), two-way for the rest · J575c; shared code also reaches T6041/T6040 Macs (t6041-sleep L2 wait, pcie-apple S2R clock gating deferred until link up, t6040-usb2 after a deep sleep) and Macs with an AQC113 10 GbE controller (atlantic).
Not yet: none (second-generation J616s and J773g rows at the new head queued by reviewer). Closes #3694.

Details

Order. Merge after #3626 (#3276, #3421, #3670 and #3687 are now on main). This branch merges cleanly with main (5a870d0f0b3f). Without #3626 this PR changes nothing on the J575c's sleep: the sleep driver is not enabled and only s2idle is offered.

Updates since 9d6e098ef736:

  1. Merged main (5a870d0f0b3f) into the branch (no force-push), resolving the single conflict in drivers/gpu/drm/apple/dcp.h (keeping both dcp_t6041_s2idle() from main and dcp_t6040_relinks(struct apple_dcp *dcp)).
  2. tools/asahi/afk-compact-start-tests.py: added desktop_external field and dcp_desktop_external() stub matching dcp_dpavctrl_service_init() so host-tests compiles and passes (base + all 10 mutations verified).
  3. Ran exact-head standalone boot + s2idle 1/1 on J575c at c44c44441649 without arm64: dts: apple: t6041: enable deep sleep on every board, J575c too #3626/diag.

Review fixes since 13b3ede631ad:

  1. dcp.c (dcp_t6041_stop_one()): set keep_set = true in the relink && dcp_t6041_ext_keeps(dcp) branch, unwind if (keep_set) outside if (!external), and move dcp_s2r_put_darts() after the relink stream restore.
  2. aq_nic.c (aq_nic_start()): set AQ_NIC_FLAG_DPATH_UP only after all aq_vec_start() calls succeed, unwinding partially started vectors on error.
  3. Rebased cleanly onto main 352cd953c779 (past drm/apple: T6041 host-driven sleep on DCP firmware 27 #3687's fw 27 host-driven DCP sleep).

Fix for #3694 (AQC113 10 GbE lost on ~1 in 65 wakes):
Two root causes were found and fixed:

  1. t6041_gp_ports_stop() only polled !(v & APCIE_PORT_L2_BUSY) on +0x88 (which clears as soon as PME_Turn_Off is queued) and immediately asserted PERST# low. Live telemetry showed PORT_LINKSTS_L2 (BIT(6)) actually asserts 40–79 us later on all four GP ports (0x9b000001 -> 0x9b000345). Polling PORT_LINKSTS_L2 before PERST# (matching apple_pcie_t6050_port_l2()) lets the PME_Turn_Off/PME_TO_Ack handshake finish cleanly, and clearing both BIT(30)|BIT(31) clears the full REFCLKCGEN mask.
  2. J575c's ADT pci-bridge2 (AQC113) is the only GP bridge with no-refclk-gating, yet iBoot leaves PHY_LANE_CFG_REFCLKCGEN (BIT(30)|BIT(31)) set and pcie-apple enabled REFCLKCGEN and cleared PORT_APPCLK_CGDIS both at probe and in apple_pcie_hib_port_start() before PORT_LTSSMCTL_START. Keeping clocks ungated during S2R training until link up (matching T6050 / macOS) and honoring apple,no-refclk-gating at probe and after retraining keeps port 2 at lane_cfg 0x2300066f across all cycles.

Commits (18):

  1. net: atlantic: a sleep after a resume that failed
  2. phy: apple: t6040-usb2: power USB2 first after the SoC lost power
  3. soc: apple: display-gate: T6041 internal DCP without a panel
    4–6. drm: apple: dcp: DPAVCTRL ready by processor, internal pipe taken down at start, headless sleep host
    7–8. dt-bindings: display: apple,t8140-display-power (apple,dcp) + external DCPs back through T6040's path
    9–12. J575c DT: PCIe windows, SMC rail mask, port controller sleep states, display power chains and sleep host
    13–16. J575c: 10 GbE (AQC113, PCIe port 2) lost after some deep-sleep wakes until a restart #3694 fix: apple,no-refclk-gating binding, pcie-apple S2R clock gating + apple,no-refclk-gating, t6041-sleep PORT_LINKSTS_L2 wait + full REFCLKCGEN clear, J575c DT port02 apple,no-refclk-gating
  4. Merge origin/main (5a870d0f0b3f) into j575c-deep-sleep-v10
  5. tools/asahi: afk-compact-start-tests: stub dcp_desktop_external

Other Macs. J614c/J616c: no apple,dcp and internal DCP has a panel, so display paths are unchanged; apple,no-refclk-gating is opt-in per port. t6041-sleep L2 wait and pcie-apple training-phase clock ungate improve GP PCIe S2R margin on all T6041 Macs. J616s (T6040): dcp_t6040_relinks() still returns true for every DCP.

Evidence

Mac Studio J575c (T6041, M4 Max). Loader: aura 1.0.0b17-g1f77cab4 Stage 2 (one-shot trial).

Row Kernel / tree Result
Exact-head standalone (c44c44441649) 7.3.0-1-155-ARCH (tree 3b05466f2f0b = exact c44c44441649 on main 5a870d0f0b3f, default cmdline, no #3626/diag) boots cleanly, all 10 PR DT properties live, /dcp@306e00000 enabled, [s2idle], s2idle 1/1 (rtcwake -d rtc1 -m mem -s 6), DP-2 + HDMI-A-1 connected, pci=9/9, end0 + wld0 UP, 0 new kernel errors, 0 WARNING/SError/DART faults
Deep x3 post-merge (c44c44441649 + #3626 DT) 7.3.0-1-155-ARCH (same exact c44c44441649 kernel + #3626 DT, no diag) 3/3 deep wakes (rtcwake -d rtc1 -m mem -s 10), pci=9/9, aqc=1, end0=UP, wld0=UP, DP-2 + HDMI-A-1 connected every cycle, 0 WARNING/SError/DART/link not back/Boot code hanged/L2 timeouts
Deep x84 soak (#3694 fix + v9 review fixes) 7.3.0-1-154 = 8262e06b67a3 (same functional code as 9d6e098ef736 + #3626 09a077c3 + diag prints) 84/84 deep wakes, 0 failures; pci=9/9, aqc=1, end0 up in 12 s every wake, 0 link not back, 0 Boot code hanged, 0 L2 timeouts; GP port 2 phy 0x2300066f, PORT_LINKSTS_L2 in 40–46 us every stop; DP-2 + HDMI-A-1 back via #3687 host stop
Earlier deep x3 (pre-v9) 7.3.0-1-151 = 107ae633932d 3/3 deep, all peripherals + SEP back
Earlier standalone (pre-v9) 7.3.0-1-152 = 13b3ede631ad vs 7.3.0-1-153 (e6c7b032633c) boots, [s2idle], s2idle 1/1, warn/err set = main's
Earlier soaks (before #3694 fix) k148 / k150 (#3421's stop) 1 Ethernet loss in 60 and in 70 deep sleeps

Known and also on main: 1 power domains did not reach off before commit (each deep cycle), EDAC event-log source 9, speakersafetyd fails, devmotion6 -5, ASM3142 firmware -2 then probe on retry.

Checks at c44c44441649: checkpatch --strict 0/0/0 on new commit; 0 board-gate hits; afk-compact-start-tests.py PASS (base + 10/10 mutations); dcpext26-retrain-tests.py PASS; display-gate KUnit 62/68 pass (6 skip); dcp-display KUnit 205/206 pass (1 skip); pr-text pass.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@7robertodantas: thanks for the row on #3666, and sorry for the duplicate. I opened #3666 before I saw this draft. #3653 is the series, so I'm closing #3666 in its favour. Two things carry over:

  1. The J616s (M4 Pro) row you asked for here: PASS. M4 Max Studio (J575c) deep sleep, one series: SEP, sleep host, PCIe/SMC/display wiring, SEP guard #3666's tree was exactly this branch (cf0ec74) + arm64: dts: apple: t6041-j575c: enable the SEP, without Touch ID #3276 + soc: apple: t6041-sleep: restore GP PCIe ports 2/3 and display clusters #3421 + arm64: dts: apple: t6041: enable deep sleep on every board, J575c too #3626 + the SEP guard. On our J616s with a live USB4 link: s2idle 1/1 + deep 3/3 in one boot (boot object resumes 0 -> 3), with USB4, eDP, Wi-Fi, BT and NVMe back after each wake, 0 dwc3 -110, 0 firmware crashes. That covers your t6040-usb2 change on T6040. Details: M4 Max Studio (J575c) deep sleep, one series: SEP, sleep host, PCIe/SMC/display wiring, SEP guard #3666 (comment)
  2. The SEP guard is now its own PR, soc: apple: t6041-sleep: refuse deep sleep when no SEP can take it #3670. It's independent of the Studio series and protects every T6041 board. Your planned "deep with apple_sep unloaded" check fits it best; results on soc: apple: t6041-sleep: refuse deep sleep when no SEP can take it #3670 please, if you run it.

On the Ethernet loss (port 2 / AQC113 not training after a wake, then the hang in the next aq_nic_stop()): agreed, merge condition 1 stays open. If it helps, open your PCIe-retry + atlantic second-stop fix as its own PR (or push it to this branch). The atlantic part, which turns the hang into a clean loss, looks worth landing early on its own merits, and I'll review it. If you want a second pair of eyes on the training failure, post a link-state dump around the failed train (LTSSM/link-status words before and after PERST# release on port 2) and I'll compare it with ports 1 and 3.

@7robertodantas
7robertodantas marked this pull request as ready for review November 30, 2026 11:55
@7robertodantas
7robertodantas requested review from a team and DjDeveloperr as code owners November 30, 2026 11:55
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at c44c4444: not ready yet

Check Detail
CI at head ok 7 checks passed
Review ok approved by DjDeveloperr
Requested changes no review verdict FINISH at c44c4444
Hardware row at head ok in the PR body at c44c4444
Conflicts ok none
PR text ok Risk: one-way · for the two new optional DT properties (apple,dcp and apple,no-refclk-gating bindings), for the rest · J575c; shared code also reaches T6041/T6040 Macs (t6041-sleep L2 wait, pcie-apple S2R clock gating deferred until link up, t6040-usb2 after a deep sleep) and Macs with an AQC113 10 GbE controller (atlantic).

Areas: area:bringup, area:display, area:gpu, area:platform, area:usb

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 13b3ede6

Blockers:

  • Failed-stop DART unwind leak (drivers/gpu/drm/apple/dcp.c:12248-12255, 12372-12396): In dcp_t6041_stop_one(), when relink && dcp_t6041_ext_keeps(dcp), apple_dart_display_keep(..., true) is called on s2r_disp_dart and s2r_dcp_dart, but keep_set remains false (keep_set = !external;) and err_unwind: only clears keep_set inside if (!external). If stopping an external T6041 DCP fails (e.g., RTKit idle failure), both locked DARTs stay pinned with display_keep enabled across the aborted suspend. Also note err_unwind: calls dcp_s2r_put_darts(dcp) at line 12386 before the if (relink && powered_off && dcp->s2r_disp_dart) restore check at line 12394 — moving the if (keep_set) unwind outside if (!external) (with keep_set = true in the dcp_t6041_ext_keeps(dcp) branch) and placing dcp_s2r_put_darts() after the relink stream restore closes both issues.
  • Atlantic resume-failure NAPI hang hazard (drivers/net/ethernet/aquantia/atlantic/aq_nic.c:494-520): AQ_NIC_FLAG_DPATH_UP is set at entry to aq_nic_start(), before hw_multicast_list_set(), hw_packet_filter_set(), and aq_vec_start() (where napi_enable() runs). If atl_resume_common() passes aq_nic_init() and fails early in aq_nic_start() before napi_enable(), AQ_NIC_FLAG_DPATH_UP stays set and the subsequent aq_nic_stop() will still hang in napi_disable(). Setting the flag only once vectors are started (or unwinding partial aq_vec_start() on error before returning) closes that window.
  • Open merge-order prerequisites: #3276, #3421, and #3626 are still open (merge order stands).
  • Hosted pull_request CI workflows (Apple build and KUnit, Apple DRM KUnit, Device tree checks, Host tests, SEP source checks, pr-text) are all action_required awaiting maintainer workflow approval for this fork PR.

Checked:

  • drivers/phy/apple/t6040-usb2.c: usb2_cold = !tphy->powered in t6040_power_lost(), cleared on t6040_usb2_power_on() and t6040_usb2_reset_deassert(), cleanly powers USB2 before DWC3 soft reset after SoC power loss; already verified 3/3 deep sleep on J616s M4 Pro (#3666).
  • drivers/soc/apple/display-gate.c: nodes[T6041_PANEL] is safely NULL-checked in every t6041_enable loop, allowing headless internal DCP handoff on J575c while keeping laptop panel gating unchanged.
  • dcp_dpavctrl_service_init(), pipe_off_since_start, dcp_t6041_recommit(), Documentation/devicetree/bindings/display/apple,t8140-display-power.yaml, J575c DT (apple,dcp, apple,sleep-pmvc, apple,sleep-ssps, PCIe windows, display-power chains), and tools/asahi/dcpext26-retrain-tests.py: all consistent and well-scoped.
  • Hardware evidence: J575c 3/3 rtcwake -m mem deep sleep with both displays, Ethernet, SD, ASM3142, Wi-Fi/BT, 12 USB devices, and SEP (plus standalone s2idle 1/1 on main and J616s M4 Pro 3/3 deep sleep).
Evidence
  • Diff scope: +272/-40 across 13 files (ac4126ea..13b3ede6).
  • aq_nic_set_power(): !pci_device_is_present(self->pdev) early return cleanly avoids hanging firmware calls when the AQC113 did not come back on wake.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
When aq_nic_init() fails in atl_resume_common() ("Boot code hanged", a
controller that did not come back from a sleep), the resume returns with
the interface still running and the datapath as aq_suspend_common() left
it: interrupts freed and the NAPI contexts disabled. The next suspend, or
closing the interface, calls aq_nic_stop() again, and its second
napi_disable() on each vector waits for ever, holding the RTNL lock. On
the Mac Studio (J575c) this hung the deep sleep that followed a wake on
which the 10 GbE controller's link had not trained; with the link held
down on purpose, "ip link set end0 down" then blocks in napi_disable()
from aq_vec_stop().

Mark the datapath from the start of aq_nic_start() to aq_nic_stop(), and
make a stop without a start since then return at once. A start that
fails part way still sets the mark, so its caller's aq_nic_stop() undoes
it as before. A stop after a start is unchanged.

The same suspend then asks the absent controller's firmware for its
wake-on-LAN state and warns when the request times out
(hw_atl2_shared_buffer_finish_ack). aq_nic_deinit() already skips its
firmware request for a device that is no longer present; skip
aq_nic_set_power()'s the same way.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
At boot the boot loader leaves each port's USB2 PHY running, and dwc3's
core soft reset, which comes before its PHY power-on in dwc3_core_init(),
relies on that. A real suspend-to-RAM powers the PHY down with the SoC. A
host kept through the sleep has USB2 powered again at its wake
(apple_t6040_atcphy_sleep_power_up()), but a controller that is stopped and
started instead, such as a Type-C port in device role, then soft-resets
over a cold PHY and times out. Its next suspend is refused from the
prepare.

Do for it what a CIO port already gets: after power loss (a firmware wake,
or a resume from disk), the next reset release powers USB2 in the mode
dwc3-apple has selected before the core's soft reset. A port that was
powered through the sleep, and every s2idle or aborted sleep, is
unchanged.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
The Mac Studio (J575c, M4 Max) has no panel, so its device tree describes
none under the internal DCP. The boot loader hands that DCP over all the
same when the board asks for it as the sleep host (apple,sleep-host-stop),
and the display driver then keeps it to stop every display processor for
suspend-to-RAM before the display power chains go down.

Let the T6041 internal gate enable the DCP, its display and PIODMA when no
panel is described; the panel is enabled only where there is one. Boards
with a panel are unchanged.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
On desktop firmware the internal processor announces only the AV controller
on interface 5 and the deferred DP controller on interface 7, while an
external one opens four interfaces or more. The readiness check told the
two apart with dcp_has_panel(), so the J575c's internal processor, which
drives no panel, waited for interfaces it never opens and its start timed
out.

Tell them apart by the processor (dcp_desktop_external()). A processor
with a panel is internal either way, so nothing changes where there is a
panel.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
With no display (no panel, no HPD) the firmware of the J575c's internal DCP
takes its pipe down itself during start-up, with a D572(0), and Linux never
powers it on. A sleep then has nothing to power off: a second
set_power_state(0) gets no D572, and the stop for suspend-to-RAM timed out
waiting for one.

Mark the pipe off when that D572(0) comes outside a sleep on an internal
processor that has no panel and is not active, so that the stop takes its
"display already off" path. A processor with a panel is left alone, and
only the T6041 sleep reads the mark.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
…r the wake

The pipe of a processor with no display stays down after the wake too:
dcp_t6041_recommit() powered it on and then waited for a D575 hotplug that
such a processor never sends. Remember that the pipe has been off since
start-up, until anything powers it on, and leave it off after the wake: no
power-on, no mode set.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
A T6041 external display chain may name the display coprocessor it powers.
The driver then restarts that coprocessor after the wake from
suspend-to-RAM, as T6040 does for its external chains, instead of shutting
it down for good.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
…o-refclk-gating

Keep REFCLK and APPCLK ungated while retraining GP PCIe ports on S2R
resume, enabling clock gating only after the link reaches L0, matching
the T6050 / macOS training sequence. Previously apple_pcie_hib_port_start()
enabled REFCLKCGEN and cleared PORT_APPCLK_CGDIS before asserting
PORT_LTSSMCTL_START, right after PERST# release.

Also honor the DT boolean property apple,no-refclk-gating both at probe
(clearing iBoot's initial PHY_LANE_CFG_REFCLKCGEN bits) and after S2R
link retraining, so ports whose endpoint requires a continuous reference
clock (such as J575c's AQC113 on port 2) never have REFCLK gated.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
…in GP port stop

In t6041_gp_ports_stop(), polling APCIE_PORT_L2_BUSY on +0x88 only
waits until PME_Turn_Off is queued, not until the link has completed the
PME_Turn_Off / PME_TO_Ack handshake and entered L2. On J575c,
PORT_LINKSTS_L2 (BIT(6)) asserts 40-79 us after L2_BUSY clears; asserting
PERST# immediately interrupted the handshake before L2 entry.

Poll PORT_LINKSTS_L2 before asserting PERST# (matching
apple_pcie_t6050_port_l2()), and clear both BIT(30) and BIT(31)
(REFCLKCGEN) in the PHY lane config register.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
Set apple,no-refclk-gating on pci@2,0 (AQC113 10 GbE), matching the
J575c ADT pci-bridge2/no-refclk-gating property. Together with waiting
for PORT_LINKSTS_L2 in t6041-sleep and keeping clocks ungated during
S2R training in pcie-apple, this eliminates the intermittent AQC113
wake loss (aurora-silicon#3694): 84/84 consecutive deep-sleep wakes on J575c.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) and removed blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Dec 2, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole series. No blocking findings in the code. What I checked:

  • dpavctrl: dcp->desktop exists only on the 26.6 desktop firmware path, so switching from dcp_has_panel() to !dcp_desktop_external() changes only the panel-less internal DCP (the J575c). T6041 laptop panels and every T6041 external DCP keep their branch.
  • External DCP restart on T6041: only for chains that name their DCP (apple,dcp). The DART keep/restore now pairs on every path, including external ones, and the late dcp_s2r_put_darts() moved inside the block without leaving a double put.
  • pipe_off_since_start: set only for a non-external DCP with no panel, never powered on. It's cleared by iomfb_poweron(), and dcp_t6041_recommit() skips that DCP.
  • pcie-apple: clocks stay ungated through S2R training and gating comes back after link-up (apple_pcie_port_enable_cg()), with apple,no-refclk-gating honoured. A port that fails training keeps its clocks running, which only costs power.
  • t6041-sleep: the L2 wait runs only on ports whose link was up, and a timeout only adds to the existing "stop timed out" warning.
  • atlantic: AQ_NIC_FLAG_DPATH_UP (0x40 is free) makes a second aq_nic_stop() after a failed resume a no-op instead of a second napi_disable() hang. The vector loop now unwinds on failure.
  • t6040-usb2: a cold USB2 after power loss is powered before the core's soft reset, on any port.

Gates left before merge:

  1. Merge main into the branch. It conflicts now, and it builds on #3626, which needs the same. If you can't get to it within a day, say so and a maintainer will merge main in.
  2. The J575c row at the exact head on its own, without #3626's diagnostics. Your "Not yet" already lists it.
  3. Second-generation rows for the shared parts. The PCIe S2R clock change reaches every Mac that uses the deep-sleep PCIe restart, and t6040-usb2 changes on T6040. The J616s row came from #3666's older tree, before the PCIe clock commits. I've queued a J616s deep-sleep row (PCIe devices and USB come back) and a J773g one at the new head.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 2, 2026
Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>

# Conflicts:
#	drivers/gpu/drm/apple/dcp.h
dcp_dpavctrl_service_init() now checks !dcp_desktop_external(dcp)
instead of dcp_has_panel(dcp). Add the matching desktop_external field
and stub to the afk-compact-start-tests.py harness so the host test
compiles and passes.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge

Blockers:

  1. No build or test CI ran at merged head c44c44441649: apple-build, dt-checks, host-tests, KUnit plan, DWC3/ATC, and source were all SKIPPED (fork PR). Run CI (or post a local merge-tree build + dt-checks + host-tests receipt covering the updated afk-compact-start-tests.py and dcpext26-retrain-tests.py) at c44c44441649.
  2. Second-generation deep-sleep hardware row at this head for the shared PCIe S2R clock-gating changes (drivers/pci/controller/pcie-apple.c and drivers/soc/apple/t6041-sleep.c): the cited J616s row from #3666 predates those commits, and Not yet: notes the fresh J616s/J773g rows are still queued. (Also note dependency #3626 is still open.)

Checked:

  • Audited all 14 changed files at c44c4444164964093821aea37edc1d97a3bdb185:
    • drivers/gpu/drm/apple/dcp.c / iomfb.c / iomfb_template.c: verified relink = external && t6040 in dcp_t6041_stop_dev() is mutually exclusive with !external, so the DART keep/restore and dcp_s2r_put_darts() unwind pairs cleanly without double-put; pipe_off_since_start is strictly scoped to panel-less internal DCPs and cleared in iomfb_poweron(); apple,dcp opt-in keeps non-opted T6041 external DCPs unchanged.
    • drivers/soc/apple/display-gate.c: panel child node is optional without breaking panel-present boards.
    • drivers/pci/controller/pcie-apple.c & drivers/soc/apple/t6041-sleep.c: keeping clocks ungated during S2R training, re-enabling after link-up via apple_pcie_port_enable_cg() honoring apple,no-refclk-gating, and waiting for APCIE_PORT_LINKSTS_L2 before PERST# assertion are clean and well-bounded.
    • drivers/phy/apple/t6040-usb2.c: usb2_cold cleanly powers USB2 before soft reset after SoC power loss.
    • drivers/net/ethernet/aquantia/atlantic/aq_nic.{c,h}: AQ_NIC_FLAG_DPATH_UP (0x40 unused) prevents double napi_disable() after a failed resume, err_vec unwinds partial vector starts, and pci_device_is_present() guards aq_nic_set_power().
    • DT bindings (apple,t8140-display-power.yaml, apple,pcie.yaml), J575c DTS, and host-test stub updates look clean; J575c exact-head standalone + 3/3 deep-sleep rows are present in the PR body.
Evidence
  • Head audited: c44c4444164964093821aea37edc1d97a3bdb185 (MERGEABLE, base main).
  • CI: only readiness ran (SUCCESS); apple-build, dt-checks, host-tests, KUnit plan, DWC3/ATC, source all SKIPPED.
  • Hardware rows: J575c M4 Max at c44c44441649 (standalone s2idle 1/1 + with #3626 DT deep 3/3) PASS; second-generation J616s/J773g rows covering the PCIe S2R clock commits still pending.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at c44c44441649. Since my 12-02 review at 9d6e098ef736 the series has only a main merge (the dcp.h conflict keeps both dcp_t6041_s2idle() and dcp_t6040_relinks()) and the dcp_desktop_external() stub in afk-compact-start-tests.py. No code changed, and satchlj's audit at this head found no blockers.

Hosted build and test CI doesn't run for this fork, so here are the equivalent local checks on this head merged with main 1262f9e1 (Dj's 12-02 override):

  • Compile against warm arm64 configs: dcp.c, iomfb.c, pcie-apple.c, t6041-sleep.c, t6040-usb2.c, display-gate.c and aq_nic.c all build with 0 warnings and 0 errors, the same as main.
  • Host tests in the CI-pinned container (aurora-linux-host-tests:ubuntu2404): afk-compact-start 11/11 (with mutations), dcpext26-retrain 2/2 (with the negative control), and apple-dcp pass.
  • DT: cpp+dtc of J575c, J614c and J614s on the merge give main's warnings. Only J575c's DTB changes, and J614c/J614s come out byte-identical to main. dt-doc-validate and yamllint pass on both changed bindings (apple,t8140-display-power.yaml, apple,pcie.yaml).

Left before merge: #3626 lands first, then the second-generation deep-sleep rows at this head for the shared PCIe S2R clock change and t6040-usb2. That is one J773g row (our M4 mini: PCIe devices and USB come back after deep) and one J616s row from an owner.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Could you also post a J575c deep-sleep row at #3626's head 5bee0291? #3626 turns on deep sleep for every T6041 board, J575c included, so one pass at each head would let both PRs merge. The other J575c we were counting on has been retired from our lab testing, and we don't have one in our fleet, so yours is the only one we know of. Thanks!

@DjDeveloperr

DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

J773g (M4 mini, T8132, 27.2) c44c44441649 PASS (7.3.0-j773g-comp5 on main b47fc630, boot_id=3a101384-2cfc-4aa6-835b-6d4f9a3692b5): initial s2idle pass was 0/3 because /dev/rtc0 lacks wakeup; /dev/rtc1 rerun completed 3/3 s2idle cycles (rtcwake -d /dev/rtc1 -m freeze) with all 5 PCIe devices identical (lspci exact match pre/post sleep), wired end0 (BCM57762) back UP 1000Mb/s, DP-3 connected/enabled/On 3840x2160, and USB 05ac:800b + 05e3:0f01 re-enumerated (05e3:0f01 moved 3-1 -> 2-1, POST_SLEEP_USB_MATCH=0, due to xHCI root-hub bus renumbering across resume: pre-sleep usb2=USB3/usb3=USB2, post-sleep usb2=USB2/usb3=USB3); mem refusal matches stock (apple-dcp 48ae00000.dcp errno=-16) with DP-3 restored; 0 WARN/Oops/DART faults, 0 failed units.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at c44c444

Checked: The external DCP failure unwind now clears both keep flags and restores display streams before dropping the DART references. Atlantic marks the datapath up only after the vectors have started and unwinds already-started vectors on an earlier failure. Both changed binding files passed dt-doc-validate at this head, and the J575c DT uses the properties on the display-chain and root-port nodes the schemas describe.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

#3626 is merged (62c60d13d4d8), so this is next. Checked on the merge of c44c44441649 with main 62c60d13d4d8 (applies cleanly):

  • cpp + dtc of all twelve M4 boards: only the J575c changes.
  • Every caller of dcp_t6040_relinks() on main takes the new argument (main's dcp.c moved a lot since 12-02 with the T8122 and T6031 firmware-27 work, so this was the thing to look for).
  • Host tests: afk 13/13, dcpext26 23/23, display-gate 1/1, pcie 7/7. apple-dcp is running and I'll add it here only if it fails.
  • Not repeated: the object builds at W=1 (last done on the merge with 1262f9e1).

Left before the merge: one rtcwake -d rtc1 -m mem x3 row on another generation at this head for the shared pcie-apple change (being placed on one of our Macs). No new J575c run is needed unless the head changes.

@DjDeveloperr

DjDeveloperr commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

apple-dcp on the same merge: 87 of 101 cases pass on this host. The 14 others fail while compiling their harness with clang 23 (the one I opened stops at -Wunused-but-set-global in the generated host unit), and the same 14 fail without this PR (main c09b61228e62 with #3820, #3626, #4005 and #4070 applied): panel-takeover-registration, j616s-panel-identity, pm-ownership, controller-lifecycle, usb-unreachable, cpuidle-s2idle, probe-mux-pm-dispatch, parking, masked-context, off-hardening, warm-reset, dwc3-teardown, same-handle-srcu-index, mux-release-stages. So nothing new from this PR; those 14 need the CI image's older clang to count.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:one-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

J575c: 10 GbE (AQC113, PCIe port 2) lost after some deep-sleep wakes until a restart

4 participants