Skip to content

drm/apple: T6041 host-driven sleep on DCP firmware 27 - #3687

Merged
RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
allanclempe:fix/t6041-dcp-s2r-fw27
Dec 1, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
allanclempe:fix/t6041-dcp-s2r-fw27

Conversation

@allanclempe

Copy link
Copy Markdown
Contributor

What: T6041 deep sleep on DCP firmware 27 (a macOS 27.2 stub). The DCPs' own suspend and resume no longer touch DCPs the host stop has already powered off, which reset the SoC in device suspend, and the host stop and recommit use the firmware 27 calls where they sent 26.6's, which crashed each DCP.
Tested: J616c (M4 Max) at 3294c96 (with #3670 at 0d460a7 and the T6041 PMP SRAM fix in the same tree): deep sleep 1/1 with the SEP bound, slept 15 s and woke in the same boot, all five DCPs skipped their own callbacks; 0 failed units, no new kernel errors.
Risk: two-way door · M4 Max (T6041: J614c, J616c, J575c); the guard in the first commit also applies to any board on the host-driven stop. A plain revert undoes it.
Not yet: J614c and J575c rows; a T6041 on DCP firmware 26.6 (its paths are unchanged).

Details
  • First commit. dcp_t6041_down moves above dcp_platform_suspend(), which now returns 0 while it is set, as does dcp_platform_resume(). The DCPs' own resume runs before the display subsystem's, whose dcp_t6041_s2r_all(true) starts every DCP. ext_dead didn't cover this: the stop sets it only for a DCP whose firmware ran, and an external DCP with nothing attached takes the not-running branch.
  • Second commit. With DCP_FIRMWARE_V_27_0, dcp_t6041_stop_one() powers the internal panel off with iomfb_s2r_power_v27(dcp, false, true, false) and keeps the D572 wait, then releases the AP link with iomfb_s2r_500_v27(), refusing if the v27 table has no tag for it. dcp_t6041_recommit() powers the panel back on with iomfb_s2r_power_v27(dcp, true, true, true) and its D572 wait. T6040's steps in the stop are unchanged.
  • How it was found. The stop was bisected on the J616c with abort points. Every step of the display's stop runs on firmware 27: the power-off, the AP-link release, RTKit idle, the firmware stop, all five power chains down (each chain's words read back off, no PARENT_OFF latch on the main chain), and the restart. The reset came afterwards, from the DCPs' own callbacks. With them skipped, pm_test passes at devices, platform, processors and core.
Evidence

Tree: main 45d7f82 + this branch (7c2bf06, 3294c96) + #3670 (0d460a7) + fix/t6041-pmp-sram-data (f919dbb), nothing else, built as 7.3.0-1-2.1-ARCH, default command line, J616c with a macOS 27.2 (26B123) stub.

  • rtcwake -d rtc1 -m mem -s 15: PM: suspend entry (deep) 14:29:25, PM: suspend exit 14:29:42, same boot.
  • All five DCPs logged T6041 S2R: down by the host stop, own suspend skipped, then still down by the host stop, own resume skipped.
  • 0 failed units. The kernel errors were the ones every boot already has before the change (ANE H16 preload matches none of 6 firmware profiles, DCP AFK[ep:20]: failed to extract init props: -2), plus apple_soc_edac … event-log source 9 after the wake, which is unrelated and still open.
  • Before the change (same Mac): every deep sleep reset the SoC in device suspend, with pm_test=devices too.

…m down

On T6041 the display subsystem's suspend stops every DCP and lowers
their power words (dcp_t6041_s2r_all()). Each DCP platform device
suspends after it, and dcp_platform_suspend() then took its firmware
sleep paths against a DCP that is already powered off. A read behind a
powered-off block stalls the CPU on this fabric and the SoC resets:
every deep sleep reset the J616c in the device suspend phase, with
pm_test=devices too. ext_dead didn't cover it, since the stop sets it
only for a DCP whose firmware ran. dcp_platform_resume() runs before the
display subsystem's resume and would touch the same blocks.

Both callbacks now return while dcp_t6041_down is set; the display
subsystem's resume starts every DCP afterwards.

Signed-off-by: Allan Clempe <allan.clempe@gmail.com>
dcp_t6041_stop_one() and dcp_t6041_recommit() sent the 26.6 desktop
calls whatever the firmware. On DCP firmware 27 the AP-link release has
its own tag in the v27 method table, the 26.6 one names a different
method there and crashes each DCP, and _dcp_poweroff() does nothing for
an internal panel, so the stop then timed out waiting for the display to
go off.

With DCP_FIRMWARE_V_27_0 the stop now powers the internal panel off with
iomfb_s2r_power_v27() and keeps waiting for the firmware's display-off
answer before the DART streams go off, releases the AP link with
iomfb_s2r_500_v27() (refusing if the table has no tag for it), and the
recommit powers the panel back on the same way. The dispatch follows the
driver's existing fw_compat checks; T6040's steps are unchanged.

Signed-off-by: Allan Clempe <allan.clempe@gmail.com>
@allanclempe
allanclempe requested review from a team as code owners November 30, 2026 04:43
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-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 3294c96d: not ready yet

Check Detail
CI at head running running: KUnit isp, KUnit jpeg, KUnit prores, KUnit scaler, KUnit macsmc, KUnit clpc
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 3294c96d
Conflicts ok not computed yet
PR text ok Risk: two-way · M4 Max (T6041: J614c, J616c, J575c); the guard in the first commit also applies to any board on the host-driven stop. A plain revert undoes it.

Areas: area:display

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 3294c96d

Blockers:

  • Fork pull_request CI workflows at 3294c96d (Apple build and KUnit, Apple DRM KUnit, Host tests, pr-text) are action_required (awaiting maintainer approval to run); only pull_request_target skipped/readiness ran, so no hosted build or KUnit/host test has executed yet. Code and J616c deep-sleep verification look solid — ready to approve once CI runs green.

Checked:

  • Commit 1 (7c2bf062): moving dcp_t6041_down above dcp_platform_suspend() and skipping both dcp_platform_suspend() and dcp_platform_resume() while READ_ONCE(dcp_t6041_down) is set prevents touching powered-off DCP register blocks (covering external DCPs where ext_dead was never set); dcp_t6041_s2r_all(false) unwinds dcp_t6041_down on failure and dcp_t6041_s2r_all(true) clears it before restarting every DCP on resume.
  • Commit 2 (3294c96d): dcp_t6041_stop_one() dispatches DCP_FIRMWARE_V_27_0 to iomfb_s2r_power_v27(dcp, false, true, false) (calling dcp_s2r_dart_end(dcp) before err_unwind on error) and iomfb_s2r_500_v27(dcp) guarded on dcp->v27_methods && dcp->v27_methods[dcpep_unnamed_500].tag[0]; dcp_t6041_recommit() dispatches DCP_FIRMWARE_V_27_0 to iomfb_s2r_power_v27(dcp, true, true, true) with D572 completion tracking (covering both normal resume and stop_one err_unwind when powered_off is set). T6040 and v26.6 paths remain unchanged.
  • Both commits carry human Signed-off-by: trailers, clean PR metadata (Risk: two-way), zero AI attribution, and exact-head J616c (M4 Max, macOS 27.2 stub) 15 s deep-sleep verification (pm_test + real rtcwake -m mem).
Evidence
  • Diff audited: drivers/gpu/drm/apple/dcp.c (+68/-15), commits 7c2bf062 and 3294c96d.
  • Verified dcp_s2r_dart_power(), dcp_t6041_stop_one() (err_unwind), dcp_t6041_start_one(), and dcp_t6041_s2r_step() / dcp_t6041_s2r_all() state transitions.
  • Non-blocking nit: dcp_t6041_down is read with READ_ONCE() in dcp_platform_suspend()/dcp_platform_resume() while written with plain assignment in dcp_t6041_s2r_step(); matching WRITE_ONCE() would keep accessors symmetric (serialized by PM core in practice).
  • Workflow runs at review time: Apple build and KUnit, Apple DRM KUnit, Host tests, and pr-text are pull_request completed/action_required (fork PR); pull_request_target jobs skipped.

@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 3294c96db3b9

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Commit 1 (7c2bf062): moving dcp_t6041_down above dcp_platform_suspend() and skipping both dcp_platform_suspend() and dcp_platform_resume() while READ_ONCE(dcp_t6041_down) is set prevents touching powered-off DCP register blocks (covering external DCPs where ext_dead was never set); dcp_t6041_s2r_all(false) unwinds dcp_t6041_down on failure and dcp_t6041_s2r_all(true) clears it before restarting every DCP on resume.

  • Commit 2 (3294c96d): dcp_t6041_stop_one() dispatches DCP_FIRMWARE_V_27_0 to iomfb_s2r_power_v27(dcp, false, true, false) (calling dcp_s2r_dart_end(dcp) before err_unwind on error) and iomfb_s2r_500_v27(dcp) guarded on dcp->v27_methods && dcp->v27_methods[dcpep_unnamed_500].tag[0]; dcp_t6041_recommit() dispatches DCP_FIRMWARE_V_27_0 to iomfb_s2r_power_v27(dcp, true, true, true) with D572 completion tracking (covering both normal resume and stop_one err_unwind when powered_off is set). T6040 and v26.6 paths remain unchanged.
  • Both commits carry human Signed-off-by: trailers, clean PR metadata (Risk: two-way), zero AI attribution, and exact-head J616c (M4 Max, macOS 27.2 stub) 15 s deep-sleep verification (pm_test + real rtcwake -m mem).

Follow-ups (not blocking): fork CI approval; WRITE_ONCE symmetry nit

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 3294c96db3b9 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at 3294c96 that the readiness check found (PR body or comment). CI: linux train L4 = main (after L3) + 34 approved PRs (#3419 dropped: conflicts): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit ane-boot/clpc/ane-pm/dcp-fabric/dcp-topology/dcp-display/macaudio/asahi/sep all pass, host tests apple-dcp + apple-scaler-recovery pass (the red host-tests on some heads were base failures since fixed on main). The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 57dde7d into aurora-silicon:main Dec 1, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants