Skip to content

soc: apple: display-gate: t8122: let scanout use the external display DART - #4030

Merged
DjDeveloperr merged 2 commits into
mainfrom
fix/t8122-dcpext-scanout-window
Dec 3, 2026
Merged

DjDeveloperr merged 2 commits into
mainfrom
fix/t8122-dcpext-scanout-window

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What: On an M3 Air with firmware 14.7, let the external display DART serve scanout again. Since #2145 the DART driver refuses it: on the J613 the whole display subsystem then runs without an IOMMU, the internal DCP faults and the panel goes black before the LUKS prompt. On the J615 the external displays are gone. Fixes #4023, fixes #4003.
Tested: Display gate KUnit (UML) on the merge with main f52ba21da1ca: 78/78 pass in all six suites (T8122 29/29, T8132 8/8; one case more than at the head, from main). The T8122 14.7 cases fail without the fix. J615 on 27.2, no regression: PASS at 8c2e9e5dbd90 (internal panel, GPU, s2idle; no external display). Hosted KUnit, host tests and the arm64 build are green at the head. Nobody has booted the 14.7 path yet. Details are in Evidence.
Risk: two-way · T8122 (J613, J615, J504, J433, J434) with 14.7 firmware and an external display processor handed over by the boot loader. Only the T8122 external display code of the display gate changes. The 27.2 path keeps its windows but uses a shared helper now.
Not yet: the 14.7 rows on J613 and J615. It merges without them: those Macs have a black panel or no external displays today, and the reporters of #4023 and #4003 have a test kernel. J504, J433 and J434 have the same exposure and nobody has run them. No J773g row: a T8132 can't reach this code (see Other Macs).

Thanks to henrrrik and corith for the two reports, and to Scott Jones, whose J613 A/B in #3270 named the commit.

Details

What breaks. The gate enables dispext0_dart with the device tree window 0x0..0xffffeffff, which PIODMA uses (stream 4). Scanout reads framebuffers through stream 0 of the same DART, at the panel's window 0x10000000000..0x10fffffffff. 7e604265b39b made a consumer's window narrow its DART's window instead of replacing it. It took bit 40 for an alias above a 36-bit DART, and its KUnit case uses a 36-bit DART for the J613. The J613 and J615 logs show the T8122 display DARTs keep that bit: with a 36-bit mask the two windows overlap and the "does not overlap" line can't be printed.

J613. The gate adds the DART to display-subsystem. apple_dart_of_xlate() returns -EINVAL for it, and of_dma_configure() goes on without an IOMMU. Framebuffers then get physical addresses. J613 RAM starts at 0x10000000000, and the first fault is at 0x10007000000, 112 MiB into RAM. An IOVA would be at the top of the window, where the DCP's own buffers are (0x10fffec0000). So the buffers aren't mapped in another DART: they aren't mapped in any.

J615. apple,no-shared-display-dart keeps the DART out of the subsystem, so the panel works. The fbdma child has the panel's window and fails the same check: fbdma: no IOMMU domain.

The fix. On 14.7 the gate moves the DART's window to the PIODMA child. PIODMA keeps exactly the addresses it had, and scanout uses its own window. That is what 7.3.0.aurora2 did in effect, where a consumer's window replaced the DART's. The stream-window check itself stays as it is for every Mac.

Why not in the device tree. The gate already picks these windows by firmware: with the 27.2 image it gives both DARTs the panel's window. A PIODMA window in the device tree would break that path. The device tree also comes with the boot loader and may be older than the kernel. With the fix in the gate, no new boot.bin is needed.

Other Macs.

  • T8132 (M4): gate_t8132_run() is the only gate entry there, by the firmware path or by gate_socs[].run. Both new helpers are called only from gate_t8122_dcpext_one(), which gate_run() calls for apple,t8122 only.
  • Firmware 27.2 and the 25G83 device trees: not affected, both external DARTs have the panel's window.
  • T6030 (M3 Pro): the gate adds a DART to the subsystem too, but all its display DARTs have the panel's window and the subsystem has none of its own. T6031 (M3 Max): the gate adds no external DART.
  • All 141 Apple DTBs of this tree, 136 consumer streams with their own window: only the J615 fbdma one is disjoint from its DART's window. None is narrowed.
Evidence

KUnit (UML, clang 23): apple-display-gate* 77/77 at the head, 78/78 on the merge with main. With the call in gate_t8122_dcpext_one() removed and the tests kept, gate_t8122_dcpext_v14_7, gate_t8122_dcpext_loader_default_marker and gate_t8122_dcpext_board_mirrors fail and the other 26 T8122 cases pass.

