Repository navigation
iommu/apple-dart: import a locked four-level root before the core's reservations - #3686
Conversation
…eservations A boot loader that hands over a running co-processor on a locked four-level stream re-exports the firmware's own buffers (its RTKit system buffers) as iommu-addresses. Their DVAs sit in the root slot the firmware holds, as every DVA the firmware placed does. The domain imported a locked root at finalize only for a three-level table. For a four-level one the core's iommu_create_device_fw_mappings() found nothing at those DVAs, copied the buffers into Linux's own table in the same root slot, and the first attach then refused to publish that slot (apple_dart_publish_root(): a slot firmware holds that has no recorded three-level leaf), so iommu_setup_default_domain() warned and the DART failed to probe with -EBUSY. The co-processor's consumer then defers on it for good. Import the four-level root at finalize too, on a DART that records the firmware's four-level subtrees (fw_tree). iova_to_phys then resolves the re-exported buffers through those subtrees, the core leaves them to the firmware, apple_dart_get_fw_resv_regions() keeps the slot out of IOVA allocation, and the attach publishes nothing into it. A four-level root without recorded subtrees is left to the attach as before. The KUnit cases build such a stream (a firmware page under root entry 16) and check that the finalized domain resolves the page, that the attach-time sync leaves the firmware slot alone, and that a Linux copy of the page in that slot is still refused; and that a DART without recorded subtrees does not import early. Signed-off-by: Satya Benson <[email protected]>
|
J775c trial row at this head ( The DART fix works. dcpext0's DART ( Next stop: apple-dcp refuses the live session: Stage 2 printed |
|
J775c end-to-end row with this PR + #3689 + #3682: #3689 (comment) |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at 3be2702b
Blockers:
Apple build and KUnitCI is still queued at3be2702b.Host tests,pr-text, andpr-readinesspassed, whileApple build and KUnitis still queued.- Missing second-generation Mac regression row (
Not yet).drivers/iommu/apple-dart.cis shared across all Apple Silicon Macs; please post a regression boot row on a non-T6050 Mac alongside the J775c 30-boot HDMI proof (confirming 3-level and non-fw_treeDARTs are unaffected).
Checked:
- Full 2-file diff (
drivers/iommu/apple-dart.c,drivers/iommu/apple-dart-test.c,+160/-3),MERGEABLEagainstmain. __apple_dart_finalize_domain()extends root import ton_levels == 4strictly whenstream->dart->locked && (fw_handoff || fw_mirror) && stream->dart->fw_tree, leaving 3-level and non-fw_treeDARTs unchanged;apple_dart_test_four_level_live_importexercises the locked 4-level root import path.
Evidence
- Code is minimal, well-gated (
four && !stream->dart->fw_tree), and backed by ~30 J775c boots with#3689+#3682+aura#605; awaiting queuedApple build and KUnitCI and a second-generation regression boot row.
|
PASS — J773g (M4 Mac mini, three-level DARTs) one-shot boot of #3689 head
|
|
The 12 KUnit jobs in run 46353355395 waited about four hours for a runner and were cancelled without starting any tests; every job that did run passed. I reran the cancelled jobs at the same head |
|
Both blockers from the HOLD at |
There was a problem hiding this comment.
Verdict: MERGE at 3be2702b4d0c
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - Full 2-file diff (drivers/iommu/apple-dart.c, drivers/iommu/apple-dart-test.c, +160/-3), MERGEABLE against main.
__apple_dart_finalize_domain()extends root import ton_levels == 4strictly whenstream->dart->locked && (fw_handoff || fw_mirror) && stream->dart->fw_tree, leaving 3-level and non-fw_treeDARTs unchanged;apple_dart_test_four_level_live_importexercises the locked 4-level root import path.
Follow-ups (not blocking): queued Apple build/KUnit (2nd-gen regression row not required)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed at 3be2702b4d0c. The early import is limited to locked four-level streams with a recorded firmware tree. The three-level path and four-level streams without a firmware tree keep their existing behavior. The two KUnit cases cover both four-level paths. Apple build checks passed, and the J775c target and J773g regression rows cover the handoff.
A boot loader that hands a running display co-processor over on a locked four-level DART stream (T6050: the external DCPs' firmware DARTs, TCR four-level, firmware mapped under root entry 16 at 1 TiB) re-exports the firmware's RTKit system buffers as
iommu-addresseson the DCP. Their DVAs sit in the root slot the firmware holds.The domain imported a locked root at finalize only for a three-level table. For a four-level one,
iommu_create_device_fw_mappings()found nothing at those DVAs and copied the buffers into Linux's own table, in that same root slot. The first attach then refused to publish the slot (apple_dart_publish_root(): a firmware slot with no recorded three-level leaf), soiommu_setup_default_domain()warned (iommu.c:3242, MUST_SUCCEED attach) and the DART failed to probe:The other external DCP's DART on the same machine, with the same parameters and also handed off but without a live RTKit session (so no re-exported buffers), registers.
This imports the four-level root at finalize too, on a DART that records the firmware's four-level subtrees (
fw_tree).iova_to_physthen resolves the re-exported buffers through those subtrees, so the core leaves them to the firmware;apple_dart_get_fw_resv_regions()keeps the slot out of IOVA allocation; and the attach publishes nothing into it. A four-level root without recorded subtrees is left to the attach as before, and three-level roots are unchanged.Two KUnit cases build such a stream (a firmware page under root entry 16): the finalized domain resolves the page, the attach-time sync leaves the firmware slot alone, a Linux copy of the page in that slot is still refused with -EBUSY (the boot failure), and a DART without recorded subtrees does not import early.
Tested: KUnit
apple-dartsuite on arm64 QEMU with 16K pages (CONFIG_APPLE_DART_KUNIT_TEST): 38/38 pass at the PR head; with onlyapple-dart.creverted tomain,apple_dart_test_four_level_live_importfails (the domain does not resolve the firmware page, as on the boot above).checkpatch --strictclean. On hardware: an M5 Max Mac Studio (J775c) kernel ofmain+ this head + #3689 + #3682, with the HDMI handoff from aura#605, has booted about 30 times since Nov 30 on the default command line: the dcpext0 DART registers (noiommu.cwarning, no probe failure), the DCP binds, and the HDMI display shows the console and the greeter.Regression: J773g (M4, three-level DARTs), a boot of #3689's head (which contains this head): all 17 DART instances register, no
iommu.cwarning, display, NVMe and GPU as onmain, 0 failed units (#3686 (comment)).Not yet: nothing.
Risk: two-way door. Changes when a locked four-level root is imported on DARTs with
fw_tree(T6050 display DARTs); other DARTs and three-level roots are unchanged.