Skip to content

accel/ane: run the Neural Engine on the base M2 (T8112) - #633

Closed
RyanTheTide wants to merge 3 commits into
aurora-wipfrom
ane/t8112-pwgate
Closed

RyanTheTide wants to merge 3 commits into
aurora-wipfrom
ane/t8112-pwgate

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This turns the Neural Engine on for the base M2 (T8112). The M1 family already runs (ane.ko), and the M2 Pro, Max and Ultra already run (ane_t6021.ko). The base M2 had the driver match data and the DT nodes, but the nodes were disabled and the driver refused at the ANE power gate.

What changes

  1. accel/ane: t6021: open the T8112 power gate around ane_sys_cpu. The T8112 has a gate word at +0x8b8 of the "set" window that reads 0x30000000 (closed) at boot. A first run on a T8112 with the nodes enabled stopped at exactly that: PWGATE closed (word 0x30000000, ane_cpu 0x1f0003ff), no DART or ANE fault. macOS clears the word after ANE_SYS is on and before it writes ANE_SYS_CPU, and sets it again after the states are off. The driver now does the same, from a genpd notifier on power-domains[0] (ane_sys_cpu, parent ane_sys), which runs at exactly those two points. It writes only the two known values and refuses anything else without a write. It is driven by the existing pwgate_off match data, so T6020, T6021 and T6022 are unchanged. No new parameter.
  2. accel/ane: t6021: say once at info level that the firmware is missing. The M2 family firmware is fetched on the machine (omarchy-ane-firmware-fetch, pinned to the 13.5 image, which matches the stub of every Asahi-installed M2) and never shipped. A machine without it got a loader warning and an error on every boot. Now it gets one info line and the probe stops before any hardware access, as before. This keeps the clean boot log on M2s that have not fetched it.
  3. arm64: dts: apple: t8112: enable the Neural Engine. ane, its mailbox, its three DARTs and the seven ANE power states.

Tested

  • Builds: drivers/accel/ane/ with W=1 (no new warnings; the two existing t2h_buf/t2h_ioq warnings are in untouched code). checkpatch --strict is clean on all three commits. A full fleet10-config build (Image, modules, dtbs) as 7.3.0-aurora-fleet10ane for the M2 test is queued on the buildbox; I will note the result here.
  • CHECK_DTBS=y for t8112-j413/j415/j473/j493: 327 warnings before and after, identical, none on the ANE nodes.
  • Not tested on a base M2 yet. The M2 here could not be rebooted tonight. Please do not merge before the M2 boot test passes. The exact test (install, firmware fetch, DTB, smoke, rollback) is in the ANE report on the Aurora host: /Volumes/AuroraS500/aurora-ctl/reports/ane-20261030/SUMMARY.md.

Note for the ref Macs: the M2 boots the DTB set in boot.bin (dtbs-04a63b117), not the kernel's, so commit 3 alone does not change what the M2 sees. The report has an ANE-enabled copy of that set's j413 DTB (only the 12 status properties differ).

M1 for comparison

On the M1 Pro (fleet10, unchanged driver) the userspace stack runs the add fixture 20/20 bit-exact, and a two-program graph (sum = a + b, y = sum * b) matches a CPU fp16 reference on 1535 of 1536 lanes over 24 cases; the one other lane is 1 ulp off.

🤖 Generated with Claude Code

The base M2 (T8112) has a power gate word at +0x8b8 of the ANE "set"
window. It reads 0x30000000 (bits 29:28 set, closed) at boot, and macOS
clears it and waits for bits 29:28 to read 0 after ANE_SYS is on and
before it writes the ANE_SYS_CPU power state. On power off it writes
0x30000000 back after the states are off. The driver only read the word
after power up and refused when it was closed, which is what a first run
on a T8112 reported: "PWGATE closed (word 0x30000000, ane_cpu
0x1f0003ff)", with no DART or ANE fault.

Do what macOS does, in its order. power-domains[0] of the T8112 node is
ane_sys_cpu, whose parent is ane_sys, so a genpd notifier on that domain
runs after ane_sys is on and before ane_sys_cpu is written (PRE_ON), and
after ane_sys_cpu is off and before ane_sys goes off (OFF). The notifier
opens the gate on PRE_ON and closes it on OFF. It writes only the two
known values: any other word fails the power up without a write, and a
gate that does not open within 100 ms is closed again and fails it. The
notifier is registered before the device link that resumes the domain.

The SoCs without pwgate_off in their match data (T6020, T6021, T6022)
are unchanged. The check after power up stays, for a boot that left
ane_sys_cpu on with the gate closed.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The M2 family ANE runs an Apple firmware image that is fetched on the
machine itself and never shipped with the kernel. A system that has not
fetched it yet is in a normal state, but the probe logged a firmware
loader warning and an error on every boot. With the T8112 node enabled
that would put two error lines in every base M2 boot log.

Request the image without the loader warning and, when the file does not
exist, log one info line that names the file and the tool that installs
it, and fail the probe with -ENODEV. This happens before any hardware
access, as before. Other load errors still log an error.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Enable the ANE, its mailbox, its three DARTs and the seven ANE power
states on every T8112 board. The driver now opens the ANE power gate in
the order macOS uses, which was the step that stopped the first run on
a T8112.

Without the firmware image the probe stops before any hardware access
and logs one info line, so a machine that has not fetched it is not
affected.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

fleet12 carried this PR (one trivial include conflict with #669, resolved by keeping both headers). The image boots clean on the M2 and the other three machines. The M2 power-gate path itself is still untested: the M2 boots the boot.bin DTB set, where the ANE nodes stay disabled, and the ANE firmware hasn't been fetched there. So ane_t6021 never binds and there is no /dev/accel. That test still needs the ANE-enabled DTB set plus the firmware fetch from the ANE report. Leaving it unmerged per the note above.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #694, merged into aurora-wip.

@RyanTheTide
RyanTheTide deleted the ane/t8112-pwgate branch October 31, 2026 14: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.

1 participant