Skip to content

accel/ane: T6050: pin the firmware code, and admit the 27.2 build - #1957

Open
erikwb wants to merge 2 commits into
integration/aurorafrom
j716c/ane-t6050-pin
Open

erikwb wants to merge 2 commits into
integration/aurorafrom
j716c/ane-t6050-pin

Conversation

@erikwb

@erikwb erikwb commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Lets the T6050 ANE start on the J716c (M5 Max) and on the macOS 27.2 (26B123) firmware build.

Stacked on #1899 (T8142 27.2 build): this branch carries its commit, rebased onto current integration/aurora, and uses its per-build entries (next_build, selected by the handed-over preload layout) and code pins (text_code_pin, TEXT digest with the loader-filled text_env sections zeroed). Merge #1899 first.

Change

  • The T6050 27.0 (26A428) TEXT has two sections iBoot fills: ce_env (0x4000 at 0xb8280) and text_env (0x20 at 0xbc280). The J716c loads different bytes there than the J714s, so its TEXT as loaded matched no pin. The 27.0 entry gets a code pin over the image with both zeroed, which admits either board; the J714s's measured text_pin stays.
  • New 27.2 (26B123) entry: TEXT 0xbc000 and DATA 0x2b0000, DATA at 0x100_000b_c000, sections at 0xb4f80 and 0xb8f80, its own code pin.
  • The T6050 fields shared by both builds move into ANE_T6050_PLATFORM, as accel/ane: T8142: admit the macOS 27.2 (26B123) firmware build #1899 does for T8142. Nothing else changes for T8140, T8142 or H16.
  • KUnit: each T6050 build admits its own preload layout and refuses the other's, and has a code pin over two ordered sections inside TEXT.

Both code pins are computed from the firmware image in the restore image (h17_ane0_fw_hyperion_j71y).

Testing

On a J716c (M5 Max, 128 GB), one kernel (this branch, #1956, #2162 and #2177 on integration/aurora 59b02d5), through both stubs:

  • 27.0: firmware 27.0 26A428, TEXT code sha256 f8141439… (code pin), hand-off verified, /dev/accel/accel0, H17 add-128 1000/1000 runs bit exact, no DART fault, oops or warning.
  • 27.2: firmware 27.2 26B123, TEXT code sha256 9f3cc82b… (code pin), same results. Before this change, 27.2 was refused (layout differs).
  • ANE KUnit, arm64 under QEMU with the driver built in: ane-fw-platform 5/5 including the new case; every ANE suite passes except ane-h16-program's program_add128_slots_test, which fails the same way on the base.
  • checkpatch --strict: clean.
  • Not tested on hardware: the J714s (its measured pin is unchanged), and system sleep with the ANE on 27.2.

🤖 Generated with Claude Code

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

M5 Pro (J714s, T6050) validation of 4189e41. The J714s cold-boot path still works with this change. I'm requesting changes for the merge conflict.

What I checked

Code read. I read both commits on this branch (#1746's d927a32 and 4189e41) for J714s and for the other H17 staged SoCs.

  • J714s admission. The J714s 27.0 hand-off (TEXT 0xc0000 at 0x100_0000_0000, DATA 0x2ac000 at 0x100_000c_0000) matches the "27.0" entry on layout and on TEXT digest, so it gets the same pin as before.
  • The J716c and 27.3 entries. The "27.0 J716c" entry has the same layout but a different pin, so a J714s TEXT can't select it. The 27.3 entry has a different layout.
  • Reload path. ane_fw_reload_segment() now reads b->text_pin. Only a successful ane_fw_preload() sets it, so the sleep/wake reload never sees NULL.
  • T8140 and T8142. They have no build table, so they keep the single layout-and-pin check.
  • All H17 staged SoCs. Two things change for every one of them:
    • the IPC mapping grows from 64 KiB to 80 KiB (up to ANE_FW_HEAP_DVA);
    • the size written at init+0x50 now comes from the firmware's request instead of the fixed 0xc441. On 27.0 the value is the same.

Compile. I built pull/1957/head on our Ryzen build server (arm64 defconfig + asahi.config, Image modules dtbs). make rc=0. ane_fw_cold.o, ane_fw_platform.o and ane_t6021.ko were rebuilt, with 0 warnings in drivers/accel/ane.

M5 Pro hardware: pass.

  • Build. I applied the two commits to the M5's default kernel tree, where ane_fw_cold.[ch] and ane_fw_platform.[ch] are identical to this PR's base. ane_t6021.ko was built natively on the M5.
    • Against a control build of the unchanged sources, only ane_t6021.ko differs. The other ANE modules are byte-identical.
    • Its imports, depends and aliases match the stock module's.
  • Boot. I rebooted the unchanged default set once, with only that module swapped in. That boot sat between two boots on the stock module.
  • PR module:
    • The log shows loader hand-off verified (27.0 build, TEXT sha256 93ae3a37…), READY; IPC 0xc441 bytes requested and up at boot, accel node ready, and /dev/accel/accel0 exists.
    • H17 add-128 passed 1000/1000 runs exact (128/128 lanes, 0 ulp), p50 132 us. I used ane-run.py with every run compared to the expected output; stock compares only the first and last runs.
    • There was no ANE or DART fault, oops or warning, either during the boot or during the runs.
  • Stock module, before and after: the same hand-off, and 1000/1000 exact (p50 175 and 166 us).
  • Restore. I restored and verified the default boot afterwards.
  • Not tested:
    • system sleep with the ANE running;
    • the 27.3 entry (this M5 boots 27.0).

Findings

  1. Blocking: the branch conflicts with integration/aurora in ane_fw_handoff_present() (drivers/accel/ane/ane_fw_cold.c:2137-2188 on this branch). Because of the conflict, GitHub runs no CI on this PR.

    • What changed on the tip. 79e1e9f ("accel/ane: Describe the T8142 (M5) ANE on the H17 staged backend") changed the same function after this branch's base. It now hashes the handed-off TEXT even when the layout isn't this SoC's, and adds a second line with both segments' physical and DVA ranges, so one boot of a new SoC or firmware reports both.
    • What this branch does. It hashes only under if (layout), so taking this side would drop that diagnostic again.
    • Suggested fix. Please rebase #1746 and this PR onto the tip and keep the tip's behaviour:
      • compute layout;
      • hash whenever regions_ok;
      • pick the build with the digest;
      • print h.text_digest in the tip's two diagnostic lines (the tip's local digest[] no longer exists here).
    • The other files. ane_fw_platform.[ch] merge cleanly.
  2. Ryan's open point on #1746 still applies to this branch's copy of d927a32. ane_fw_boot() passes the whole 80 KiB b->ipc window to ane_fw_transport_init() (ane_fw_cold.c:1748-1749). The channel table is therefore bounded by the window, not by the ipc_bytes the firmware asked for, which is now also written at init+0x50.

  3. Nit. H17 ANE: READY; IPC %#llx bytes requested (ane_fw_cold.c:1727) is a dev_info. ane_fw_boot() also runs in every cold cycle (:789): each resume, and each wake of a parked engine on SoCs with macos_sleep. So the line repeats on every wake. dev_dbg would fit, like the "ANE boot: READY" line above it, or printing it once per boot.

Once the branch is rebased and CI is green, I'll re-run the M5 check on the new head.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The production boot stub pins at macOS 27.2 (26B123), so please retarget this to 27.2. This pins the J716c 27.0 ANE preload; please add the J716c 27.2 build.

@erikwb
erikwb marked this pull request as draft November 17, 2026 15:06
@erikwb
erikwb force-pushed the j716c/ane-t6050-pin branch 2 times, most recently from 8402290 to 09ebba3 Compare November 17, 2026 21:01
@erikwb

erikwb commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr: this is now one commit on current integration/aurora (59b02d5), no longer stacked on #1746 (closed). So:

  1. The ane_fw_handoff_present() conflict is gone; the tip's behaviour there is unchanged by this PR.
  2. The 80 KiB IPC window and init+0x50 change came from accel/ane: T6050: admit the macOS 27.3 beta 1 (26C5035r) firmware #1746's d927a32, which isn't in this branch.
  3. Same for the READY; IPC … bytes requested line.

Re-tested on the J716c with #1956 and #2162: hand-off verified, 1000/1000 add-128 bit exact, no faults.

@RyanTheTide: understood on 27.2. This PR only adds the J716c's 27.0 pin; the J714s's pin and the selection are unchanged. A J716c 27.2 entry needs the preload measured on a J716c booted through the 27.2 stub (layout and TEXT digest; on the J815 the 27.2 layout differs). This one isn't on the 27.2 stub yet. I'll add the 27.2 entry once it's measured, here or as a follow-up, whichever you prefer.

🤖 Generated with Claude Code

m0d16l14n1 and others added 2 commits November 17, 2026 18:27
The macOS 27.2 (26B123) stub's iBoot preloads a different ANE build on
the M5: TEXT 0xbc000 and DATA 0x2b0000, DATA at 0x100_000b_c000 (27.0:
0xc0000 and 0x2ac000 at 0x100_000c_0000); both end at the same IOVA.
macOS 27.2.1 (26B131) ships the same image byte for byte.

The TEXT pin so far is the digest of TEXT as loaded, which can only be
measured: iBoot fills environment sections in TEXT, so no IPSW image
hashes to it. Add a code pin beside it, the TEXT digest with those
sections zeroed, which is computed from the image, and accept TEXT
matching either. The 27.0 build has one such section, text_env (32
bytes, a fixed 00 01 .. 07 pattern in the image). The 27.2 build adds
__TEXT,ce_env (0x4000 bytes at 0xb4f80, zero in the image but its first
byte) ahead of text_env, and iBoot fills it too, so a platform lists its
environment sections as ranges. On a code pin miss the driver logs the
digest of the TEXT before the first of them, which tells a loader write
elsewhere from a different build in one boot.

Let a platform name further builds (next_build), each with its preload
layout and pins, and select the one whose layout the loader handed
over. T8142 gets the 27.2 build, pinned by its code digest from
h17_ane_fw_theia_j73y (RTKit 3514.41.1), and 27.0 keeps its measured
pin with its code pin added. A reload after sleep now compares TEXT
with the digest it had at boot. Each boot logs the build and its code
digest.

Tested on J815 with the 27.2 stub: "firmware 27.2 26B123, TEXT code
sha256 9b574867... (code pin)", loader hand-off verified, and an H17
program's output matches macOS's (1080p frame, luma 100% within 1).
The ANE KUnit suites pass. Not re-run on 27.0: its code pin is computed
from the 27.0 image and hasn't been checked against a live preload, and
its measured pin is kept unchanged.

Signed-off-by: Nick <nekreshen@yandex.ru>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e862711)
The T6050 27.0 (26A428) TEXT has two sections iBoot fills: ce_env
(0x4000 at 0xb8280) and text_env (0x20 at 0xbc280). The J716c (M5 Max)
boots the same build as the J714s with the same layout, but its TEXT as
loaded matches no pin, so the driver left the engine off.

Give the 27.0 build the firmware's code pin: the image's TEXT digest
with both sections zeroed. A board's TEXT is admitted if its digest with
those sections zeroed matches; the J714s's measured pin is kept. Add the
macOS 27.2 (26B123) build: TEXT 0xbc000 and DATA 0x2b0000 with DATA at
0x100_000b_c000, its two loader-filled sections at 0xb4f80 and 0xb8f80,
and its own code pin. The handed-over layout selects the build.

KUnit: each T6050 build admits its own preload layout and refuses the
other's, and has a code pin over two ordered sections inside TEXT.

Developed with Claude Code.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb force-pushed the j716c/ane-t6050-pin branch from 09ebba3 to c2b4683 Compare November 17, 2026 23:44
@erikwb erikwb changed the title accel/ane: T6050: admit the J716c's 27.0 preload accel/ane: T6050: pin the firmware code, and admit the 27.2 build Nov 17, 2026
@erikwb

erikwb commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@RyanTheTide: done. The J716c 27.2 (26B123) build is in, and checked on the J716c booted through the 27.2 stub: admitted by its code pin, 1000/1000 add-128 bit exact. The 27.2 preload layout differs from 27.0's (TEXT 0xbc000, DATA 0x2b0000 at 0x100_000b_c000), so this now uses #1899's per-build entries and code pins and is stacked on it. The code pin also covers the J716c's 27.0 TEXT, so the per-board pin list is gone.

🤖 Generated with Claude Code

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.

4 participants