The apple-dart case (second commit) needs an arm64 kernel to run, so only hosted CI runs it. Its windows were run on the host through apple_dart_parse_dma_window() as it is in the tree: the 42-bit DART with the device tree window refuses scanout (-22), a 36-bit one accepts it (0x10000000000..0x10ffffeffff), and the 42-bit one without a window gives scanout 0x10000000000..0x10fffffffff and PIODMA 0x0..0xffffeffff.

Host tests (the workflow's pinned toolchain): apple-dcp 1/1 (the whole selftest list), jobs matching display 7/7, jobs matching dart 32/32.

Builds (arm64, clang 23, aurora_defconfig): Image modules dtbs complete. W=1 drivers/soc/apple/display-gate.o drivers/iommu/: no new warnings (clang 23 reports three file-scope variables that are there before this change). With KUNIT=y and both suites on, the two objects build with W=1 and no warnings.

Device tree: no .dts or binding changes. dt_binding_check of apple,dcp.yaml, apple,dart.yaml and apple,display-subsystem.yaml is clean. CHECK_DTBS of the J613 and J615 reports only the known sound, aliases, isp and gpu lines.

The change applies to the shipped tree: the patch applies to aurora-7.3.0-4 (omacom/linux-aurora) with offsets only.

Rows owed: how to boot and what passes

No new boot.bin, device tree or command-line option is needed. Boot the PR kernel once and keep the installed kernel as the default entry.

J613, firmware 14.7 stub, LUKS root or not:

  1. Boot with the normal command line and no external display. The panel must stay lit through the hand-over from simpledrm, and the passphrase prompt must show.
  2. dmesg | grep -c 'does not overlap stream window' is 0.
  3. dmesg | grep 'display-subsystem: Adding to iommu group' has a line.
  4. dmesg | grep 'apple-t8122-display: enabled /soc/dcp@31ac00000' says in the display subsystem. Without this line the boot doesn't test the fix.
  5. dmesg | grep -c 'translation fault' is 0, there is no co-processor has crashed, and swap 1 complete is there.
  6. Plug an external display into each USB-C port. It lights up and the panel stays on.
  7. One s2idle cycle, then repeat 5.

J615, firmware 14.7 stub, chosen.asahi,t8122-dcpext=1 in /etc/m1n1.conf (as in #4003):

  1. Boot. The panel works as before.
  2. dmesg | grep fbdma has fbdma: framebuffers mirrored through and neither no IOMMU domain nor not mirrored.
  3. 31ac00000.dcp binds, and /sys/class/drm has the Type-C connectors.
  4. An external display lights up on each port, also after unplug and replug. There are 0 translation fault lines.
  5. One s2idle cycle with the display attached.

J615 on 27.2 (lab): external display on one port, 0 translation fault, 0 does not overlap.

Control for J613 and J615: 622a059b0df6 or the 7.3.0.aurora4-1 package shows does not overlap stream window.

… DART

With firmware 14.7 the display gate enables the external display DART with
the device tree window 0x0..0xffffeffff, the one its PIODMA stream uses.
Scanout reads framebuffers through stream 0 of the same DART, at the
panel's window 0x10000000000..0x10fffffffff.

Since commit 7e60426 ("iommu/apple-dart: intersect consumer apertures
with each stream window") a consumer's window only narrows its DART's. That
change took the 1 TiB bit for an alias above a 36-bit DART. The T8122
display DARTs translate 42 bits, so the bit counts, the windows are
disjoint and the DART driver refuses the consumer:

  platform display-subsystem: DMA window 0x10000000000..0x10fffffffff does
  not overlap stream window 0x0000000000000000..0x0000000ffffeffff

of_dma_configure() goes on without an IOMMU after such an error. On a J613
the DART joins the display subsystem, so the whole subsystem, the internal
panel included, falls back to direct DMA. The display processor gets the
physical addresses of its framebuffers (RAM starts at 0x10000000000), the
internal display DART has no translation for them, and the firmware dies:

  apple-dart 28d304000.iommu: translation fault: status:0x80080004 stream:0
  code:0x4 (NO PMD FOR IOVA) at 0x10007000000
  apple-dcp 28ec00000.dcp: RTKit: Message (id=1): IOMFB
  int_handler_gated: failure: axi_rd_err [0x40000600]

On a J615 the DART stays out of the subsystem and its fbdma child is the
consumer that gets no IOMMU domain. The panel works and the external
displays are gone.

The device tree's window is right for PIODMA alone: the 14.7 firmware's
buffers are mapped there at their own addresses, from 0x800000000. Move it
from the DART to the PIODMA child, so each consumer's own window applies.
With the 27.2 image the gate already gives both DARTs the panel's window,
and that stays. The gate does this rather than the device tree because it
picks the windows for the firmware, and because the tree comes with the
boot loader and may be older than the kernel.

The T8122 cases of the display gate KUnit suite now check where the window
ends up. The three 14.7 cases fail without the change.

Fixes: 7e60426 ("iommu/apple-dart: intersect consumer apertures with each stream window")
Fixes: 0a1289f ("arm64: dts: apple: t8122-j615: keep dcpext display DART unshared and wire fbdma")
Link: #4023
Link: #4003
Signed-off-by: DjDeveloperr <hey@djdev.me>
The consumer window case stood in for the J613 display DARTs with a 36-bit
DART. Theirs translate 42 bits: a J613 refuses the 1 TiB scanout window on
the external display DART's low one, which a 36-bit mask would accept.

Describe that case as the 36-bit one it is, and add the T8122 windows on a
42-bit DART: the low DART window refuses scanout, and a DART without one
serves scanout and PIODMA, each in its own window.

Link: #4023
Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 3, 2026 01:10
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m3 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 Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Merge readiness at 8c2e9e5d: ready to merge

Check Detail
CI at head ok 11 checks passed
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok comment at 8c2e9e5d
Conflicts ok none
PR text ok Risk: two-way · T8122 (J613, J615, J504, J433, J434) with 14.7 firmware and an external display processor handed over by the boot loader. Only the T8122 external display code of the display gate changes. The 27.2 path keeps its windows but uses a shared helper now.

Areas: area:platform
Merge: gh pr merge 4030 --merge (Owners and Core through the bypass: add --admin).

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

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

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

Reviewed 8c2e9e5. Moving the range to PIODMA retains its narrower constraint and lets scanout use its own range on the shared DART. The gate requires the PIODMA target before scheduling the change, preserves an existing child range, and leaves the 27.2 window assignments equivalent. The reported KUnit suite distinguishes the 14.7 cases. Hardware rows are pending.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Test kernel at 8c2e9e5dbd90 for the J613 and J615 rows: https://github.com/aurora-silicon/linux/releases/tag/test-pr4030-m3-air-20261203

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
@satchlj

satchlj commented Dec 3, 2026

Copy link
Copy Markdown
Member

Code review (no 14.7 stub available on J613 here; 14.7 hardware not tested):

  • 27.2 path unaffected: gate_t8122_dcpext_piodma_window() sits in the else if (!ret) branch of apple_t8122_dcpext_v27_2(np), so 27.2 continues through gate_t8122_dcpext_alias() with identical behavior (no interaction with #4037).
  • Lifetime & cleanup: gate_set_window() frees both prop and value on partial allocation or of_changeset_update_property() failure, and gate_t8122_dcpext_piodma_window() guards adding apple,dma-range on @piodma with !of_property_present() before removing it from @disp_dart.
  • Tests: apple_dart_test_t8122_consumer_window() directly covers the 42-bit IAS disjoint-window rejection (-EINVAL with a low window on the DART) and acceptance once the window moves to piodma, matching gt_expect_piodma_window() in display-gate-test.c.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 (M3 Air 15", T8122) 27.2 no-regression row at exact head 8c2e9e5: PASS. This covers the 27.2 path only; the 14.7-stub rows have to come from the #4003/#4023 reporters.

How: kernel built at this head, booted with this head's t8122-j615.dtb (byte-identical to main d1ae4f2's) in one aura-try trial (trial guard + dead-man, GRUB one-shot). The same silent 18-feature checklist ran about 240 s after boot, and the same trial was run on main d1ae4f2 as the control.

feature #4030 8c2e9e5 main d1ae4f2
internal display PASS eDP-1 connected/enabled, DPMS on, 2880x1864, DCP 2/2 bound, backlight write/read/restore same
external display not covered (no sink on our J615; 2 DP connectors disconnected) same
GPU (aurora-g16) glmark2-es2-gbm 4974, health 0 5220, health 0
s2idle (rtc1) PASS 16 s, eDP + Wi-Fi back same
Wi-Fi / BT / input / Touch ID / battery / mics / headphones PASS PASS
Oops / DART faults / kernel errors 0 / 0 / 5 0 / 0 / 5

Same results on both arms, apart from GPU score noise and a camera check our checklist couldn't run on the first arm (missing v4l2-ctl; installed afterwards). Lab-only, unrelated, on both arms: an old speakerguardd vs the #3212 pairing; ANE -95 (#3887 not on main).

Evidence (ours, untainted): traces/gpu/20261203-m3pro-gpu-dvfs/checklist-j615-pr4030-8c2e9e5d.txt and checklist-j615-main-d1ae4f29.txt, trial logs traces/boot/20261127-dt-parity/rows/j615/run.log 14:02 and 14:13 AEDT. J615 restored to saved edge.

@github-actions github-actions Bot added the ready-to-merge Meets the merge policy: merge it (bot) label Dec 3, 2026
@DjDeveloperr
DjDeveloperr merged commit 83053b4 into main Dec 3, 2026
17 checks passed
@DjDeveloperr
DjDeveloperr deleted the fix/t8122-dcpext-scanout-window branch December 3, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

3 participants