Skip to content

accel/ane: support M3 (T8122) H15 27.2 ANE on shared H16 backend - #3082

Merged
RyanTheTide merged 3 commits into
mainfrom
ane/t8122-h15-27.2
Nov 24, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
ane/t8122-h15-27.2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Bring up the Apple M3 (T8122) H15 Neural Engine on macOS 27.2 (26B123) using the shared AP-direct H16 backend and HWX validator, with no chip or firmware gates and default kernel command line:

  • Bindings (0c01afde5108): Document apple,t8122-ane (single H15 engine, ane-type = 0xb0, one interrupt, three register windows engine/pmgr/aux-0, five ANE power domains, five DAPF records, preloaded firmware) and allow the T8122 27.2 (0x100000c8000) and T8132 27.2 (0x100000bc000) DATA IOVAs in apple,firmware-iovas.
  • Devicetree (0882c538809a): Add the four ANE sub-block PMGR states (ane_mpm, ane_cpu, ane_td, ane_base), three ANE DARTs (311800000/311810000/311820000), and /soc/ane@310000000 (disabled at SoC level) to T8122, and enable them on J615 (M3 Air). Mark ps_ane_sys and ps_ane_cpu with apple,no-auto-pm so PMGR does not set AUTO_ENABLE behind the cold-started firmware (clearing AUTO_ENABLE fixes the 3/3 -ESHUTDOWN CPU stop during startup SHAREDMALLOC). Companion Stage 2 preload handoff: kboot: hand off preloaded ANE firmware on T8122 (M3) aura#505 (supersedes the disabled T8122 portion of arm64: dts: apple: describe the T603x Neural Engine, enabled; accel/ane: T603x clean refusal #2331).
  • Driver & KUnit (abf39d86cf87):
    • Replace fixed H16/H17 HWX descriptor branches with a data-driven struct hwx_target table supporting H15 (0x890/0x8b0 record offsets, 8 header words, trailer BAR 5, no perf record, zero-prologue task descriptors) and 1-byte/4-byte-header task relocation.
    • Guard optional CE setup when build->ce == 0 and enable switch_safe program switching for chip_family >= 15.
    • Add ane_t8122_platform, ane_h15_mmio_t8122 (DART rev 2.0, 5 DAPF records at DART0 + 0x4000), ane_h15_build_t8122_26b123 (ASC wrapper +0x1400044, scratch +0x1840050, 27.2 firmware-requested channel table, preload tail heap, 2 ms power-gate hold, cold restart + program replay across sleep), and the J615 26B123 cross-boot preload digest pin.
    • Add KUnit tests for ane_t8122_platform, zero-CE H15 boot, and H15 HWX validation/relocation.

Tested

  • J615 (M3 Air, T8122, H15 on macOS 27.2 26B123, 7.3.0-aurora-fleet85) at abf39d86cf87: PASS — cold boot to /dev/accel/accel0 (H15, ABI 3, programs switch within one firmware boot) in 11.7 ms (0 restarts, 0 DART faults, 0 warnings); h15-add128 x200 128/128 exact (max 0 ulp, p50 163.4 us); h15-mul128 x100 switch 128/128 exact (p50 162.8 us); switch-back x20 exact (p50 160.7 us); 2x 15 s RTC s2idle cold-restart + program replay (11-12 ms resume, 0 restarts, outputs identical, 324/324 EXECUTEs, quarantined=0, error=0); dynamic aura#505 Stage 2 handoff PASS (12.2 ms boot, h15-add128 x50 exact, p50 159.0 us).
  • J616s (M4 Pro, T6040, H16 regression, 7.3.0-aurora-fleet87) at abf39d86cf87: PASS — add128 x100 16384/16384 exact (max 0 ulp, p50 180.8 us); MobileNetV1 28-task linked top-1 16/16 OK (p50 0.273 ms, firmware 0.242 ms).
  • KUnit & static checks at abf39d86cf87: drivers/accel/ane/boot.kunitconfig 272/272 PASS (incl. hwx_h15_test and ane_h16_t8122_no_ce_test); checkpatch.pl --strict --git aurora/main..HEAD 0 errors / 0 warnings / 0 checks; dt_binding_check and CHECK_DTBS=y apple/t8122-j615.dtb 0 warnings; ARM64 W=1 module builds against fleet85 and fleet87 0 warnings.

Risk

Two-way door (plain revert removes T8122/H15 support). Affects T8122 (M3 Air J615) and shared AP-direct ANE Macs (M4/M4 Pro/A18 Pro/M5; regression-verified on J616s M4 Pro). H16/H17 HWX descriptor geometry is preserved identically in hwx_targets[]. On T8122, apple,no-auto-pm applies only to ps_ane_sys and ps_ane_cpu while powered on for the ANE, and /soc/ane@310000000 remains disabled at the SoC level for boards without a verified preload pin.

Not yet

  • Preload digest pins for other T8122 boards (e.g. J613) and M3 Pro/Max/Ultra (T603x) are not yet captured.
  • Multi-task H15 convolution/MobileNetV1 HWX programs await H15 lowering support in mil-hwx-compiler.
Root-cause summary and detailed hardware metrics

Root cause of earlier J615 H15 RUN hangs and startup stops

  1. ~0.1 s SoC hang on RUN: Earlier bring-up probes mapped the ANE engine aperture with posted devm_ioremap() instead of devm_ioremap_np(), omitted the 5 identity DAPF MMIO mappings in DART, omitted IOMMU_CACHE on TEXT/DATA, and omitted the 0x14000 writable heap tail (0x1000036c000..0x10000380000). Using the shared ane_h16_backend (which uses ioremap_np, identity-maps all DAPF pages, maps TEXT/DATA with IOMMU_CACHE, and maps the preload heap tail) eliminated the wedge completely.
  2. Startup -ESHUTDOWN (CPU_CONTROL=0, STATUS=0x30002a) during SHAREDMALLOC: Unlike T8132 (where pmgr-pwrstate sets no_auto_enable) and T6041 (where ane_sys leaves AUTO_ENABLE clear), T8122 had BIT(28) (APPLE_PMGR_AUTO_ENABLE) set on both ps_ane_sys (0x1f0023ff) and ps_ane_cpu (0x1f0003ff), gating the ANE CPU 7-10 ms after RUN. Adding apple,no-auto-pm; to both DT nodes cleared BIT(28) (0x0f0023ff / 0x0f0003ff) and brought startup to 11.7 ms with 0 restarts.
  3. Cross-boot preload pin: Two independent J615 boots proved TEXT (0xc8000) is 100% byte-identical and DATA (0x2a4000) differs in only 16 bytes total (GKTS 8 B at 0x6850 and ECAP 8 B at 0x6943), so ane_h15_preload_26b123_j615 pins the full image with an empty zero range (zero_start = zero_end = 0x2a4000).

Hardware metrics

  • J615 (h15-row3, 324 EXECUTEs): firmware mean 156.3 us (min 96.3 us, max 300.9 us), ioctl mean 159.6 us, copy_in mean 1.6 us, copy_out mean 1.0 us, gate_open mean 0.6 us, gate_close mean 0.0 us (2 ms hold active), irq_wakeups=0, irq_timeouts=0.
  • J615 s2idle cold resume: Cycle 1: domains off 14.6-15.4 s, firmware ready 11 ms, first program ready 12 ms, 1 programs replayed, 0 restarts. Cycle 2: domains off 14.6-15.9 s, firmware ready 11 ms, first program ready 11 ms, 1 programs replayed, 0 restarts.
  • J616s (j616s-reg3, H16 regression): add128 100/100 exact (16384/16384, p50 180.8 us), MobileNetV1 top-1 16/16 OK (p50 0.273 ms, firmware mean 0.242 ms).

Document apple,t8122-ane (single H15 engine, ane-type 0xb0, one
interrupt, three register windows engine/pmgr/aux-0, five ANE power
domains, five DAPF records, and preloaded firmware) and allow the
T8122 27.2 DATA IOVA (0x100000c8000) and T8132 27.2 DATA IOVA
(0x100000bc000) in apple,firmware-iovas.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Add the four ANE sub-block PMGR power states (ane_mpm, ane_cpu,
ane_td, ane_base), three ANE DARTs (311800000/311810000/311820000),
and the /soc/ane@310000000 node (disabled at SoC level) to T8122,
and enable them on J615 (M3 Air).

Mark ps_ane_sys and ps_ane_cpu with apple,no-auto-pm so PMGR does not
set AUTO_ENABLE behind the cold-started ANE firmware during startup.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Wire T8122 (M3, H15 on macOS 27.2 / 26B123) directly into the shared
AP-direct H16 backend and HWX validator without chip or firmware gates:

- Replace fixed H16/H17 HWX descriptor branches with a data-driven
  target table supporting H15 (0x890/0x8b0 record offsets, 8 header
  words, trailer BAR 5, no perf record, zero-prologue task descriptors)
  and 1-byte/4-byte-header task relocation.
