Repository navigation
soc: apple: display-gate: t8122: let scanout use the external display DART - #4030
Conversation
… 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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
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.
|
Test kernel at |
|
Code review (no 14.7 stub available on J613 here; 14.7 hardware not tested):
|
|
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.
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): |
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
mainf52ba21da1ca: 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 at8c2e9e5dbd90(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_dartwith the device tree window0x0..0xffffeffff, which PIODMA uses (stream 4). Scanout reads framebuffers through stream 0 of the same DART, at the panel's window0x10000000000..0x10fffffffff.7e604265b39bmade 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-EINVALfor it, andof_dma_configure()goes on without an IOMMU. Framebuffers then get physical addresses. J613 RAM starts at0x10000000000, and the first fault is at0x10007000000, 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-dartkeeps the DART out of the subsystem, so the panel works. Thefbdmachild 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.aurora2did 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.binis needed.Other Macs.
gate_t8132_run()is the only gate entry there, by the firmware path or bygate_socs[].run. Both new helpers are called only fromgate_t8122_dcpext_one(), whichgate_run()calls forapple,t8122only.fbdmaone 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 ingate_t8122_dcpext_one()removed and the tests kept,gate_t8122_dcpext_v14_7,gate_t8122_dcpext_loader_default_markerandgate_t8122_dcpext_board_mirrorsfail 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 scanout0x10000000000..0x10fffffffffand PIODMA0x0..0xffffeffff.Host tests (the workflow's pinned toolchain):
apple-dcp1/1 (the whole selftest list), jobs matchingdisplay7/7, jobs matchingdart32/32.Builds (arm64, clang 23,
aurora_defconfig):Image modules dtbscomplete.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). WithKUNIT=yand both suites on, the two objects build withW=1and no warnings.Device tree: no
.dtsor binding changes.dt_binding_checkofapple,dcp.yaml,apple,dart.yamlandapple,display-subsystem.yamlis clean.CHECK_DTBSof the J613 and J615 reports only the knownsound,aliases,ispandgpulines.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:
dmesg | grep -c 'does not overlap stream window'is 0.dmesg | grep 'display-subsystem: Adding to iommu group'has a line.dmesg | grep 'apple-t8122-display: enabled /soc/dcp@31ac00000'saysin the display subsystem. Without this line the boot doesn't test the fix.dmesg | grep -c 'translation fault'is 0, there is noco-processor has crashed, andswap 1 completeis there.J615, firmware 14.7 stub,
chosen.asahi,t8122-dcpext=1in/etc/m1n1.conf(as in #4003):dmesg | grep fbdmahasfbdma: framebuffers mirrored throughand neitherno IOMMU domainnornot mirrored.31ac00000.dcpbinds, and/sys/class/drmhas the Type-C connectors.translation faultlines.J615 on 27.2 (lab): external display on one port, 0
translation fault, 0does not overlap.Control for J613 and J615:
622a059b0df6or the7.3.0.aurora4-1package showsdoes not overlap stream window.