Skip to content

iommu/apple-dart: add T8152 ANE Cold Gen3 DART support - #3863

Merged
DjDeveloperr merged 3 commits into
aurora-silicon:mainfrom
lookevink:feat/t8152-ane-dart
Dec 2, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-silicon:mainfrom
lookevink:feat/t8152-ane-dart

Conversation

@lookevink

@lookevink lookevink commented Dec 2, 2026 •

Copy link
Copy Markdown

What: Add the apple,t8152-ane-dart compatible and Cold Gen3 DART support for Apple T8152 (M6) ANE0 and ANE1, cold-initializing stream 0 with native four-level 42-bit page tables and stream-scoped power-up restore.
Tested: At ed3899c2b, all 24 DART host tests passed on arm64 Linux. The ISP test passed its runtime restore and managed-link checks and caught all three negative controls. Strict checkpatch reported 0 errors, warnings, or checks on the fixture change. At ab61b834c, drivers/iommu/apple-dart.o builds clean with ARCH=arm64 LLVM=-22 W=1, checkpatch.pl --strict passes with 0 errors/warnings, and ARM64 QEMU KUnit (jpeg + apple-dart-firmware-leaf) passes 15/15. Equivalent apple,t8152-ane-dart Cold Gen3 implementation hardware-qualified on J873g M6 Mac mini (apple,t8152, 7.3.0): all 8 DART instances (4x ANE0 + 4x ANE1) probe and translate concurrently with 0 DART faults, bit-exact fp16 execution across both engines (4,429 calls/s), clean driver unload, and reboot persistence.
Risk: one-way door (new DT compatible apple,t8152-ane-dart) · M6 (T8152) only; zero behavioral change for any existing DART compatible or other Mac.
Not yet: Live boot on J873g M6 at the current head ed3899c2b, and follow-up T8152 ANE / multi-slot PSD device-tree nodes.

Details

Each T8152 ANE engine (ane0 and ane1) sits behind four Gen3 DART instances (dart-ane at 0x419800000..0x419860000, TLBI 0x200000000, IRQ 789; dart-ane1 at 0x481800000..0x481860000, TLBI 0x200000080, IRQ 837), each with 16 streams, version 0x300, 42-bit VA/PA width (four_level = true), ADT apple,tunable records, and ADT vm-base = 0x10000000000 / vm-size = 0x30000000000.

Unlike apple,t8152-avd-dart (which clamps to a 36-bit 3-level 64 GiB window), T8152 ANE needs native four-level 42-bit translation (cold_gen3_4level = true) so ANE firmware mapped at 0x10000000000 (1 TiB) and fixed HWX program surfaces (e.g. 0x30000000) translate simultaneously without 36-bit aliasing or -ERANGE.

  • Binding (Documentation/devicetree/bindings/iommu/apple,dart.yaml): adds apple,t8152-ane-dart to the Gen3 reg-names: [dart, tlbi] group and requires power-domains, apple,dma-range, and apple,tunable (same schema contract as apple,t8152-avd-dart).
  • Driver (drivers/iommu/apple-dart.c):
    • Sets cold_gen3 = true, cold_gen3_sids = BIT(0), cold_gen3_4level = true, and restore_on_power_up = true for apple,t8152-ane-dart.
    • Verifies !locked, version == 0x300, num_streams == 16, four_level == true, tunables != NULL, dev->pm_domain != NULL, and inactive SID0 at probe.
    • Skips the 36-bit clamp in __apple_dart_finalize_domain() when cold_gen3_4level is set.
    • Saves/restores only owned cold_gen3_sids (SID0) across power cycles with stream-scoped TLB invalidation, leaving all existing apple,t8152-{avd,disp-isoc,acio,pciec}-dart and non-Gen3 paths untouched.
Evidence

Local verification on ab61b834c (rebased on origin/main f53f2fe9d):

$ ./scripts/checkpatch.pl --strict --git HEAD~2..HEAD
Commit e2c500334be6 ("dt-bindings: iommu: apple,dart: add apple,t8152-ane-dart")
total: 0 errors, 0 warnings, 0 checks, 33 lines checked

Commit ab61b834c52e ("iommu/apple-dart: add T8152 ANE Cold Gen3 DART support")
total: 0 errors, 0 warnings, 0 checks, 97 lines checked

$ make -j8 O=/tmp/aurora-pr3-out ARCH=arm64 LLVM=-22 W=1 drivers/iommu/apple-dart.o
  CC      drivers/iommu/apple-dart.o   (0 warnings)

$ ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options=LLVM=-22 \
    --kunitconfig=drivers/media/platform/apple/jpeg/.kunitconfig --jobs=8
[PASSED] apple-dart-firmware-leaf (1 subtest)
[PASSED] apple-jpeg (14 subtests)
Testing complete. Ran 15 tests: passed: 15

