Skip to content

accel/ane: enable the base M2 Neural Engine (replaces #633) - #694

Merged
RyanTheTide merged 3 commits into
aurora-wipfrom
reland/633-ane-base-m2-20261031
Oct 31, 2026
Merged

RyanTheTide merged 3 commits into
aurora-wipfrom
reland/633-ane-base-m2-20261031

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #633 on a fresh branch from aurora-wip (aaa776fb39de4ea995aee97c93cc19040e738350). The original PR and branch remain unchanged for reviewer disposition.

Carry the three original changes: open and close the T8112 ANE power gate from the genpd notifier, report absent firmware once at info level, and enable the T8112 ANE, mailbox, DARTs and power states in DT.

The only conflict was with #669 in ane_t6021_rtclient_main.c. Keep both linux/of_address.h for the T8112 gate resource lookup and linux/of_platform.h for the newer preflight path. Preserve #669's H16 firmware and H17 ownership refusal behavior. The other SoCs retain their existing power-gate behavior.

Validation:

  • Strict checkpatch, git diff --check and exact final trailers pass for all three commits.
  • arm64 defconfig plus asahi.config, CONFIG_RUST=y, LLVM=1 and W=1: drivers/accel/ane/ builds with no C diagnostics.
  • All four T8112 board DTBs build with W=1. DTC reports the same 64 warnings in aliases, display, USB4 and sound descriptions as the pinned aurora-wip base; normalized messages and counts are identical.
  • tools/asahi/run-host-tests.py: 152/152 host runs pass, including the historical negative controls.
  • All five ANE KUnit suites execute under arm64 QEMU: 32/32 tests pass.

Base M2 ANE execution remains unverified. Enabling the kernel DT does not replace a bootloader DTB that keeps ANE disabled. A boot with the enabled DTB, firmware and an ANE smoke test remains outstanding, as in #633.

🤖 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]>
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