Skip to content

iommu/apple-dart, drm/apple: fix T8020 display DART save/wake - #3334

Open
erikwb wants to merge 12 commits into
feat/dcp-v27-ext-idle-offfrom
fix/t8103-dcpext-idle-dart
Open

erikwb wants to merge 12 commits into
feat/dcp-v27-ext-idle-offfrom
fix/t8103-dcpext-idle-dart

Conversation

@erikwb

@erikwb erikwb commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: Fix T8020 display DART dark-save, s2r_disp_dart_with_dcp wake ordering, and ext_idle_domains_off tracking on feat/dcp-v27-ext-idle-off (#3410), and enable runtime idle-off on s2r_disp_dart_with_dcp pipelines once those fixes are present. Forward-merged updated #3410 (f39fdeec3e43, carrying origin/main 41ab8f546874 including #2673 J713 27.2 external display) at 1ed13bfc645c.

Tested: Offline checks pass at current head 1ed13bfc645c:

  • ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" (drivers/iommu/apple-dart.o, drivers/gpu/drm/apple/{dcp.o,audio.o,av.o}): 0 errors, 0 warnings.
  • git diff --check f39fdeec3e43..HEAD clean; checkpatch.pl --strict --git f39fdeec3e43..HEAD: 0 errors (dca005c5ea46 has only the pre-existing FILE_PATH_CHANGES warning on drivers/gpu/drm/apple/dcp_s2r_test.c, covered by F: drivers/gpu/drm/apple/ in MAINTAINERS).
  • arm64 QEMU KUnit: APPLE_DART_KUNIT_TEST with CONFIG_ARM64_16K_PAGES=y (70/70 passed: io-pgtable-dart 31/31, apple-dart-firmware-leaf 1/1, apple-dart 38/38, including apple_dart_test_t8020_display_streams_dark_order, apple_dart_test_four_level_*, apple_dart_test_dapf_*, apple_dart_test_display_keep), drivers/iommu/io-pgtable-dart.kunitconfig (31/31 passed), and drivers/gpu/drm/apple/tests/display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y (280 run: 278 passed, 2 skipped apple_g17_rx_util_min_test and dcpaud_no_sio_test, including apple-dcp-s2r 3/3, apple-dcp-firmware 7/7: dcp_ext_idle_s2r_disp_dart_gate and dcp_ext_idle_audio_dma_pin, and apple-dcpaud-legacy 10/10: dcpaud_legacy_unplugged_void_buffer, dcpaud_legacy_unplugged_hotplug_managed_buffer).
  • Host & selftests: dcpaud (20/20 passed, 10/10 open-fallback mutants killed), dart (24/24 passed), dcpext26-startup-tests.py + --mutants, backlight-coldboot-tests.py, display-sleep-merge-tests.py (17/17), selftests/drivers/gpu/apple-dcp/run.py --group audio (2/2 passed).

Earlier J313 hardware runs (93c1460e0500, 02f2f980442f) predate 134955d43f90 and 1ed13bfc645c and do not establish current-head behavior or independently verify PMGR domain toggling during unattached idle-off.

Risk: two-way door · Macs with T8020 display DARTs or s2r_disp_dart_with_dcp DCPs (apple_dcp_hw_t8103 internal DCP and apple_dcp_hw_t8103_dcpext external DCP on T8103), plus dcp->hw.s2r_ext pipelines where dcp_s2r_ext_domains_off() calls dcp_s2r_domains_off().

Revert: git revert -m 1 <merge_commit> after merge. Kernel driver and KUnit test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.

Not yet:

  • Final-head (1ed13bfc645c) verification on J313 (T8103): unattached 271c00000.dcp idle-off + wake with domain-state evidence and recovered display output + DP audio across hotplug, internal DPMS off/on, deep S2R resume, and undocked s2idle (while baseline s2idle hard-resets J313).
  • Second-family unaffected boot/display/GPU smoke row (J713 T8132 or J716c T6050).
  • Retargeting #3334 to main before #3410 merges (per branch policy, deleting a merged base branch closes PRs still stacked on it) and running hosted CI on 1ed13bfc645c.
Details

Targets open PR #3410 (feat/dcp-v27-ext-idle-off, f39fdeec3e43, forward-merged at 1ed13bfc645c, resolving dcp_s2r_ext_domains_on() in drivers/gpu/drm/apple/dcp.c and drivers/iommu/apple-dart-test.c to retain both origin/main's four-level/DAPF tests and #3334's apple_dart_test_t8020_display_streams_dark_order while keeping dcp_ext_idle_s2r_disp_dart_gate alongside dcp_ext_idle_audio_dma_pin in dcp-firmware-test.c).

  1. drivers/iommu/apple-dart.c: callers in drivers/gpu/drm/apple/dcp.c (dcp_ext_idle_off_work() and dcp_s2r_domains_off()) call apple_dart_power_dark(dart, true) before dcp_s2r_stop_streams() / dcp_s2r_ext_domains_off(). Previously apple_dart_t8020_display_streams() in drivers/iommu/apple-dart.c gated apple_dart_save_state() on !READ_ONCE(dart->display_dark), skipping TTBR, TCR, and display_enable save so wake neither restored lost translations nor re-enabled streams. Enter dark mode first via apple_dart_display_dark_enter() and gate the save on !dart->display_saved.
  2. drivers/gpu/drm/apple/dcp.c:
    • Share dcp_s2r_wake_darts() between dcp_s2r_warm_restart() and dcp_s2r_ext_start() so s2r_disp_dart_with_dcp pipelines (apple_dcp_hw_t8103 and apple_dcp_hw_t8103_dcpext) skip the early apple_dart_power_dark(dcp->s2r_disp_dart, false) call. The later apple_dart_display_streams(dcp->s2r_disp_dart, dcp_s2r_layout(dcp)->disp_streams, true, false) restores TTBR/TCR before calling apple_dart_display_dark_exit(), so held TLB invalidations run after TTBR/TCR restore and before streams are re-enabled.
    • In dcp_s2r_domains_off(), gate dcp->ext_idle_domains_off = true on dcp->hw.s2r_ext rather than dcp_s2r_is_t8142_ext(dcp) so apple_dcp_hw_t8103_dcpext tracks powered-off domain state.
    • Lift #3410's !dcp->hw.s2r_disp_dart_with_dcp guard in dcp_ext_idle_capable() (134955d43f90).
  3. drivers/gpu/drm/apple/dcp_s2r_test.c, drivers/gpu/drm/apple/dcp-firmware-test.c, and drivers/iommu/apple-dart-test.c: add KUnit coverage for dcp_s2r_ext_start() / dcp_s2r_warm_restart() wake call ordering (apple-dcp-s2r), dcp_ext_idle_s2r_disp_dart_gate arming, and T8020 dark-save plus post-restore TLB invalidation ordering (apple_dart_test_t8020_display_streams_dark_order).
Evidence
  • Current head 1ed13bfc645c (forward merge of #3410 f39fdeec3e43 into 134955d43f90):
    • make O=_build ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" drivers/iommu/apple-dart.o drivers/gpu/drm/apple/dcp.o drivers/gpu/drm/apple/audio.o drivers/gpu/drm/apple/av.o (aurora_defconfig, CONFIG_RUST=n): 0 errors, 0 warnings.
    • ./scripts/checkpatch.pl --strict --git f39fdeec3e43..HEAD: 0 errors (dca005c5ea46 has only the pre-existing FILE_PATH_CHANGES warning on drivers/gpu/drm/apple/dcp_s2r_test.c, covered by F: drivers/gpu/drm/apple/ in MAINTAINERS); git diff --check f39fdeec3e43..HEAD clean.
    • arm64 QEMU KUnit:
      • APPLE_DART_KUNIT_TEST with CONFIG_ARM64_16K_PAGES=y: 70/70 passed (io-pgtable-dart 31/31, apple-dart-firmware-leaf 1/1, apple-dart 38/38, including apple_dart_test_t8020_display_streams_dark_order, apple_dart_test_four_level_*, apple_dart_test_dapf_*, apple_dart_test_display_keep).
      • drivers/iommu/io-pgtable-dart.kunitconfig: 31/31 passed.
      • drivers/gpu/drm/apple/tests/display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y: 280 run: 278 passed, 2 skipped (apple_g17_rx_util_min_test, dcpaud_no_sio_test), including apple-dcp-s2r 3/3, apple-dcp-firmware 7/7 (dcp_ext_idle_s2r_disp_dart_gate, dcp_ext_idle_audio_dma_pin), and apple-dcpaud-legacy 10/10 (dcpaud_legacy_unplugged_void_buffer, dcpaud_legacy_unplugged_hotplug_managed_buffer).
    • Host & selftests:
      • python3 -I tools/asahi/run-host-tests.py --only dcpaud: 20/20 passed (dcpaud-open-fallback-tests + 10/10 mutants killed: no-retry, wait-any, gone-fails, keep-cookie, mask-all, drop-put-dma, void-lib-free, void-alloc-lib-free, managed-in-init-dma, void-free-runtime-dmab).
      • python3 -I tools/asahi/run-host-tests.py --only dart: 24/24 passed.
      • python3 -I tools/asahi/dcpext26-startup-tests.py + --mutants: PASS.
      • python3 -I tools/asahi/backlight-coldboot-tests.py: PASS.
      • python3 -I tools/asahi/display-sleep-merge-tests.py: PASS (17/17).
      • python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group audio: 2/2 passed (compact-audio-reply-bounds, cec-only-av-endpoint).
  • Prior J313 runs (predate 134955d43f90 and 1ed13bfc645c; do not establish current-head behavior or independently verify PMGR domains toggled during unattached idle-off):
    • Undocked physical USB-C replug at 93c1460e0500 (M1 MacBook Air, T8103, fw 27.2.1, default cmdline, s2r_untested=N, EIZO USB-C 2560x1440@60): 271c00000.dcp powered off idle after unplug (t=65.15 s) and woke in 1 ms on physical replug (t=304.106 s, 2560x1440@60 restored, 0 DART faults).
    • Docked DPMS + deep S2R at 93c1460e0500 (batched ac44bee46ee4, main 9e38a276dcb4): 3/3 DPMS off/on cycles (eDP-1 + DP-2) and deep S2R (0 DART faults, 0 warm restart failed: -62, both displays recovered).
    • Standalone J313 USB4 dock trial at 02f2f980442f (superseded by 93c1460e0500).

dcp_ext_idle_off_work() calls apple_dart_power_dark(dart, true) before
dcp_s2r_stop_streams(). Previously apple_dart_t8020_display_streams()
gated apple_dart_save_state() on !READ_ONCE(dart->display_dark), so a
T8020 display DART already marked dark skipped saving its TTBR, TCR,
and ENABLE_STREAMS before its power domain dropped, leaving translations
unrestored on wake.

Enter display-dark mode first, then save DART state whenever
!dart->display_saved.

Signed-off-by: Erik Bourget <[email protected]>
Two fixes for external DCPs whose display DART shares the DCP power
domain and is managed through dcp_s2r_domains_off() (such as T8103):

1. Set dcp->ext_idle_domains_off in dcp_s2r_domains_off() whenever
   dcp->hw.s2r_ext is set rather than only for T8142, so idle suspend
   and teardown paths track domain power state accurately.
2. In dcp_s2r_ext_start() and dcp_s2r_warm_restart(), skip the
   standalone apple_dart_power_dark(s2r_disp_dart, false) call when
   dcp->hw.s2r_disp_dart_with_dcp is true: apple_dart_display_streams()
   restores TTBR/TCR before calling apple_dart_display_dark_exit() and
   running the post-restore TLB invalidation. Clearing display_dark
   early raced with concurrent shared-framebuffer map/unmap flushes and
   caused dark-exit TLB invalidation to be skipped.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team as code owners November 27, 2026 00:20
@erikwb
erikwb requested review from Acelogic and maralcbr November 27, 2026 00:20
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m5 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 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 1ed13bfc: not ready yet

Check Detail
CI at head ok 2 checks passed
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 1ed13bfc
Conflicts ok none
PR text ok Risk: two-way · Macs with T8020 display DARTs or s2rdispdartwithdcp DCPs (appledcphwt8103 internal DCP and appledcphwt8103dcpext external DCP on T8103), plus dcp->hw.s2rext pipelines where dcps2rextdomainsoff() calls dcps2rdomainsoff(). Revert: git revert -m 1 <merge_commit> after merge. Kernel driver and KUnit test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.

Areas: area:display, area:platform

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

@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.

Verdict at 41171cb7a931: changes requested, 1 blocker. The DART change and the warm-restart reorder are correct. The external-DCP half doesn't run on T8103 in this stack.

Blocker: the T8103 external-DCP fixes depend on #3178, which isn't in this stack.

  • At this head, the T8103 dcpext node ("apple,t8103-dcpext", "apple,dcpext") binds the generic apple_dcp_hw_dcpext, which has only num_dptx_ports = 2.
  • It has no s2r_ext, so dcp_s2r_ext_capable() and dcp_ext_idle_capable() are false, and dcp_s2r_ext_start() never runs there.
  • The hosts that do set s2r_ext (apple_dcp_hw_t8140_external, apple_dcp_hw_t8142_dcpext) don't set s2r_disp_dart_with_dcp. So, on current hardware data:
    • the new apple_dart_display_streams(..., true, false) block in dcp_s2r_ext_start() is unreachable;
    • the dcp_s2r_domains_off() change from dcp_s2r_is_t8142_ext() to dcp->hw.s2r_ext changes nothing. dcp_s2r_domains_off() is reached through the DPMS and refused-stop paths, which need hw.s2r, and through dcp_s2r_ext_domains_off() only for T8142.
  • apple_dcp_hw_t8103_dcpext (with .s2r_ext = true) is added by #3178, which is open and isn't in feat/dcp-v27-ext-idle-off or main.
  • So the J313 ps_dispext_fe/ps_dispext_cpu0 result in the batched 7.3.0-j313ener1 build can't come from this PR's DCP hunks alone.
  • #3178 also touches the same dcp_s2r_ext_start() and display-DART code, so the two PRs will conflict.
  • Fix (either is fine):
    • stack this on #3178, resolve the overlap, and re-run the J313 row at the resulting exact head;
    • or keep the DART and warm-restart fixes here, and move the external-DCP hunks into #3178.

Checked

  • apple_dart_t8020_display_streams() (23091b1):
    • Entering dark first and then saving once, on !display_saved, fixes the skipped save when dcp_ext_idle_off_work() has already called apple_dart_power_dark(dart, true).
    • apple_dart_display_dark_enter() is idempotent (it is a flag, not a count), and the domain is still powered at that point. host_off still short-circuits a later call made with the domain off.
    • The on path restores and clears display_saved.
    • Only DART_T8020 display DARTs (T8103) take this function. Other types use the T8110 branch of apple_dart_display_streams(), which is unchanged.
  • dcp_s2r_warm_restart() (41171cb):
    • For s2r_disp_dart_with_dcp hosts, which is only apple_dcp_hw_t8103, it now skips the early apple_dart_power_dark(false).
    • The later apple_dart_display_streams(s2r_disp_dart, ..., true, false) restores TTBR/TCR first, then exits dark inside the T8020 on path. So held invalidations no longer run before the translations are back.
    • Other hosts keep the existing order.
  • Commits and CI: checkpatch --strict gives 0/0/0 on both commits, which are signed off with no attribution. CI at this head has only pr-text green and readiness, with no build or KUnit jobs on this stacked base.

Rows before merge: after the fix, a J313 row at the exact head with both the internal panel and an external USB-C display:

  • DPMS off/on;
  • s2idle and deep;
  • the external hotplug wake after idle power-off, which is already under Not yet.

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Nov 27, 2026
T8103's apple_dcp_hw_t8103_dcpext (.s2r_ext = true) lives in #3178 rather
than feat/dcp-v27-ext-idle-off, leaving the dcp_s2r_domains_off() and
dcp_s2r_ext_start() hunks unreachable on this stack. Narrow this PR to the
T8020 display DART dark-save fix and dcp_s2r_warm_restart() wake-order fix,
which apply directly to T8103 disp0 on this branch.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review — narrowed this PR in defba2698f51 to the T8020 display DART dark-save fix (23091b1b0c8d) and the dcp_s2r_warm_restart() wake-order fix, dropping the two s2r_ext hunks (dcp_s2r_domains_off() / dcp_s2r_ext_start()) that depend on apple_dcp_hw_t8103_dcpext from #3178. Those two hunks can land as a tiny follow-up once both #3178 and #3308 are on main. Will follow up with a J313 internal-panel DPMS/s2idle/deep row at defba2698f51.

@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Verified defba2698f51 on J313 M1 Air (candidate 7.3.0-j313ener2, default cmdline): boots with 0 failed units; internal eDP-1 DPMS off/on, 3x s2idle, and deep S2R (boot object resumes 0 -> 1, eDP-1 connected/On, 0 DART/DCP errors). Updated PR body What: and Tested: at defba2698f51.

@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.

Verdict at defba2698f51: no code blockers, and the earlier blocker is resolved. It isn't ready to merge yet: a build, KUnit and a PR-body update are still owed (see below).

Earlier blocker (at 41171cb7a931): resolved.

  • defba2698f51 drops the two s2r_ext hunks, in dcp_s2r_domains_off() and dcp_s2r_ext_start(). Against feat/dcp-v27-ext-idle-off, the PR is now two hunks: the T8020 save fix and the dcp_s2r_warm_restart() change.
  • Both only run on T8103's internal DCP:
    • apple_dart_t8020_display_streams() is taken only by apple,t8103-dart display DARTs. T600x uses apple,t6000-dart, and M2 and later use T8110 DARTs.
    • The warm-restart change is gated on s2r_disp_dart_with_dcp, which on this base only apple_dcp_hw_t8103 sets.
  • So the J313 row at this head is the right row: internal panel, DPMS off/on, 3× s2idle and deep, with 0 DART/DCP errors. No second-generation row is needed.

Checked (fresh review)

  • apple_dart_t8020_display_streams():
    • apple_dart_display_dark_enter() now runs first. It is idempotent: it sets a flag and takes the TCR snapshot only on the first entry. So the display DART being dark already no longer skips the save.
    • Where that happens on this base: dcp_s2r_refused_domains_off() darkens the DART through dcp_s2r_domains_off() without a save. A later stream stop then took the old skip, and the wake neither restored the translations nor re-enabled the streams. The body's Details only cite dcp_ext_idle_off_work(), which doesn't run on T8103 here.
    • The save is plain TCR/TTBR reads, done after the writers have drained. The old code already read enable at this point, so it adds no MMIO in a state that didn't have any.
    • display_saved is set once per power-down and cleared only by the on path, after a successful dark exit.
    • If dark_enter() times out, the call returns before saving. If the flush fails after the save, host_off stays false and the next on still restores and clears it.
  • dcp_s2r_warm_restart():
    • On T8103, display_dark is still set when the later apple_dart_display_streams(disp, ..., true, false) runs. So the on path restores TTBR/TCR if they were lost, and apple_dart_display_dark_exit() then sees display_tlb_stale and invalidates before the streams are enabled again.
    • Before, the early apple_dart_power_dark(false) had already cleared display_dark. That later dark_exit() then returned at once and the post-restore invalidation never ran.
    • If the DCP DART's on fails first, the display DART stays dark, and the existing crash path handles it.
    • Other hosts keep the early dark exit.
  • Commits: all three are signed off by the author, with no attribution. checkpatch --strict gives 0/0/0 on each.

Not blocking

  • History: 41171cb7a931 adds the s2r_ext hunks and defba2698f51 takes them out again, so its subject ("... idle state on s2r_ext hosts") no longer matches what lands. Squashing the two and retitling it as the warm-restart fix would keep the history clean.
  • When feat/dcp-v27-ext-idle-off goes to main:
    • main now has #3178's apple_dcp_hw_t8103_dcpext, with both s2r_ext and s2r_disp_dart_with_dcp.
    • main's dcp_s2r_ext_start() and dcp_s2r_warm_restart() both still call apple_dart_power_dark(disp, false) before the restore.
    • So the follow-up you describe is needed at that merge. Otherwise the T8103 external DCP keeps the same early dark exit.

Before merge

  1. CI: only pr-text ran (pass), and readiness was cancelled. No build or KUnit job runs on this stacked base, so a build of this head needs to be green.
  2. PR body:
    • Risk still names T8142 and the s2r_ext external DCPs.
    • Details item 2 still describes the dropped hunks.
    • The Evidence section is from the old 7.3.0-j313ener1 build, with the external-DCP PMGR values.
    • The Not yet hotplug line no longer applies to this PR.
    • All of these should be narrowed to T8103's internal DCP and the new row.
  3. Row provenance: the J313 row names candidate 8963018bbcb1, which isn't on GitHub, so I couldn't check that it contains this head. Pushing that tree, or naming the kernel commit the row was built from, lets the merge lane confirm it.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 27, 2026 04:17

Superseded by the review at defba26

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Nov 27, 2026
…fix/t8103-dcpext-idle-dart

Signed-off-by: Erik Bourget <[email protected]>
… wake

On T8103 external DCP (apple_dcp_hw_t8103_dcpext), the display DART shares
the DCP power domain and sets s2r_disp_dart_with_dcp. Merging
feat/dcp-v27-ext-idle-off made dcp_s2r_ext_start() reachable on T8103
DCPExt, where it unconditionally called apple_dart_power_dark(disp_dart,
false) before restoring the T8020 display DART translations. Clearing
display_dark early caused the subsequent apple_dart_display_streams(...,
true, false) call's dark-exit step to return early without running the
post-restore TLB invalidation.

Share dcp_s2r_wake_darts() between dcp_s2r_ext_start() and
dcp_s2r_warm_restart() so s2r_disp_dart_with_dcp pipelines skip the early
power-dark exit and let apple_dart_display_streams() restore TTBR/TCR
before draining dark writers and invalidating the TLB. Add KUnit tests
for the wake call ordering.

Signed-off-by: Erik Bourget <[email protected]>
Verify in APPLE_DART_KUNIT_TEST that a T8020 display DART marked dark
before stream stop still saves its TTBR, TCR, and enable mask, restores
them on wake before dark-exit TLB invalidation runs, and would miss the
post-restore invalidation if display_dark were cleared early.

Signed-off-by: Erik Bourget <[email protected]>
Match the GPL-2.0-only license of dcp.c for the included KUnit test
helper drivers/gpu/drm/apple/dcp_s2r_test.c.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb erikwb changed the title iommu/apple-dart, drm/apple: fix T8020 display DART save/wake and s2r_ext idle state iommu/apple-dart, drm/apple: fix T8020 display DART save/wake Nov 27, 2026
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr Addressed the round-2 findings on fix/t8103-dcpext-idle-dart at 02f2f980442f (preserving defba2698f51 and 5f9a132c51f5 in history with no force-push):

  • Wake order in dcp_s2r_ext_start() (dca005c5ea46): Shared dcp_s2r_wake_darts() between dcp_s2r_ext_start() and dcp_s2r_warm_restart() so s2r_disp_dart_with_dcp pipelines (apple_dcp_hw_t8103 and apple_dcp_hw_t8103_dcpext) skip the early apple_dart_power_dark(dcp->s2r_disp_dart, false) call. apple_dart_display_streams(..., disp_streams, true, false) now restores TTBR/TCR first and only then calls apple_dart_display_dark_exit(), so the post-restore TLB invalidation runs on T8103 DCPExt wake.
  • KUnit coverage (dca005c5ea46, 2314b088b398, SPDX header 02f2f980442f): Added apple-dcp-s2r in drivers/gpu/drm/apple/dcp_s2r_test.c (GPL-2.0-only, verifying wake call order in dcp_s2r_ext_start() on apple_dcp_hw_t8103_dcpext vs apple_dcp_hw_t8140_external and in dcp_s2r_warm_restart() on apple_dcp_hw_t8103) and apple_dart_test_t8020_display_streams_dark_order in drivers/iommu/apple-dart-test.c (verifying T8020 dark-save and post-restore invalidation ordering).
  • PR body & call-path correction: Corrected Details to identify dcp_ext_idle_off_work() as the path that marks the DART dark before dcp_s2r_stop_streams() (with dcp_s2r_ext_domains_off() / dcp_s2r_domains_off() following the stream stop on that path), updated Details for dcp_s2r_ext_start(), and updated Tested: / Not yet: for 02f2f980442f.
  • Checks (checkpatch.pl --strict at 02f2f980442f; build, KUnit, and host tests at 2314b088b398 before the SPDX-comment-only commit 02f2f980442f):
    • make O=_build ARCH=arm64 LLVM=1 W=1 drivers/iommu/apple-dart.o drivers/gpu/drm/apple/dcp.o drivers/iommu/ drivers/gpu/drm/apple/ (defconfig + asahi.config, CONFIG_RUST=n): 0 errors, 0 warnings.
    • ./scripts/checkpatch.pl --strict --git 5f9a132c51f5..HEAD: 0 errors, 0 checks (FILE_PATH_CHANGES new-file warning only on drivers/gpu/drm/apple/dcp_s2r_test.c, covered by F: drivers/gpu/drm/apple/ in MAINTAINERS).
    • KUnit (--arch=arm64 --make_options LLVM=1 on QEMU): APPLE_DART_KUNIT_TEST (apple-dart* with CONFIG_ARM64_16K_PAGES=y) 33/33 passed, drivers/iommu/io-pgtable-dart.kunitconfig 31/31 passed, drivers/gpu/drm/apple/tests/display.kunitconfig 170/171 passed (1 skipped: apple_g17_rx_util_min_test needs CONFIG_UCLAMP_TASK).
    • python3 -I tools/asahi/run-host-tests.py --only dart: 16/16 passed.
    • Standalone J313 M1 Air (T8103) trial boot at 02f2f980442f, on the USB4 dock with an external 3840x2160@120 display: 3 DPMS off/on cycles of eDP-1 and the external output, 2 deep sleeps (outputs DPMS-off first) and an s2idle all resume with eDP-1 On, 0 failed units, 0 AppArmor denials, no apple-dart error lines. A deep sleep started with the external output active is refused by its display processor (-16), and the external display does not come back after a deep sleep (DP tunnel setup failed: -110); the default kernel behaves the same under the same sequence, so both are outside this PR; the missing external display after a deep sleep is listed under Not yet:.

@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.

The T8020 save guard and restore-before-invalidate order look correct. The new tests exercise the call order and capture the TTBR/TCR at invalidation. Two integration items block this revision.

  • The PR still targets feat/dcp-v27-ext-idle-off, and #3308 is closed without a GitHub merge commit. Please rebase onto the intended landing base and identify the landed dependency commits, or name the replacement parent PR. Verify that the T8103 external hardware descriptor and the external domain-off path are present in the resulting stack.
  • The J313 standalone row establishes internal resume. The external controller returns -62 and never recovers the connector in either run. Three compositor DPMS cycles also do not establish that the external domains powered down and the new wake branch actually ran. Please capture a successful T8103 external idle power-off/on cycle on the landing head with domain-off and domain-on evidence and a working connector after wake. If external coverage belongs to the dependency series, keep this PR scoped to the internal warm-restart path and carry the external change with that evidence.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed blast:m5 Macs affected, from Merge risk (bot) labels Nov 27, 2026
dcp_s2r_ext_domains_off() delegates to dcp_s2r_domains_off() whenever
dcp->hw.s2r_layout is set, which includes apple_dcp_hw_t8103_dcpext.
Gate ext_idle_domains_off on dcp->hw.s2r_ext instead of
dcp_s2r_is_t8142_ext() so T8103 external idle domain power-off tracking
stays accurate across suspend and open paths.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the two blocking items from the review at 02f2f980442f in 93c1460e0500:

  1. Parent PR and stack verification: Open PR #3410 (feat/dcp-v27-ext-idle-off, head 944b0ba788d2) is the replacement parent PR for closed #3308 and is already merged into fix/t8103-dcpext-idle-dart at 5f9a132c51f5. Verified that #3178 (ef29ad17facb on main, adding apple_dcp_hw_t8103_dcpext and dcp_s2r_t8103_ext) and #3307 (9dd8b87b003c, merged in f8fa6d8d0aed) are ancestors of 944b0ba788d2, and that dcp_ext_idle_off_work() and dcp_s2r_ext_domains_off() are present in the stack. Updated the PR body to note #3410 remains open.
  2. T8103 external idle domain tracking (93c1460e0500): While auditing dcp_s2r_ext_domains_off() on this stack, dcp_s2r_domains_off() (which dcp_s2r_ext_domains_off() calls whenever dcp->hw.s2r_layout is set) still gated dcp->ext_idle_domains_off = true on dcp_s2r_is_t8142_ext(dcp) instead of dcp->hw.s2r_ext. Because apple_dcp_hw_t8103_dcpext sets .s2r_layout = &dcp_s2r_t8103_ext, it never recorded ext_idle_domains_off = true on domain power-off. Updated dcp_s2r_domains_off() to check dcp->hw.s2r_ext.

Local checks at 93c1460e0500:

  • make O=_build ARCH=arm64 LLVM=1 W=1 drivers/iommu/apple-dart.o drivers/gpu/drm/apple/dcp.o drivers/iommu/ drivers/gpu/drm/apple/: 0 errors, 0 warnings.
  • ./scripts/checkpatch.pl --strict --git 5f9a132c51f5..HEAD: 0 errors (only the pre-existing FILE_PATH_CHANGES warning on dcp_s2r_test.c in dca005c5ea46, covered by F: drivers/gpu/drm/apple/ in MAINTAINERS).
  • KUnit on arm64 QEMU: APPLE_DART_KUNIT_TEST (apple-dart* with CONFIG_ARM64_16K_PAGES=y) 33/33 passed, drivers/iommu/io-pgtable-dart.kunitconfig 31/31 passed, drivers/gpu/drm/apple/tests/display.kunitconfig 170/171 passed (1 skipped: apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK).
  • Host tests: python3 -I tools/asahi/run-host-tests.py --only dart 16/16 passed; python3 tools/asahi/backlight-coldboot-tests.py PASS.

J313 (M1 MacBook Air, T8103, docked) at 93c1460e0500 in batched candidate ac44bee46ee4 on main 9e38a276dcb4: 3/3 DPMS off/on cycles (eDP-1 and docked DP-2 each Off -> On, 0 errors) and a deep S2R (apple-dart 271304000.iommu: SID0 TTBR0 80bffedc, had 8081bf00; 0 DART faults, 0 warm restart failed: -62; both displays recovered cleanly).

Still under **Not yet:**: the undocked run with 271c00000.dcp unattached (idle power-off/on with domain-off/on state, connector wake) and an undocked s2idle; with DP-2 docked, dispext_fe/dispext_cpu0 stayed on and 501f00000.nhi refused s2idle with -EBUSY, as expected.

@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 93c1460e

Blockers:

  1. Targets open non-default base branch feat/dcp-v27-ext-idle-off (#3410). Retarget to main once #3410 merges and re-run CI (pr-text / readiness were cancelled).

Checked:

  • 93c1460e cleanly resolves the prior ext_idle_domains_off tracking finding across all s2r_ext layouts, alongside the verified T8020 display DART dark-save guard, shared dcp_s2r_wake_darts() restore-before-invalidate ordering, and GPL-2.0-only dcp_s2r_test.c.
  • Checked for Apple material, tool attribution, and private serials: clean.
Evidence
  • Head: 93c1460e0500 (base: feat/dcp-v27-ext-idle-off, mergeable: MERGEABLE, +438/-57 across 4 files).

@sithglan

Copy link
Copy Markdown
Contributor

Hardware test of the unattached idle-off -> physical USB-C display hot-plug path at exact head 93c1460e0500 on MacBook Air M1 (J313 / T8103, fw 27.2.1, default cmdline, s2r_untested=N) with an EIZO USB-C DisplayPort monitor (2560x1440@60) and dynamic_debug enabled on dcp_ext_idle*/dcp_s2r_ext*:

  • Booted 7.3.0-j313-pr3334+ (93c1460e0500), unplugged EIZO (t=65.15 s), and let 271c00000.dcp power off idle.
  • Physically plugged EIZO back in (t=304.106 s):
    • [304.106202] apple-dcp 271c00000.dcp: RTKit: Initializing (protocol version 12)
    • [304.106853] apple-dcp 271c00000.dcp: dcpext idle: woke in 1 ms
    • [304.106887] apple-display-crossbar 38304c000.mux: Switched dpphy to dispext0,0
    • [304.613859] apple-dcp 271c00000.dcp: set_digital_out_mode finished:8274 (2560x1440@60, card1-DP-1: connected, enabled)
  • Zero DART/IOMMU faults, zero Oops/BUG/WARNING/SError.
  • On a subsequent active-output unplug (t=369.015 s), 93c1460e0500 hit the pre-#3523 (#3157) setPowerState(0) timeout 1000 ms, and the idle-off safety guard deferred cleanly ([374.742585] apple-dcp 271c00000.dcp: dcpext idle: updates pending, deferring) without cutting display domains under an in-flight call.

Now that T8020 display DART dark-save, post-restore wake ordering, and
layout-wide ext_idle_domains_off tracking are in place, lift the
s2r_disp_dart_with_dcp guard in dcp_ext_idle_capable() and update the
capability KUnit test to verify idle-off arms on those pipelines.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Merged updated feat/dcp-v27-ext-idle-off (38c26d8a6b57, carrying origin/main 18058ea228e2 and #3410's s2r_disp_dart_with_dcp guard, at 5c55d7af840a) into fix/t8103-dcpext-idle-dart and added 134955d43f90 to lift !dcp->hw.s2r_disp_dart_with_dcp in dcp_ext_idle_capable() and update dcp_ext_idle_s2r_disp_dart_gate now that T8020 dark-save, wake-ordering, and domain-tracking fixes are present. The drivers/iommu/apple-dart-test.c merge conflict in 85300c3b48c5 joined adjacent test definitions (apple_dart_test_display_keep and apple_dart_test_t8020_display_streams_dark_order) with both registrations surviving.

Verified at 134955d43f90:

  • make ARCH=arm64 LLVM=1 W=1 (defconfig + asahi.config, CONFIG_RUST=n) for drivers/iommu/apple-dart.o, drivers/gpu/drm/apple/dcp.o, drivers/iommu/, and drivers/gpu/drm/apple/: 0 errors, 0 warnings.
  • ./scripts/checkpatch.pl --strict --git 38c26d8a6b57..HEAD: 0 errors (0 warnings/checks on 5c55d7af840a and 134955d43f90; only the pre-existing FILE_PATH_CHANGES warning on drivers/gpu/drm/apple/dcp_s2r_test.c in dca005c5ea46); git diff --check 38c26d8a6b57..HEAD clean.
  • arm64 QEMU KUnit: apple-dart* (CONFIG_ARM64_16K_PAGES=y) 34/34 passed (apple-dart-firmware-leaf 1/1 + apple-dart 33/33, alongside the old head's 33/33 DART KUnit pass), drivers/iommu/io-pgtable-dart.kunitconfig 31/31 passed, and drivers/gpu/drm/apple/tests/display.kunitconfig 171 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK), including apple-dcp-s2r 3/3 and apple-dcp-firmware 6/6 (dcp_ext_idle_s2r_disp_dart_gate).
  • Host tests: tools/asahi/run-host-tests.py --only dart 16/16 passed, tools/asahi/dcpext26-startup-tests.py PASS, and tools/asahi/backlight-coldboot-tests.py PASS.

Hardware & merge status:

  • J313 (T8103, Group D at 85300c3b48c5): trial kernel was built and parity-checked against main ee36fbdcd1c8 (all changed PR files IDENTICAL), and was never booted because J313 became unreachable after the second deep-sleep cycle on baseline main (awaiting physical recovery; baseline s2idle also hard-resets J313).
  • Older 93c1460e0500 runs (iommu/apple-dart, drm/apple: fix T8020 display DART save/wake #3334 (comment)) predate 85300c3b48c5/134955d43f90 and do not establish current-head behavior or independently verify that PMGR domains toggled during unattached idle-off.
  • Remaining under **Not yet:**: final-head (134955d43f90) J313 idle-off + wake with domain-state evidence and recovered output, internal DPMS off/on, deep resume, undocked s2idle (while baseline s2idle hard-resets J313), a second-family unaffected smoke row, hosted CI on the final diff, and retargeting #3334 to main before #3410 merges.

@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 134955d4

Blockers:

  1. Targets open non-default base branch feat/dcp-v27-ext-idle-off (#3410). Retarget to main once #3410 merges so full main CI runs on the final diff, and record exact-head standalone external hot-plug verification on s2r_disp_dart_with_dcp hardware.

Checked: Merge of updated feat/dcp-v27-ext-idle-off (38c26d8a6b57) and delta commit 134955d43f (drivers/gpu/drm/apple/{dcp.c,dcp-firmware-test.c}).

Evidence
  • Delta since 93c1460e (0 code blockers): 134955d43f cleanly lifts #3410's !dcp->hw.s2r_disp_dart_with_dcp guard in dcp_ext_idle_capable() now that T8020 dark-DART save/restore and wake-ordering fixes are present on this branch, and updates dcp_ext_idle_s2r_disp_dart_gate KUnit to verify s2r_disp_dart_with_dcp pipelines arm and disarm idle-off cleanly.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026

@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 134955d43f90

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: Merge of updated feat/dcp-v27-ext-idle-off (38c26d8a6b57) and delta commit 134955d43f (drivers/gpu/drm/apple/{dcp.c,dcp-firmware-test.c}).

Follow-ups (not blocking): Merge parent #3410 first; follow-ups: retarget, main CI, standalone external hot-plug row

@malik-na

malik-na commented Dec 1, 2026

Copy link
Copy Markdown
Member

Another J313 (M1 Air) data point. Deep S2R doesn't come back for me either, even on your tested pair, so it's not only later main.

Setup

Results

  • pm_test = devices, platform, processors and core: all four pass back to back (suspend_stats success 0→4, no failures).
  • Real deep sleep with your method (rtcwake -d /dev/rtc1 -m mem -s 6), first cycle: the Air never wakes. It is back up on a fresh boot 86 s after it went silent, which is the 60 s T8103_WDT_COMMIT_SECS watchdog plus a ~27 s boot, not a resume.
  • Lid close on battery (logind suspend) gives the same result: no wake, then a reset.
  • Nothing from the suspend attempt reaches the journal of the lost boot, so I have no in-kernel evidence past the freeze yet.

So everything up to the real power-down works, and the failure is after the power-down, before the kernel runs again: RVBAR → Stage 2 → smp_s2r_return_to_os. I can't yet tell whether Stage 2 is reached on wake.

Next on my side: a serial console over the DFU port, to see whether Stage 2 prints anything on wake. Is there a known-good aura/linux pair that last woke for you on J313, or anything you want me to try (e.g. a longer -s, no_console_suspend, or a debug build of the s2r return path)?

@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Forward-merged updated #3410 (f39fdeec3e43, carrying latest origin/main 41ab8f546874 including #2673 J713 27.2 external display and the updated unplugged dcp-dp-audio DMA deferral / void_dmab symmetric cleanup / dcp_pcm_open() managed buffer setup / DCP idle-pin fix) into #3334 at 1ed13bfc645c:

  • Resolved drivers/gpu/drm/apple/dcp.c (dcp_s2r_ext_domains_on()) to retain both #3410's dcp_s2r_ext_by_layout(dcp) and origin/main's KUNIT_STATIC_STUB_REDIRECT.
  • Resolved drivers/iommu/apple-dart-test.c to retain both origin/main's DAPF / four-level DART tests and #3334's apple_dart_test_t8020_display_streams_dark_order.
  • drivers/gpu/drm/apple/dcp-firmware-test.c merged cleanly with #3334's dcp_ext_idle_s2r_disp_dart_gate (verifying s2r_disp_dart_with_dcp stays enabled) alongside #3410's dcp_ext_idle_audio_dma_pin.

Verified offline at 1ed13bfc645c: W=1 KCFLAGS="-Werror" object builds (0 warnings), checkpatch.pl --strict --git f39fdeec3e43..HEAD (0 errors, only pre-existing FILE_PATH_CHANGES on dcp_s2r_test.c), KUnit (APPLE_DART_KUNIT_TEST with CONFIG_ARM64_16K_PAGES=y: 70/70 passed (io-pgtable-dart 31/31, apple-dart-firmware-leaf 1/1, apple-dart 38/38), io-pgtable-dart.kunitconfig 31/31, display.kunitconfig + CONFIG_SOUND=y CONFIG_SND=y 278 passed / 2 skipped including apple-dcp-s2r 3/3, apple-dcp-firmware 7/7, and apple-dcpaud-legacy 10/10), dcpaud (20/20, 10/10 open-fallback mutants killed), dart (24/24), dcpext26-startup-tests.py (--mutants), backlight-coldboot-tests.py, display-sleep-merge-tests.py (17/17), and apple-dcp selftest --group audio (2/2).

Remaining before merge: retarget #3334 to main before #3410 merges, run hosted CI at 1ed13bfc645c, and record exact-head J313 (T8103) idle-off/wake + second-family unaffected smoke.

For @malik-na's J313 deep-sleep note: on our J313 (T8103, macOS 27.2.1 stub), rtcwake -d /dev/rtc1 -m mem -s 30 (with external displays DPMS-off first when docked) resumed cleanly (suspend_stats success=1, wake IRQ NUB.SPMI0Sw3IRQ) on main 429e7e15f122 with the current J313 Stage 2 (boot.bin SHA-256 1262bc5d…), as well as earlier on main ee36fbdcd1c8 (#3655 control, rtcwake -d rtc1 -m mem -s 15). Testing -s 30 (and no_console_suspend over DFU serial if -s 30 still hits the 60 s T8103_WDT_COMMIT_SECS watchdog) is worth trying next.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 1, 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.

The T8020 stop path now saves TTBR/TCR even when the DART is already dark. The coupled wake restores the translations before clearing dark state, and the uncoupled path retains its original ordering. The DART test checks the post-restore invalidation and the DCP tests cover both wake orders. Merge still depends on #3410, CI against main, and the current J313 idle-off/hotplug and second-family smoke rows.

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:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m1 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.

4 participants