Skip to content

iommu: apple-dart: keep the firmware roots of any locked T8132 DART (J773g 27.2 dcpext0; replaces #2596) - #2825

Draft
RyanTheTide wants to merge 3 commits into
j713-disp3/dcp272-internalfrom
prfix2/dcp272-j773g-dcpext-r2-20261123
Draft

RyanTheTide wants to merge 3 commits into
j713-disp3/dcp272-internalfrom
prfix2/dcp272-j773g-dcpext-r2-20261123

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

On macOS 27.2 the M4 Mac mini (J773g) boot loader leaves the dcpext0 firmware DART (286340000) and display DART (286300000) locked. The plain locked path drops the firmware's root slots, so dcpext0 faults instead of lighting HDMI. #2596 kept their roots only when the dcpext carried the 27.2.0 version and the one 26B123 image UUID. That ties the choice to one macOS build, and an unlocked DART there went down the plain (reset) path while the internal one was refused. This PR replaces #2596. That branch was stacked on the closed #2590 and carries #2541's old commits through merges, so it can't be retargeted.

Change

Stacked on #2818 (#2590's replacement), three commits:

  • iommu: apple-dart: name the live-leaf protection after what it does: j713_v27 becomes fw_live_prot and the helper becomes __apple_dart_fw_live_prot(). No functional change.
  • iommu: apple-dart: keep the firmware roots of any locked T8132 DART: fw_mirror now comes from the DART's own state, as it already does for T6041/T6050/T8140/T8142: locked, no reserved-table handoff, and not one of the display DARTs borrowed on the 26.6.2 path (preserve_display). A T8132 fw_mirror DART also gets fw_live_prot. There is no firmware-version or UUID check and no dcpext lookup in the DART driver. An unlocked T8132 DART takes the plain path, as an unlocked DART does on every other SoC. The 27.2 internal display DARTs keep drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend, on #2541's rebase) #2818's behaviour (mirrored when locked, refused when not), because they are picked by their processor's handoff, which implies a lock.
  • iommu: apple-dart: read the TCR before dropping the runtime reference: Dj's non-blocking note on __apple_dart_fw_live_prot().

Testing

  • KUnit, arm64 qemu, 16K pages: apple-dart 38/38. That includes a new apple_dart_test_keeps_fw_roots, which covers locked, unlocked, handed-off and borrowed T8132 DARTs, the other mirrored SoCs (live-leaf protection on T8132 only) and two SoCs outside the rule. The renamed apple_dart_test_fw_live_prot also passes.
  • Host: the apple-dcp selftest suite passes 92/92. tools/asahi apple-dart-fw, -fw-harness, -range, -dapf and -tlb-stall all pass.
  • KUnit with appledrm built in: 284 tests (the apple-dcp-, apple-drm- and apple-display-* suites plus apple-dart), 282 pass and 2 skip. The two skipped topology overlay cases need OF_OVERLAY.
  • Build: drivers/iommu/apple-dart.o, W=1, clang 22 (fleet79 config), no warnings. checkpatch --strict is clean on all three commits.

Still to run

Detail
  • Replay: iommu: apple-dart: keep a 27.2 J773g dcpext's locked display DARTs like the J713's #2596's own change, 4b4cf9eb plus its merge fix-ups, is rewritten here rather than cherry-picked. The apple_dart_serves_v27_dcp() generalisation and the t8132_dcpext_v27 flag are gone, because the selection no longer needs them.
  • Which DARTs the rule adds: any apple,t8132-dart the boot loader left locked, outside the borrowed 26.6.2 display DARTs. Before this change, such a DART took the plain locked path, which replaces the firmware's root slots. Each one now logs the line above, so a boot shows the set.
  • apple_t8132_dcpext_v27_2() stays for the DCP driver, which still uses it to pick its firmware-27 backend. That is the DCP's interface choice, not the DART's.

Assisted-by: LLM (Claude:Opus 5.5)

The 27.2 J713 flag (j713_v27) only selects one thing now: re-exported
firmware segments take the protection of the live leaves that map them
(__apple_dart_j713_v27_fw_prot()). Nothing in that helper is specific
to the J713; it reads the DART's own locked root and leaves a region
alone unless every page's live leaf maps exactly that address with one
protection.

Rename the flag to fw_live_prot and the helper to
__apple_dart_fw_live_prot(), so it can be set for other locked display
DARTs. No functional change.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A T8132 DART kept its firmware's locked roots (fw_mirror) only when it
served an internal display processor handed over with the 27.2 image,
so the J773g's dcpext0 DARTs, which the 27.2 boot loader also leaves
locked, took the plain locked path and lost the firmware's root slots.
Keying them on the dcpext's firmware version and image UUID instead
would tie the choice to one macOS build.

Whether the roots must be kept is visible on the DART itself: it is
locked and there is no reserved-table handoff. The T6041, T6050, T8140
and T8142 DARTs already decide that way. Do the same for
apple,t8132-dart, keeping out only the display DARTs borrowed on the
26.6.2 path (preserve_display), which keep their own handling. A T8132
fw_mirror DART also gets the live-leaf protection for its re-exported
firmware segments (fw_live_prot); __apple_dart_fw_live_prot() changes
a region only where every page's live leaf maps exactly that address
with one protection. The other SoCs keep their current protection.

An unlocked T8132 DART now takes the plain path like an unlocked DART
on any other SoC, as it did before for everything but the 27.2
internal display DARTs. Those are still refused when unlocked: they
are selected by their processor's handoff, which implies a lock.

The 27.2 J713 internal display DARTs take the same path as before. A
locked T8132 DART logs "locked roots kept (mirror)", so a boot shows
which DARTs the rule picks.

KUnit: the selection for locked, unlocked, handed-off and borrowed
T8132 DARTs, the other mirrored SoCs, and two SoCs outside the rule.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
__apple_dart_fw_live_prot() drops its runtime-PM reference after the
TTBR read but reads the stream's TCR afterwards. The DART cannot gate
there today, because a consumer is attaching, but the read belongs
inside the reference. Read both, then drop it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.

1 participant