- Guard optional CE setup when build->ce == 0 (T8122 has no CE block)
  and enable switch_safe program switching for chip_family >= 15.
- Add ane_t8122_platform, ane_h15_mmio_t8122 (DART rev 2.0, 5 DAPF
  records at DART0+0x4000), ane_h15_build_t8122_26b123 (ASC wrapper at
  +0x1400044, scratch at +0x1840050, 27.2 firmware-requested table,
  preload tail heap, 2 ms power-gate hold, cold restart + program
  replay across sleep), and the J615 26B123 cross-boot preload digest
  pin.
- Add KUnit coverage for the T8122 platform definition, zero-CE H15
  boot path, and H15 HWX validation/relocation.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 24, 2026 15:47
@github-actions github-actions Bot added area:media Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at abf39d86: not ready yet

Check Detail
CI at head running running: dt-checks
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at abf39d86
Conflicts ok none
PR text ok Risk: two-way · (plain revert removes T8122/H15 support). Affects T8122 (M3 Air J615) and shared AP-direct ANE Macs (M4/M4 Pro/A18 Pro/M5; regression-verified on J616s M4 Pro). H16/H17 HWX descriptor geometry is preserved identically in hwx_targets[]. On T8122, apple,no-auto-pm applies only to ps_ane_sys and ps_ane_cpu while powered on for the ANE, and /soc/ane@310000000 remains disabled at the SoC level for boards without a verified preload pin.

Areas: area:media, area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

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

Verdict: FINISH at abf39d86

Blockers:

  1. CI at abf39d86: dt-checks is still IN_PROGRESS (and re-queued readiness / pr-text runs after the PR body update are still QUEUED). No code, safety, or policy blockers found; ready to approve once dt-checks and the readiness checks turn green at abf39d86.

Checked: §1–§4 and §6 pass; §5 exact-head hardware rows present for J615 (T8122/H15) and J616s (T6040/H16) at abf39d86; full diff, DT bindings/DTS, aurora-silicon/aura#505 handoff ABI, MMIO/DMA/bounds safety, cross-SoC regression impact, and commit DCO/metadata verified; CI partially complete (host-tests green, dt-checks running).

Evidence
  • Commits & attribution (§4, §6): All 3 commits (0c01afde5108, 0882c538809a, abf39d86cf87) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and matching Signed-off-by:. Zero banned names or attribution trailers in commits, diff, PR title, or PR body.
  • Bindings & DT (Documentation/devicetree/bindings/npu/apple,ane.yaml, arch/arm64/boot/dts/apple/t8122-{pmgr,peripherals}.dtsi, t8122-j615.dts):
    • apple,t8122-ane schema constraints (interrupts: maxItems 1, 3 reg windows engine/pmgr/aux-0, 5 power-domains, apple,ane-type = 0xb0, 5 apple,dapf-ranges, apple,firmware-preloaded) match t8122-peripherals.dtsi and ane_t8122_platform.
    • ps_ane_mpm (0xc000), ps_ane_cpu (0xc008), ps_ane_td (0xc010), and ps_ane_base (0xc018) fit within pmgr (0x2d0700000, size 0x14000), match ane_t8122_power_words, and match DAPF records 1–2 (0x2d0700438..0x2d070043b, 0x2d070c000..0x2d070c01b). apple,no-auto-pm on ps_ane_sys and ps_ane_cpu affects only active ANE power-on; unused domains on other T8122 boards (j613, j504, j433, j434) remain off.
    • All 5 apple,dapf-ranges are valid inclusive ranges on 5 distinct 16 KiB pages within apple,dma-range = <0x0 0x0 0x400 0x0>. ane_dart0 + 0x4000 = 0x311804000 matches disabled dart_ane_companion3 with no driver conflict.
  • Firmware handoff ABI (aurora-silicon/aura#505 at 9af9fcfb):
    • aura matches "apple,t8122-ane", checks pre-loaded == 1 on /arm-io/ane or child iop-ane-nub, reserves 16 KiB-aligned no-map regions in 64-bit /reserved-memory (present in t8122-jxxx.dtsi), and populates memory-region, memory-region-names = "firmware-text", "firmware-data", and apple,firmware-iovas = <0x10000000000 0x100000c8000>.
    • ane_fw_preload_check() and ane_h16_preload_identity() double-read stability check + patchbay normalization (GKTS, ECAP, ARcM, ABOI, ZSOI, zero_start == zero_end == 0x2a4000) + SHA-256 digest pin run before any MMIO, DMA, power, or CPU release. Note: if linux#3082 lands before aura#505, J615 safely refuses probe with -ENODATA before touching hardware (same behavior as t8132-j713.dts).
  • Driver safety & bounds (drivers/accel/ane/):
    • struct hwx_target in ane_h16_hwx.c preserves H16 (0x8a0/0x8c0, 9 header words, trailer BAR 4, perf record, tight end) and H17 (allow_zero_prologue, allow_stabs_note, allow_slot5_table, allow_zero_scratch_text_flags) behavior byte-for-byte while adding H15 (0x890/0x8b0, 8 header words, trailer BAR 5, no perf record).
    • ane_hx_task_stream_validate_hdr() checks !fixed_header_words and words >= fixed_header_words before indexing (fixed_header_words - 1) * 4; hwx_relocations_in_payload() runs only after structural validation passes.
    • ane_h16_custom_bars() bounds-checks program_offset against 0x890, 0x8b0, 0x8a0, and 0x8c0 before reads, and LOAD enforces p->hwx.subtype == s->transport->soc->hwx_subtype.
    • ane_h16_prepare() skips CE only when f->ce == 0; ane_fw_transport_switch_safe() (chip_family >= 15) leaves H16/H17 unchanged and does not affect H13/H14 drivers.
  • Cross-SoC impact: T8132/T604x (H16) and T8140/T605x/T8142 (H17) paths unchanged (regression-verified on J616s M4 Pro); T603x and T8152 untouched; non-J615 T8122 boards keep &ane disabled.
  • Non-blocking nits (follow-up only):
    • Documentation/devicetree/bindings/npu/apple,ane.yaml:284-298: consider adding apple,t8122-ane to the if: memory-region -> then: required [memory-region-names, apple,firmware-iovas] schema block (and mentioning T8122 in the power-domains / memory-region descriptions).
    • drivers/accel/ane/ane_h16_program.c:430-437: comment above ane_h16_custom_bars() still mentions only 0x8a0/0x8c0 rather than 0x890/0x8b0.
    • §5 regression rows: when updating/re-running if needed, including the explicit regression triad (0 SELinux denials, 0 failed units, 0 new kernel errors) on the J615/J616s rows keeps them completely self-contained.

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Additional exact-head regression-triad confirmation at abf39d86cf87 paired with aurora-silicon/aura#505 (68212429):

  • J615 (M3 Air, T8122, H15 27.2 26B123, 7.3.0-aurora-fleet85) at abf39d86cf87: PASS — dynamic Stage 2 handoff (05c901b2), /dev/accel/accel0 ready in 11.3 ms (0 restarts, 0 DART faults), h15-add128 x50 128/128 exact (max 0 ulp, host p50 158.3 us); regression triad: Enforcing, 0 SELinux denials (avc=0), 0 failed units, 0 new kernel errors (12 vs 13 stock baseline, identical apple-dcp/Bluetooth lines).
  • J616s (M4 Pro, T6040, H16, 7.3.0-aurora-fleet87): PASS — add128 x100 16384/16384 exact (max 0 ulp, p50 179.4 us), MobileNetV1 28-task linked top-1 16/16 OK (p50 0.257 ms); regression triad: Enforcing, 0 SELinux denials (avc=0), 0 failed units, 0 kernel errors (kerr=0).

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

Verdict: MERGE at abf39d86

Blockers: none

Checked: All 4 CI checks (dt-checks, host-tests, readiness / readiness, pr-text / pr-text) are now green at abf39d86cf87 and exact-head J615 (T8122/H15) + J616s (T6040/H16) hardware rows with the full regression triad (Enforcing, 0 SELinux denials, 0 failed units, 0 new kernel errors) are recorded. Code, DT bindings/DTS, aura#505 ABI, cross-SoC non-regression, and policy/attribution checks already passed in the prior audit at this exact head.

Evidence
  • Head: abf39d86cf87d8e82fb23e3b929cea59beb287b1 (OPEN, non-draft, MERGEABLE)
  • CI: dt-checks SUCCESS, host-tests SUCCESS, readiness / readiness SUCCESS, pr-text / pr-text SUCCESS
  • Hardware evidence: J615 (T8122/H15 27.2) + J616s (T6040/H16 regression) at abf39d86cf87, full regression triad PASS

@RyanTheTide
RyanTheTide merged commit 2ba145b into main Nov 24, 2026
8 checks passed
@RyanTheTide
RyanTheTide deleted the ane/t8122-h15-27.2 branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:media Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants