Repository navigation
accel/ane: run the M4 (T8132) Neural Engine, enabled on the J713 - #1952
Conversation
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
left a comment
There was a problem hiding this comment.
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) takesane_fw_staged_init()for them, notane_fw_platform_preflight().ane_fw_platform_probe()(ane_fw_platform.c:437) returns throughane_fw_staged_bind()before preflight orane_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_MAXonly moves fromane_fw_cold.htoane_fw_platform.hand is still 5.ane_fw_cold.calready usedsoc->dapf_count.has_xlis read only by H16 code.- The new
apple,t8132-anematch entry doesn't match their DTs. - No T6050, T8140 or T8142 DT file is touched.
- In the binding,
apple,t6050-aneis still in both rewritten conditionals. Rewritingif/elseasif: not/thenis equivalent, given thatcompatibleis required.
T6041 (M4 Pro) behaves as before:
- It gets
dapf_count = 4andhas_xl = true, so the preflight count (!= 8), theof_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_qualifiedis true.- Its profile list is separate from the T8132 list, and
h16_profilesis 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
kunitjob runs the SEP suites, andhost-testsruns 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
-ENODEVfails the module init on the J713, as on the T6041 without a preload hand-off. All CI checks,dt-checksincluded, pass on this head.
|
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.
No change in behaviour on T6040 from the shared ane_fw_platform / H16 backend edits. |
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:
t8132-j713-pmgr.dtsi) decides domain status, so they are enabled there.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:
/dev/accel/accel0(ABI 3).tools/testing/selftests/drivers/ane/h16-run.py): 1000/1000 bit exact, about 0.14 ms a request; 0 DART faults, 0 quarantine.Also:
checkpatch --strictclean 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_checkand the J713 dtbs check pass.Developed and tested by Claude (Anthropic), working with me on the J713.
🤖 Generated with Claude Code