Skip to content

drm/apple: dcp: refuse a processor its DART left without an IOMMU domain - #2578

Merged
DjDeveloperr merged 2 commits into
integration/aurorafrom
j713-disp2/dcp-refuse-no-iommu-domain
Nov 20, 2026
Merged

DjDeveloperr merged 2 commits into
integration/aurorafrom
j713-disp2/dcp-refuse-no-iommu-domain

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

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.dcp had no iommu_group. appledrm's firmware-27 path then:

  • could not resolve the firmware's crash-log IOVA (no domain, -ENOMEM), and
  • gave the DCP a buffer at physical 0x10032458000 as 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 without iommus is unaffected.

Testing

  • tools/testing/selftests/drivers/gpu/apple-dcp run.py --group all: 89/89 on this branch, and on the J713 lab stack.
  • dcp.o builds with W=1 (LLVM, arm64), no new warnings.
  • Hardware facts behind it, from the J713 on 27.2: no iommu_group for 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

  • The refusal itself on hardware (J713 + 27.2 display Stage 2 + this module). It is queued with the J713 display lane's next one-shot.
Reviewer / agent detail
  • Evidence from the J713 (T8132) on the macOS 27.2 stub:
    • B3 boot log: RTKit: failed buffer request ep=0x1 ... at 0x00000100066b5000 (-12), then shmem_setup: iova: 10032458000, then apple-dart 30a340000.iommu: translation fault: SID:23 write STE invalid at 0x10032458000. DRAM is 0x100_0000_0000-0x104_0000_0000 on this machine, so 0x10032458000 is a physical address.
    • /sys/devices/platform/soc/30ae00000.dcp/iommu_group is absent. apple_dart_dcp_validate() -> apple_dart_dcp_firmware() accepts firmware-version 26.6.2 only.
    • A read-only dump of the live SID23 root 0x103ffeec000 shows the crash-log IOVA mapped: root 3, leaves 260-462 = __DATA, IOVA 0x10006410000 -> PA 0x103e1874000.
  • Why probe time: after RTKit starts, the firmware may already be using the untranslated addresses. A refusal at probe leaves the boot-loader display (simpledrm) untouched.
  • The DART-side change that gives the J713's 27.2 DCP a real domain is separate and still a lab change (lab/j713-disp2-dcp272-b-20261121). This PR stands on its own as a safety net for any DCP.

Assisted-by: LLM (Claude:Opus 5.5)

RyanTheTide and others added 2 commits November 21, 2026 02:04
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 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.

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 unless apple_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
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants