Repository navigation
iommu/apple-dart: honor a common scanout aperture before intersecting stream defaults - #2145
Conversation
Document the display consumer's optional DMA aperture, which can differ from the defaults of individual scanout DARTs. Include the T8122 display subsystem compatible so its shared aperture is checked by this binding. Signed-off-by: DjDeveloperr <[email protected]> Signed-off-by: Scott Jones <[email protected]>
Domain allocation already lets a consumer specify apple,dma-range, but of_xlate intersects the provider defaults before that override is read. A consumer with a common scanout alias and DARTs with disjoint defaults therefore fails configuration before its domain can be allocated. Apply the same consumer aperture while parsing each specifier, retaining validation of both explicit five-cell windows and the override. Share the alignment, overflow and alias-width checks. Consumers without an override keep their existing windows. Add KUnit cases for the J613 high scanout alias across internal/external DART defaults, independent low PIODMA, malformed overrides and invalid five-cell specifiers. An ASAN/UBSAN fixture executing the production parser and of_xlate reproduces the old rejection and accepts the common window. Signed-off-by: DjDeveloperr <[email protected]> Signed-off-by: Scott Jones <[email protected]>
The display gate adds the external display DART to the shared display subsystem. Its low PIODMA default does not overlap the internal display's inherited 1 TiB alias, so their defaults cannot be intersected for scanout. Describe the subsystem's common scanout aperture explicitly, matching the internal DART. The external PIODMA consumer retains its existing low aperture and the external processor still requires the firmware-ready gate. This is a software-validated candidate; hardware external-display qualification remains pending. Signed-off-by: DjDeveloperr <[email protected]> Signed-off-by: Scott Jones <[email protected]>
|
Blockers: 3.
HW row: J613 (or J615) on integration/aurora plus this branch, default command line, internal panel plus an external display through the display gate: both outputs scan out, no DART faults and no "non-overlapping DMA windows" in dmesg, hotplug the external display 5 times; plus 0 AVC denials, 0 failed units and 0 new kernel errors against the same base without the branch. Assisted-by: LLM (Claude:Opus 5.5) |
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at 4e33348: BLOCKERS. Not merging until the blockers below are fixed or answered; the details give file:line and a failure case. Full review#2145 iommu/apple-dart: honor a common scanout aperture before intersecting stream defaults @4e333487VERDICT: BLOCKERS Blockers:
Nits:
Missing rows:
|
|
Clarification to my merge-train review above: the commit-trailer point is a nit, not a blocker (already-pushed history stays as it is, no force push). The other blockers listed there still stand. |
There was a problem hiding this comment.
Formal §1–§6 pre-PR review at verified live head 4e3334872df8d6e618c7089ab7e87a3c68760508 (base integration/aurora 70a00e583b03; not superseded by #2189 or other recent apple-dart.c commits; MERGEABLE/clean; live CI 2/2 PASS: Host tests run 44113747350, Device tree checks run 44113747443).
Blockers Before APPROVE
- §2 / §3 DMA aperture safety bug — consumer
apple,dma-rangediscards each member DART's own window instead of intersecting masked offsets (drivers/iommu/apple-dart.c,arch/arm64/boot/dts/apple/t8122-dcp.dtsi:38,129):- In
apple_dart_parse_dma_window(), whendev->of_nodehasapple,dma-range,*dma_min/*dma_maxare overwritten outright with the consumer property instead of intersecting its lowdart->ias-bit range against the DART stream's own masked window (dart->dma_min..dart->dma_maxor 5-cell specifier window). Furthermore, in liveapple-dart.c,apple_dart_domain_alloc_paging()(:4039-4051) setsdart_domain->has_dma_range = true, causing__apple_dart_finalize_domain()(:3506-3507) to ignorecfg->dma_min/cfg->dma_maxaltogether and use the raw consumer window. - Concrete failure case (confirmed by the PR's own
apple_dart_test_consumer_windowtest andt8122-dcp.dtsi):dispext0_dart(t8122-dcp.dtsi:129) definesapple,dma-range = <0x0 0x0 0xf 0xffff0000>;(0x0..0xffffeffff), excluding the top 64 KiB (0xfffff0000..0xfffffffff).display(t8122-dcp.dtsi:38) setsapple,dma-range = /bits/ 64 <0x10000000000 0x1000000000>;(full 64 GiB0x10000000000..0x10fffffffff).- Mapping paths mask IOVAs to
dart_domain->mask((iova + dart_domain->dma_offset) & dart_domain->mask, liveapple-dart.c:3234,3264,3299,3361). Thus the top 64 KiB of the shared aperture (0x10fffff0000..0x10fffffffff) maps directly intodispext0_dart's excluded0xfffff0000..0xfffffffffrange — and becauseiommu-dmaallocates top-down, the very first buffers allocated oncedispext0_dartjoinsdisplaywill land there.
- Fix: Preserve the consumer's alias bits (
alias = consumer_min & ~mask), intersect(consumer_min & mask)..(consumer_max & mask)with the stream's(stream_min & mask)..(stream_max & mask)(failing with-EINVALif empty), return[alias | low_min, alias | low_max]fromapple_dart_parse_dma_window(), and ensure__apple_dart_finalize_domain()respects the intersectedcfg->dma_min..cfg->dma_maxrather than widening it back to an un-intersecteddart_domain->dma_min/dma_max. Updateapple_dart_test_consumer_windowto assert0x10000000000..0x10ffffefffffor the external DART and add a non-overlapping masked-window negative test.
- In
- §4 Attribution — AI commit trailers present (hard rule):
- All three commits (
1ccee5b0b157,130cd47bac10,4e3334872df8) carryAssisted-by: OpenAI Codex (gpt-6.1-sol)inside the commit message. Per §4, commits must carry human identity and humanSigned-off-by:only, with zero AI commit trailers. Replace the PR body'sGenerated with [Claude Code]footer with a plainAssisted-by:line.
- All three commits (
- §5 Exact-head hardware & regression evidence missing:
- Commit
4e3334872df8and the PR body state external-display qualification is still pending, andt8122-dcp.dtsi:35currently lists only<&disp0_dart 0>so the stacked boot did not exercise the multi-DART shared scanout path and omitted the §5 regression triad. - After fixing the aperture intersection above, please provide exact-head hardware evidence on default cmdline exercising the shared internal+external scanout domain (e.g., J613/J615 with internal panel + external display, hotplug, 0 DART faults, 0
"non-overlapping DMA windows"/"Invalid DMA window"errors) and confirming zero regressions across existingapple,dma-rangeDART consumers (with the §5 regression triad:0 SELinux denials[orN/A],0 failed units,0 new kernel errors).
- Commit
4e33348 to
36a5f13
Compare
The display subsystem's apple,dma-range was described as overriding the aperture of each referenced DART stream. The DART driver now keeps the bits above a DART's address width as the alias and intersects the rest with each stream's window, so the aperture never extends past any of them. Describe that. Signed-off-by: Scott Jones <[email protected]>
A consumer's apple,dma-range replaced the window of every DART stream it used, and domain allocation then used the raw consumer window again. The DART translates only the low ias bits of an IOVA, so the consumer window could reach addresses that one of its streams excludes. On T8122 the display subsystem's aperture is 0x10000000000..0x10fffffffff and dispext0_dart excludes its top 64 KiB (0xfffff0000..0xfffffffff). Once dispext0_dart joins the display, the top 64 KiB of the shared aperture masks into that excluded range, and iommu-dma allocates top-down, so the first buffers land there. Keep the consumer's bits above ias as the alias, intersect its low bits with the stream's window masked the same way, and refuse a consumer window that does not overlap a stream's window. of_xlate already intersects the streams, so finalize the domain with that master window and drop the separate consumer window kept by domain allocation. Every other in-tree consumer with apple,dma-range sits on a DART whose window is the full ias range, or one that covers the consumer window (the T6041 JPEG DARTs, which need ias >= 42 to probe), so its window does not change. Update the J613 consumer case to expect 0x10000000000..0x10ffffeffff for the external DART and for a five-cell stream window, and add cases for disjoint and single-page overlaps. Fixes: 6245efd ("iommu/apple-dart: honor consumer apertures before intersecting streams") Signed-off-by: Scott Jones <[email protected]>
7773a1b to
7e60426
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 7e604265b39b: the code is ready; it needs only a row at this head.
Blockers: none in the code. Missing row: this changes which DMA apertures the display DARTs accept, so it needs one J613 or J615 boot at this head, with the internal panel and an external display scanning out and no DART faults. Thanks for the quick fix.
Because apple-dart.c runs on every Mac, it also needs one boot at this head on another generation with its displays scanning out and no DART faults before it merges.
Checked: no Apple material, no gates. 7e604265 fixes the point from my last review: a consumer's apple,dma-range is now intersected with each member DART's own window instead of replacing it, and the binding says so. CI green.
Superseded by the review at 7e60426
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
|
|
Merged into main. Thank you! It went through the J616s batch row at this head (0 failed units, 0 GPU faults, s2idle 2/2), and Dj's review. |
|
These runs were done before the merge, so they apply to what's on main now. J613 (13-inch M3 Air) results: the display crashes at the current head Every run was built on main
So Details
|
Summary
A display consumer can already give its own
apple,dma-range, butof_xlateintersects the DARTs' default windows before that override is read. On T8122 the internal and external display DARTs have disjoint defaults, so the shared display subsystem fails configuration before its domain is allocated.The binding documents the optional aperture and the T8122 display subsystem compatible, and t8122-dcp.dtsi describes the common scanout aperture. Consumers without an override keep their windows.
Evidence
a7dd26e6d60ewith the 7.3 package config, LLVM 18 and Rust 1.85:make W=1 drivers/iommu/: buildsmake dtbs: builds, no warningsa7dd26e6plus all 13 branches of this set (before the three small fix-up commits) booted on an M3 MacBook Air (J613), a Neo (J700) and an M1 Pro with no regressions against their baselines (on the M1 Pro, only the checks already known to differ: GPU name and DRAM OPP), and a 25-minute GPU soak was clean on all three. No M3 Pro, M3 Max, J504, J615 or M4 Pro ran this kernel.Merge Danger
Door: two-way
Blast Radius: DART
Touches every DART consumer, but only changes behaviour for one that sets
apple,dma-range. Later PRs in this set (M3 Max boards) build on the binding change.