Hardware qualification on J873g M6 Mac mini (apple,t8152, 7.3.0) with the equivalent Cold Gen3 ANE DART implementation and dual-engine ane_h18 (owned_fw=1):

  • All 8 ANE DART instances (419800000..419860000 + 481800000..481860000) probed and bound to ane0 and ane1 (SID0 only).
  • Concurrent dual-engine stress (800 calls across ane0 + ane1): 4,429 calls/s steady-state, bit-exact fp16 (mismatches=0, max_abs_err=0), 0 DART faults.
  • Simultaneous dual-program residency & switching (0x30000000 + 0x31000000 alongside 0x10000000000 firmware IOVA): 200 interleaved calls on both engines, 0 errors.

Kevin loo added 2 commits December 1, 2026 17:59
Document the Apple T8152 ANE Gen3 DART compatible ("apple,t8152-ane-dart").
Like apple,t8152-avd-dart, each T8152 ANE DART instance starts unlocked
with inactive streams, uses the shared Gen3 TLB invalidation aperture
("tlbi"), and requires power-domains, apple,dma-range, and apple,tunable.

Signed-off-by: Kevin loo <kevin@loo.ski>
Add support for "apple,t8152-ane-dart" (the four-instance Gen3 DARTs
serving ANE0 and ANE1 on Apple T8152 / M6):

- Cold-initialize stream 0 only (cold_gen3_sids = BIT(0)), verifying
  version 0x300, 16 streams, four-level support, ADT tunables, an
  attached PM domain, and inactive stream 0 at probe.
- Keep native four-level 42-bit page tables (cold_gen3_4level = true)
  rather than clamping to a 36-bit 3-level window, matching the ADT's
  1..4 TiB ANE DMA aperture and allowing ANE firmware at 0x10000000000
  and fixed HWX surfaces (e.g. 0x30000000) to translate concurrently.
- Set restore_on_power_up so runtime PM resume re-applies tunables and
  restores only owned cold_gen3_sids TTBR/TCR state followed by a
  stream-scoped TLB invalidation.

Signed-off-by: Kevin loo <kevin@loo.ski>
@lookevink
lookevink requested review from a team as code owners December 2, 2026 02:02
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at ed3899c2: ready to merge

Check Detail
CI at head ok 5 checks passed
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok in the PR body at ed3899c2
Conflicts ok none
PR text ok Risk: one-way · (new DT compatible apple,t8152-ane-dart) · M6 (T8152) only; zero behavioral change for any existing DART compatible or other Mac.

Areas: area:gpu, area:platform
Merge: gh pr merge 3863 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

DjDeveloperr
DjDeveloperr previously approved these changes Dec 2, 2026

@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.

Reviewed ab61b83. Every new path is selected by the new apple,t8152-ane-dart compatible, so the existing T8152 AVD/ISOC/ACIO/PCIe-C DARTs and older DARTs are untouched, and no device tree uses the compatible yet. The binding follows the AVD entry.

One thing to settle in the follow-up that adds the ANE nodes: the new cold_gen3_4level branch in apple_dart_resume() returns before apple_dart_dapf_replay() and the resume tunables that the normal power-up path runs. If the ANE DARTs lose their address filter or tunables when the PSD domain goes off, the first DMA after a runtime power cycle will fault. Please include a runtime power-off/on cycle (ANE idle long enough for the domain to drop, then a run) in that PR's J873g row.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 2, 2026
@DjDeveloperr

DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Local merge-tree check while hosted CI is queued (main a2cc412 + ab61b83, pc). This holds the merge:

  • host-tests fail. tools/asahi/run-host-tests.py --only dart gives 23/24: apple-dart-isp-host-tests no longer compiles. That harness pulls apple_dart_save_state() out of apple-dart.c, and the function now reads dart->cold_gen3_4level and dart->cold_gen3_sids. The harness's mock struct apple_dart (tools/asahi/apple-dart-isp-host-tests.py:180) has neither field (error: 'struct apple_dart' has no member named 'cold_gen3_4level'). main alone passes. With the two fields added to the mock, all 24 pass:
     	bool full_errors;
    +	bool cold_gen3_4level;
    +	u32 cold_gen3_sids;
    The hosted host-tests job will fail the same way. Please add this to the PR (the new push needs a fresh approval).
  • dt-checks pass: scripts/dtc/apple-dt-check.sh base vs merge, 141/141 DTBs, 0 new CHECK_DTBS warnings, dt_binding_check on apple,dart.yaml ok. ADT coverage, DART power-domain and sibling-drift checks show nothing new, and their self-tests pass.
  • apple-build passes: CI config, drivers/iommu/ drivers/media/platform/apple/ drivers/gpu/drm/apple/ drivers/soc/apple/ build. W=1 apple-dart.o has 0 warnings. The jpeg KUnit config plus APPLE_DART_KUNIT_TEST builds clean. The suite itself was not run here because our build hosts have no QEMU.

