Repository navigation
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
Draft
RyanTheTide wants to merge 3 commits into
RyanTheTide wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_v27becomesfw_live_protand the helper becomes__apple_dart_fw_live_prot(). No functional change.iommu: apple-dart: keep the firmware roots of any locked T8132 DART:fw_mirrornow 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 T8132fw_mirrorDART also getsfw_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
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 renamedapple_dart_test_fw_live_protalso passes.tools/asahiapple-dart-fw, -fw-harness, -range, -dapf and -tlb-stall all pass.drivers/iommu/apple-dart.o, W=1, clang 22 (fleet79 config), no warnings. checkpatch --strict is clean on all three commits.Still to run
This needs an M4 mini owner.
Detail
4b4cf9ebplus its merge fix-ups, is rewritten here rather than cherry-picked. Theapple_dart_serves_v27_dcp()generalisation and thet8132_dcpext_v27flag are gone, because the selection no longer needs them.apple,t8132-dartthe 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)