Skip to content

accel/ane: run the M4 (T8132) Neural Engine, enabled on the J713 - #1952

Merged
RyanTheTide merged 9 commits into
integration/aurorafrom
j713/ane-t8132-m4
Nov 15, 2026
Merged

RyanTheTide merged 9 commits into
integration/aurorafrom
j713/ane-t8132-m4

Conversation

@erikwb

@erikwb erikwb commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Runs the M4 (T8132) Neural Engine on the H16 backend the M4 Pro uses, and enables it on the J713 (MacBook Air 13", M4).

The M4 has the M4 Pro's H16 engine and firmware interface with one engine: six register windows (no aux-3), five DAPF records instead of four, and ANE_SYS at PMGR +0x570. What it needed beyond the M4 Pro:

  • Its own engine writes before the CPU starts. The AXI2AF set at engine +0x0, then its write-disable and lock bits; no XL or C1PPT set. With the T6041 values the firmware boots, but the first request never completes.
  • Its own firmware builds. The J713's 26.6.2 preload has the T6041 25G83 layout 0x4f0 bytes later in DATA, plus two records (GKTS, ECAP) whose values change on every boot; both are normalized. T8132 and T6041 never accept each other's builds (KUnit checks it).
  • The five ANE power domains for Linux. On the Airs the built-in T8132 PMGR policy (from t8132-j713-pmgr.dtsi) decides domain status, so they are enabled there.
  • System sleep cycles the engine cold, as on the M4 Pro. The F2H channels are polled.

The DART revision (0x2a2a0202), DAPF bank, scratch, doorbell and interrupt offsets and boot values match the T6041 tables.

Builds on Ryan Murray's T8132 description (binding, disabled DT node, driver recognition, dt-schema fix), kept as his commits with my sign-off added; the binding part of his DT commit is split into its own commit, and the dt-schema fix is rebased over the T8142 binding.

Needs the loader hand-off of the preload: aurora-silicon/aura#260. Without it the driver reports that the preload was not handed off and leaves the engine alone.

Testing

On a J713 (16 GB), macOS 26.6.2 firmware, one-shot test boots with the aura change; the driver code of this branch on integration ab5ff2d:

  • Identity accepted; every bring-up stage passes (preflight, map, boot, startup, program); /dev/accel/accel0 (ABI 3).
  • The pinned H16G add-128 program (tools/testing/selftests/drivers/ane/h16-run.py): 1000/1000 bit exact, about 0.14 ms a request; 0 DART faults, 0 quarantine.
  • Suspend to RAM for 30 s with the engine loaded (RTC wake): it boots again from the preload in 12 ms and add-128 passes 20/20 afterwards.

Also: checkpatch --strict clean on every commit; ANE KUnit 236/236 on x86_64 and 240/241 on arm64 with the driver built in (the skip is a GPU test), including new boot simulator cases for five DAPF records, a platform without the XL window, the T8132 engine writes and their lock within one power cycle; arm64 W=1 build with no new warnings; dt_binding_check and the J713 dtbs check pass.

Developed and tested by Claude (Anthropic), working with me on the J713.

🤖 Generated with Claude Code

RyanTheTide and others added 9 commits November 14, 2026 23:16
Extend the ANE binding for the T8132 geometry: six register windows
(no aux-3), two interrupts, five DAPF records and ane-type 0x100.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Erik Bourget <erik@ebourget.net>
Describe the M4 H16 ANE and its three DARTs from the public, Unlicense
GravityLinux ADTs, with six register windows, two interrupts and five
DAPF records. Keep the engine, DARTs and existing DAPF companion disabled.

Sources (ane / dart-ane) in GravityLinux/adt-collection at 14f45bbf1ea6:
  26.6.2/t8132-j773.txt:26993-27128
  27.0/t8132-j604.txt:25089-25218
  26.5.1/t8132-j713.txt:26711-26846
Translate arm-io register addresses by 0x200000000; DAPF ranges already
contain CPU physical addresses. T8132 has no T6041 second-engine aux-3.

Resolve power-gate 292 (ANE-SYS-V, no_ps) through its parent device 155
(ANE_SYS, psreg 5 / psidx 14) to ps_ane_sys at 0x570. Gate 396
(ANE-SYS-V-PMP, no_ps, notify_pmp) has no physical parent or PMGR power
state, so do not invent a second genpd for it. The J713 domain override
is unchanged. Default firmware IOVAs match the J773/J713 segment-ranges;
physical preload reservations must come from the loader.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Erik Bourget <erik@ebourget.net>
Select the shared H16 platform path for apple,t8132-ane with the ADT's
six resource names (no aux-3), type 0x100, two IRQs and five DAPF records.
Do not assign T6041 firmware profiles, MMIO tables or power-write words
to the unqualified M4.

Make boot qualification explicit and refuse T8132 before resource,
preload, power, IOMMU or MMIO validation. Registration-time preflight
also prevents driver-core DMA and genpd setup on an enabled node.
Existing platforms retain their behavior. Aura does not yet hand off
T8132 firmware, and an owner must qualify the single-engine backend,
IRQs, DAPF and power sequence before this platform can run.

Add a KUnit case for real preflight/probe refusal with no DT resources,
when the firmware tests and full driver are both built in.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Erik Bourget <erik@ebourget.net>
The current dt-schema meta-schema rejects the two existing ANE if/else
clauses without a then branch. Express the same exceptions as negated
compatible conditions with then branches, retaining the power-domain
and clock constraints. This lets the extended T8132 binding pass the
required schema validation.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Erik Bourget <erik@ebourget.net>
The T8132 ANE has the T6041's five domains: ANE_SYS, then the CPU,
MPM, TD and base.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The H16 backend takes ANE_SYS, then the CPU, MPM, TD and base domains,
in the T6041 order. The T8132 PMGR has the same five at the same
offsets, with ANE_SYS at +0x570.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The ANE driver powers ANE_SYS and its CPU, MPM, TD and base domains
through genpd, as on the T6041.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The M4 has the M4 Pro's H16 engine and firmware interface with one
engine: no aux-3 window, five DAPF records instead of four, and ANE_SYS
at PMGR +0x570. Take the DAPF record count and the XL window from the
platform, and describe the T8132:

- Its own engine writes before the CPU starts: the AXI2AF set at engine
  +0x0, then its write-disable and lock bits. It has no XL or C1PPT set.
  With the T6041 values the firmware boots, but the first request never
  completes.
- Its own firmware builds, never offered to the T6041 or the reverse.
  The J713's 26.6.2 preload has the T6041 25G83 layout 0x4f0 bytes later
  in DATA, plus two records (GKTS, ECAP) whose values change on every
  boot; both are normalized like the other mutable records.
- System sleep cycles the engine cold, as on the T6041.
- The F2H channels are polled.

The engine, DARTs and DAPF bank match the T6041 tables: DART revision
0x2a2a0202, the same scratch, doorbell and interrupt offsets, and the
same boot values.

Tested on a J713 (16 GB) at 26.6.2 with a loader that hands off the
preload: every bring-up stage, the pinned H16G add-128 program 1000
times bit exact (about 0.14 ms a request), and a 30 s suspend to RAM
with the engine loaded, after which it boots again from the preload and
the same program passes.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The loader fills the ANE's firmware preload reservations from the ADT.
Without them the driver reports that the preload was not handed off
and leaves the engine alone.

Signed-off-by: Erik Bourget <erik@ebourget.net>

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

M5 Pro (J714s, T6050) validation lane: this PR causes no regressions on the M5 Pro, the T8140 or the T8142. Approving; there is one non-blocking nit below.

What I checked (head d569982, based on integration/aurora fc05050)

The T6050, T8140 and T8142 platforms are ANE_FW_OWNER_EXCLAVE, so ane_fw_platform_staged() is true for them:

  • ane_rtclient_init() (ane_t6021_rtclient_main.c:4555) takes ane_fw_staged_init() for them, not ane_fw_platform_preflight().
  • ane_fw_platform_probe() (ane_fw_platform.c:437) returns through ane_fw_staged_bind() before preflight or ane_h16_backend_probe().

So none of the changed H16 code runs on those machines: the boot_qualified gate, the dapf_count loops in ane_h16_backend.c/ane_h16_boot.h, the has_xl skips and the T8132 tables. Their own inputs are unchanged:

  • ANE_FW_DAPF_MAX only moves from ane_fw_cold.h to ane_fw_platform.h and is still 5. ane_fw_cold.c already used soc->dapf_count.
  • has_xl is read only by H16 code.
  • The new apple,t8132-ane match entry doesn't match their DTs.
  • No T6050, T8140 or T8142 DT file is touched.
  • In the binding, apple,t6050-ane is still in both rewritten conditionals. Rewriting if/else as if: not/then is equivalent, given that compatible is required.

T6041 (M4 Pro) behaves as before:

  • It gets dapf_count = 4 and has_xl = true, so the preflight count (!= 8), the of_property_read_u64_array(..., 8), the four-record DAPF and map loops, the XL ioremap and the XL tunables all match the old code.
  • boot_qualified is true.
  • Its profile list is separate from the T8132 list, and h16_profiles is per platform.

Ryan's intermediate commit 3127723 already sets boot_qualified = true for T6041, so no commit in the series regresses the M4 Pro.

Compile: rig/fedora-kcheck.sh fc050503ffcd 1952 with an M5 Pro kernel config (DRM_ACCEL_ANE=m, DRM_ACCEL_ANE_H16_VALIDATION=m), arm64 LLVM, Image + modules: FEDORA-KCHECK 698c8130417e OK (merge of fc05050 + this head). vmlinux, Image and the modules linked, including ane_t6021.ko and ane_h16_program.ko. There are no warnings in drivers/accel/ane. The 36 Rust warnings in the log are all in drm/asahi and soc/apple; this PR touches no .rs file.

Hardware: I didn't run an M5 hardware smoke test, because no M5 Pro ANE path changes (see above).

Nit (non-blocking): ane_t8142_platform (drivers/accel/ane/ane_fw_platform.c:269) is the only platform left without .boot_qualified = true. Today this is harmless, since T8142 never reaches preflight. But the new gate at ane_fw_platform.c:379 runs before the exclave -ENODEV return at :392. A future caller of preflight on a staged platform would therefore get a loud -EOPNOTSUPP on the T8142 and a quiet -ENODEV on the T8140 and T6050. Either add the flag to the T8142, or move the gate below the exclave return.

Notes:

  • CI doesn't exercise the new ANE KUnit cases: the kunit job runs the SEP suites, and host-tests runs the ANE TM tests. The ANE KUnit results are the ones in the PR body.
  • The J713 needs aurora-silicon/aura#260 (still open) to boot the engine. Until it lands, preflight's -ENODEV fails the module init on the J713, as on the T6041 without a preload hand-off. All CI checks, dt-checks included, pass on this head.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Shared-backend check on our J616s (M4 Pro, T6040, the H16 backend via ane_t6021) on head d569982: the nine commits cherry-picked onto integration/aurora fc05050 (the base this branch is on; it does not apply to older integration heads because of the T8142 ANE changes), booted as a one-shot test kernel, SELinux enforcing.

  • ANE probes as before: H16 preload identity accepted, perf floor attached, /dev/accel/accel0 on 484000000.ane.
  • MobileNet (whole-model H16 program), 20 timed runs each: 3 runs after boot, top-1 16/16 PASS each time, host EXECUTE p50 0.255-0.281 ms (production kernel on the same Mac tonight: 16/16, p50 0.281 ms). After one s2idle cycle: 16/16, p50 0.249 ms.
  • 0 DART faults, 0 AVC, 0 kernel errors, 0 failed units during the run.

No change in behaviour on T6040 from the shared ane_fw_platform / H16 backend edits.

@RyanTheTide
RyanTheTide merged commit c061195 into integration/aurora Nov 15, 2026
8 checks passed
@RyanTheTide
RyanTheTide deleted the j713/ane-t8132-m4 branch November 16, 2026 05:08
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.

3 participants