Update 14:15 UTC, head ed3899c2b731: the failure above is fixed. These checks ran on pc on merge tree d235552782b7, which is main deedd80 + ed3899c:

  • run-host-tests.py --only dart in the host-tests image: 24/24 passed.
  • W=1 build of drivers/iommu/apple-dart.o at main and at the merge tree: both build with 0 warnings and 0 errors.
  • dt_binding_check DT_SCHEMA_FILES=iommu/apple,dart.yaml: clean.

main has moved 7 commits to 1bbc24cda27f since then, and none of them touches iommu or DART files. Hosted apple-build, dt-checks and host-tests were skipped at this head, so these local runs replace them. The one item left before merge is this PR's own Not yet line: a J873g live boot at ed3899c2.

The ISP host test compiles apple_dart_save_state() against its own
struct apple_dart. Add the four-level flag and SID mask that the
function now reads. The zero-initialized ISP fixture keeps exercising
the ISP save path.

Signed-off-by: Kevin loo <kevin@loo.ski>
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at ed3899c2b7319281c3ccb73bda8e2876cec8b333
Blockers: none
Checked: no Apple material, no inappropriate model gating, apple,dart.yaml schema, apple-dart.c cold_gen3_4level probe/finalize/save/resume paths, apple-dart-isp-host-tests.py mock fix, local build/DT/KUnit/host-test and J873g qualification receipts, PR text

Evidence
  • Documentation/devicetree/bindings/iommu/apple,dart.yaml: adds apple,t8152-ane-dart to the Gen3 reg-names: [dart, tlbi] group and requires power-domains, matching apple,t8152-avd-dart.
  • drivers/iommu/apple-dart.c: all new logic is selected strictly by apple,t8152-ane-dart (no DT node in the tree uses it yet; existing DART compatibles are unchanged). Probe validates !locked, version == 0x300, num_streams == 16, four_level, tunables, dev->pm_domain, and inactive SID0; __apple_dart_finalize_domain() skips the 36-bit clamp when cold_gen3_4level is set; apple_dart_save_state() and apple_dart_resume() scope save/restore and TLB invalidation to owned cold_gen3_sids (BIT(0)).
  • tools/asahi/apple-dart-isp-host-tests.py (ed3899c2b7): adds cold_gen3_4level and cold_gen3_sids to the mock struct apple_dart with zero kernel diff from ab61b834c52e, fixing the earlier host-test compile failure (24/24 DART host tests pass).
  • Checks & receipts: pr-readiness green (MERGEABLE, zero conflicts; note hosted apple-build/dt-checks/host-tests/KUnit were skipped on this fork PR while local merge-tree dt-checks 141/141, W=1 apple-dart.o 0 warnings, 15/15 QEMU KUnit, 24/24 DART host tests, and J873g 8-instance dual-engine qualification passed). As noted on the prior review, please include a runtime PSD power-off/on cycle when the follow-up T8152 ANE DT PR lands to confirm DAPF/tunables retention on cold_gen3_4level resume.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local merge-tree receipt for head ed3899c2b7319281c3ccb73bda8e2876cec8b333. Hosted CI was cancelled, so these are the local checks under the 12-02 hosted-CI override.

  • Tree compare git diff --name-status ab61b834c52e ed3899c2b731: only tools/asahi/apple-dart-isp-host-tests.py changes (the two mock fields). The kernel diff from ab61b834 is zero.
  • Merge tree: main 1bbc24cda27f + this head = 16ddd2f067db (tree 6ee9febf2577), clean. Main touches none of this PR's files. It did change linux/soc/apple/sleep.h and linux/suspend.h, which apple-dart.c includes, so the build below ran on this tree.
  • host-tests: tools/asahi/run-host-tests.py --only dart in the host-tests.yml image (--network=none): 24/24, including apple-dart-isp-host-tests.
  • apple-build: arm64 defconfig + asahi.config, LLVM=1 (clang 23.1.3), W=1 drivers/iommu/apple-dart.o: 0 warnings, 0 errors. Main deedd808 also gives 0.
  • dt-checks: make dt_binding_check DT_SCHEMA_FILES=iommu/apple,dart.yaml on main deedd808 + this head (d235552782b7): clean. No binding or scripts/dtc file changed on main after that. The binding is unchanged since the full CHECK_DTBS run in the 07:22 comment (141/141 DTBs, 0 new warnings), and no device tree uses apple,t8152-ane-dart yet.
  • KUnit apple-dart/jpeg: not run here, because our build hosts have no QEMU. The kernel code is unchanged since the author's arm64 run at ab61b834 (15/15).

Merging under the hosted-CI override.

@DjDeveloperr
DjDeveloperr merged commit 340bb06 into aurora-silicon:main Dec 2, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants