Repository navigation
drm/apple: dcp: refuse a processor its DART left without an IOMMU domain - #2578
Conversation
A DCP whose device tree names a DART but which the IOMMU driver did not
take (no IOMMU group) gets its shared memory from the DMA API's direct
path: the "DVAs" it is handed are physical addresses, which its DART then
translates as DVAs, into whatever those happen to map. On the M4 MacBook
Air on the macOS 27.2 stub, the internal DCP's firmware DART admits only
the 26.6.2 layout, so the processor ends up exactly like that: its first
RTKit buffer at physical 0x10032458000 faults in an empty slot ("SID23
write STE invalid"), and the firmware's own crash log IOVA cannot be
resolved (no domain, -ENOMEM).
Refuse such a processor at probe, before RTKit or anything else touches
it, so simpledrm keeps the panel.
Signed-off-by: Ryan Murray <[email protected]>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approving the guard as defence in depth, and merging.
The guard (dcp.c:7033-7035) is right:
- It fails loudly:
dev_err_probe()with -ENODEV logs at error level (__dev_probe_failed), naming the device and the reason. - It runs before RTKit or any shmem setup, so simpledrm keeps the panel.
- It only fires where a DCP names a DART but has no IOMMU group. Every working backend needs a domain there anyway (for example
dcp_desktop_shmem_setup()at:637-643), so it can't refuse a configuration that works today. A DART left in bypass would still have a group (identity domain), so that case isn't affected either.
The real defect is the version gate in apple-dart:
apple_dart_dcp_validate()refuses SID23 unlessapple_dart_dcp_firmware()matches 26.6.2 exactly (apple-dart-dcp.h:1041-1048, used at:1073). It's reached from the borrowed-DART path (apple-dart.c:3696) and the DCP path (:4039).- Everything else in that function already validates the handoff from its contents:
- the memory-region nodes and their
iommu-addresses - each mapping matched to an ADT segment (
dcp_adt_segment_match()) - every page's live translation and PTE kind checked against that segment
- the os-log region
- the memory-region nodes and their
- So the version match adds no safety that the table walk doesn't already give. It only turns away a valid 27.2 handoff, and it does that silently: no IOMMU group and no error, which is exactly how this bug got through.
Please replace the gate rather than extend it. Validate from the handoff and ADT contents, and where a 26.6.2 layout constant would differ on 27.2, take it from the ADT segments instead of a version. The same applies one level up to apple_t8132_firmware_path() / apple_t8132_qualified_firmware() (t8132.h:39-55), which keys the DART adoption on the board list or the asahi,os-fw-version string. Done that way, it would also cover the J773g mini and the other 27.2 boards, not just the J713.
I looked at the companion branch (lab/j713-disp2-dcp272-b-20261121 at 4bc6a6a). It adds a separate 27.2 key (apple_t8132_internal_dcp_v27_2()) next to the 26.6.2 one instead of removing it. That's fine as a lab step for tonight's J713 run, but it isn't the fix. Could you open an issue for "DART DCP validation by handoff contents, not firmware version" and link it here, so it stays tracked once this merges?
CI: host-tests was green on beaae8e. Base drift touched dcp.c, so I updated the branch to a920125, and host-tests is green there too. All commits are signed off.
Post-merge rows:
- The refusal itself on the J713 with 27.2 (already queued on your display lane): one "no IOMMU domain" error and simpledrm left up.
- One boot each on a T6041, a T8140 and a J713 on 26.6.2 with the DARTs adopted, confirming appledrm still binds and no such line appears.
The revert is a single commit.
Problem
A DCP whose device tree names a DART but which the IOMMU driver did not take (no IOMMU group) still probes. Its shared memory then comes from the DMA API's direct path, so the addresses handed to the firmware are physical addresses, which its DART translates as DVAs into whatever those happen to map.
This happened on the M4 MacBook Air (J713) on the macOS 27.2 stub. The internal DCP's firmware DART only admits the 26.6.2 layout, so
30ae00000.dcphad noiommu_group. appledrm's firmware-27 path then:0x10032458000as its DVA, which faulted at once ("SID23 write STE invalid").A follow-up lab run that let the firmware get further hung the machine.
Change
dcp_platform_probe_pipe()refuses such a processor with -ENODEV right after the firmware check, before RTKit or anything else touches it, so simpledrm keeps the panel. A processor withoutiommusis unaffected.Testing
run.py --group all: 89/89 on this branch, and on the J713 lab stack.dcp.obuilds with W=1 (LLVM, arm64), no new warnings.iommu_groupfor the DCP, and the live SID23 table maps the crash-log IOVA inside the firmware's own data segment. Our own capture, not tainted.Still to run
Reviewer / agent detail
RTKit: failed buffer request ep=0x1 ... at 0x00000100066b5000 (-12), thenshmem_setup: iova: 10032458000, thenapple-dart 30a340000.iommu: translation fault: SID:23 write STE invalid at 0x10032458000. DRAM is0x100_0000_0000-0x104_0000_0000on this machine, so0x10032458000is a physical address./sys/devices/platform/soc/30ae00000.dcp/iommu_groupis absent.apple_dart_dcp_validate()->apple_dart_dcp_firmware()accepts firmware-version 26.6.2 only.0x103ffeec000shows the crash-log IOVA mapped: root 3, leaves 260-462 =__DATA, IOVA0x10006410000-> PA0x103e1874000.Assisted-by: LLM (Claude:Opus 5.5)