Repository navigation
accel/ane: enable the base M2 Neural Engine (replaces #633) - #694
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bothlinux/of_address.hfor the T8112 gate resource lookup andlinux/of_platform.hfor the newer preflight path. Preserve #669's H16 firmware and H17 ownership refusal behavior. The other SoCs retain their existing power-gate behavior.Validation:
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