Skip to content

media: apple: ave: admit the M1 Max (T6001) encoder firmware build - #3357

Open
DjDeveloperr wants to merge 3 commits into
mainfrom
fix/ave-t6001-firmware-build
Open

DjDeveloperr wants to merge 3 commits into
mainfrom
fix/ave-t6001-firmware-build

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: On the M1 Max (T6001, J316c), the encoder at 40d100000.video-codec never registers. The macOS 13.5 stub preloads the M1 Max's own build of the 6070.11.1 firmware (TEXT 0xec000, DATA 0x134000, TEXT identity CRC 65d16c38), but the shared apple,t6000-ave variant accepts only the M1 Pro's sizes, so probe fails with unexpected firmware segment sizes (-22). This PR admits that build next to the M1 Pro's through main's existing firmware gate: a builds[] entry selected by segment size, its CRC in the known list, and its layout.
Tested: No Mac at this head yet. On an x86_64 build host at the merge of main 1b2c3613cdbc: the AVE host tests pass (9/9); the CI apple-build configuration builds drivers/media/platform/apple/ with no warnings; with the AVE KUnit options added, W=1 builds drivers/media/platform/apple/ave/ (including the new ave_t6001_build case) with no warnings. The KUnit run itself is the hosted KUnit ave job.
Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared apple,t6000-ave variant). Every other variant's admission is unchanged.
Not yet: a J316c (M1 Max) row at this head: probe, two lifecycle cycles, H.264 encode and decode. A T6000 (M1 Pro) row as the control. The M1 Ultra (T6002) firmware build has not been seen, and the secondary encoder (its DT is in #2295) is not covered.

Details
  • Why sizes and CRC, not a chip check. T6000 and T6001 share the apple,t6000-ave compatible, its coprocessor registers, boot device 14, device type 11, the 0x24-byte extra-0 window and the 6070.11.1 command layout. Only the preloaded image differs. ave_t6000 therefore keeps its start fields and gets a builds[] table, as T6041, T6050 and T8142 already have:

    Build TEXT DATA TEXT identity CRC
    M1 Pro (T6000) 0xd0000 0x128000 460c7a7c
    M1 Max (T6001) 0xec000 0x134000 65d16c38

    ave_fw_probe() on main picks the build by the reserved segment sizes. The TEXT identity CRC, with the TEXT->DATA link cell at 0x423c hashed as zero, must then be in the known list and be that build's own. 65d16c38 selects ave_layout_6070_11_1.

  • What stays strict. The two builds' sizes differ, so an image of the M1 Max's sizes is admitted only with 65d16c38, and the M1 Max's CRC is refused with the M1 Pro's sizes. Mixed sizes (0xec000/0x128000, 0xd0000/0x134000) and other sizes (0xf0000/0x134000) match no build and get -EINVAL. The DART window check (TEXT at 0, DATA right after TEXT), the link-cell and DATA alias checks, the loader TEXT CRC and the DATA boot-state CRC are main's, unchanged.

  • No refactor. An earlier version of this PR moved the admission decision into ave_fw_admit(). Main has since changed that code (DATA alias validation, the known-CRC test, same-size CRC build selection) and already admits a variant's builds[] by size and CRC, so the M1 Max build needs only the table entry. The forward merge takes main's ave_fw_probe() as it is.

  • KUnit. ave_t6001_build checks both builds' sizes and CRCs, the size matches and misses through ave_fw_sizes_match(), both CRCs in the known list (and a one-bit change not), the link cell with DATA at 0xec000 (the M1 Pro's DATA address in it is refused), and the layout lookup.

  • Earlier field result. The J316c report this fixes (official 7.3.0-40 and 7.3.0-41 both fail probe) also tested an out-of-tree patch on an older base. That patch admitted the same build (same sizes, CRC and layout selection) and passed: the encoder registered, ran two lifecycle cycles, and made two 1280x720 H.264 encodes that decoded to 60 frames with 0 errors. That patch is not this one, so it is not a row for this head. Thanks to the J316c owner for the report and the trial data.

Evidence
  • Base: main 1b2c3613cdbc, merged in with a merge commit.
  • python3 tools/asahi/run-host-tests.py --only ave --jobs 8: 9/9 AVE jobs pass (ave-host, ave-recovery, ave-recovery-old, ave-input, ave-ipc, ave-pm-tests with and without --old-ref, ave-probe-pm-tests with and without --negative-control).
  • CI apple-build configuration (make LLVM=1 ARCH=arm64 defconfig, merge_config.sh -m with arch/arm64/configs/asahi.config, olddefconfig, modules_prepare, then drivers/media/platform/apple/): rc 0, no warnings.
  • The same configuration plus KUNIT=y, VIDEO_APPLE_AVE_KUNIT_TEST=m, VIDEO_APPLE_AVE_CMD_KUNIT_TEST=y: make W=1 drivers/media/platform/apple/ave/: rc 0, 0 warnings.

ave_fw_probe() decides in two places whether the preloaded firmware is a
build the variant admits. Before TEXT is read, the segment sizes must
select a build. After the TEXT identity CRC is known, that CRC must be in
the known list and must be the selected build's own, or the variant's
when it has no builds[]. A same-size build with this CRC is preferred.

Move the size step into ave_fw_size_build(), which the probe still calls
first because ave_fw_text_id() needs the build's per-boot word. Move the
whole decision into ave_fw_admit(), which the probe calls once the CRC is
known. The results and error codes are the same as before: -EINVAL for
segment sizes that no build has, and -ENODEV for a CRC the variant does
not admit.

ave_fw_admit() needs no device, so KUnit now tests the gate itself:
a variant without builds[], two builds that share sizes, build CRCs used
with another build's sizes, a build that names no CRC, and the probe-only
M3 generation.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The M1 Max's die 0 encoder uses the M1 Pro's compatible, coprocessor
registers, boot sequence and 6070.11.1 command layout. The macOS 13.5
stub preloads a build of that firmware made for the M1 Max, though, with
TEXT 0xec000 and DATA 0x134000 instead of 0xd0000 and 0x128000.
ave_t6000 pins only the M1 Pro's sizes. On a J316c the probe therefore
fails with "unexpected firmware segment sizes" (-EINVAL), and no encoder
is registered.

Give ave_t6000 one build per chip. The segment sizes select the build,
and the TEXT identity CRC must then be that build's own: 460c7a7c for the
M1 Pro and 65d16c38 for the M1 Max. As before, the identity CRC hashes
the TEXT->DATA link cell at 0x423c as zero. Add 65d16c38 to the known
list, and let it select the 6070.11.1 layout.

No other check is relaxed. An image of the M1 Max's sizes with any other
CRC is refused, including the M1 Pro's CRC. So are mixed sizes and other
sizes. The DART window, link-cell, loader CRC and DATA boot-state checks
are unchanged. The M1 Max shares the boot device, device type, extra-0
size and register layout of the M1 Pro, so ave_t6000 keeps them.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 27, 2026 05:49
@github-actions github-actions Bot added area:media Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, 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) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 41522cb0: not ready yet

Check Detail
CI at head ok 10 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 41522cb0, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared apple,t6000-ave variant). Every other variant's admission is unchanged.

Areas: area:media

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

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Non-author review at 658ad317049c: READY on the code, 0 blockers. The J316c and T6000 rows are owed before merge.

  • Refactor (609a031fc3b1): ave_fw_admit() makes the same decision as the old inline code.
    • The old !known test (boot_qualified && !known_crc) is exactly the new one.
    • A same-size build with a matching CRC still wins over the first same-size build.
    • Error codes and messages are unchanged.
    • ave_fw_size_build() still runs before ave_fw_text_id(), which needs the size-selected build.
  • T6001 build (658ad317049c):
    • The segment sizes select the build, and the CRC must be that build's own. The new KUnit cases cover each refusal: M1 Max sizes with the M1 Pro CRC, the M1 Max CRC with M1 Pro sizes, and mixed or unknown sizes (-ENODEV / -EINVAL).
    • The DART window, link-cell and loader TEXT CRC checks are unchanged.
    • The DATA check compares against the loader's recorded aurora,ave-data-crc32, so it needs no per-build value.
    • ave_layout_for_crc() maps the new CRC to ave_layout_6070_11_1.
  • Scope: every other variant takes the same admission path as before. Only apple,t6000-ave gains a build.
  • Commits: checkpatch.pl --strict is clean on both. Both are signed off, with no attribution, and the branch merges cleanly onto main.
  • CI at this head: 11/19 checks pass, 8 still pending at posting, 0 failing.
  • Owed before merge:
    • A J316c (M1 Max) row at this head: probe, two lifecycle cycles, and H.264 encode and decode. ave_t6000 is boot_qualified and the 6070.11.1 layout is encode_ready, so this PR enables encoding on the M1 Max. So far the reuse of the M1 Pro command layout rests only on the earlier out-of-tree trial.
    • A T6000 (M1 Pro) row, since the shared variant's admission changed.
  • Nit: in Documentation/admin-guide/media/apple-ave.rst, the new sentence lands in a paragraph that calls T6000 probe-only with encoding refused. That no longer matches ave_t6000, which is boot_qualified. Worth rewording while you're there.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document public-clean provenance for the new firmware build discriminator and the choice of existing layout. The PR explains how the firmware image is normalized for the identity check, but does not say which parts were established by our runtime captures or public sources and which, if any, depended on binary analysis. Keep private artifacts and derived private details out of the public change. CI is green; the current-head M1 Max encode lifecycle and M1 Pro regression rows are still outstanding.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) ci-failing A check failed at the PR head (bot) labels Nov 29, 2026
@aurora-silicon-review
aurora-silicon-review Bot dismissed their stale review December 1, 2026 05:07

Dismissed under the 12-01 merge bar: this review's blockers were not shown failures (CI/rows/rebase/design or re-run asks). Follow-ups, not blocking: Provenance write-up ask, no code affirmation; follow-ups: document discriminator provenance, M1 Max encode + M1 Pro rows

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
Main changed the encoder firmware admission in ave-fw.c (DATA alias
validation, the known-CRC test, the same-size CRC build selection). Its
gate already admits a variant's builds[] by segment sizes and each
build's own known CRC, so the M1 Max build needs no ave_fw_admit()
refactor: take main's ave_fw_probe() as it is and keep only the T6001
build entry, its known CRC and its layout. The T6001 KUnit case checks the
builds, their sizes and CRCs through ave_fw_sizes_match() and
ave_fw_known_crc() instead of ave_fw_admit(), and ave_fw_admit_gate goes
with the refactor.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

I forward-merged main 1b2c3613cdbc with a merge commit (no force-push). New head: 41522cb0baf2.

Main changed the firmware admission in ave-fw.c: DATA alias validation, the known-CRC test and same-size CRC build selection. Its gate already admits a variant's builds[] by segment sizes plus each build's own known CRC, so the M1 Max build no longer needs the ave_fw_admit() refactor. The merge takes main's ave_fw_probe() as it is. What's left is the T6001 builds[] entry, its known CRC, its layout mapping, the docs and the ave_t6001_build KUnit case, which now checks through ave_fw_sizes_match() and ave_fw_known_crc(). ave_fw_admit_gate went with the refactor. Against main the diff is 7 files, +101/−6.

Commands and results at 41522cb0baf2, on an x86_64 build host:

  • python3 tools/asahi/run-host-tests.py --only ave --jobs 8: 9/9 AVE jobs pass. They are ave-host, ave-recovery, ave-recovery-old, ave-input, ave-ipc, ave-pm-tests with and without --old-ref, and ave-probe-pm-tests with and without --negative-control.
  • The CI apple-build configuration (make LLVM=1 ARCH=arm64 defconfig, scripts/kconfig/merge_config.sh -m .config arch/arm64/configs/asahi.config, olddefconfig, modules_prepare, then drivers/media/platform/apple/): rc 0, no warnings.
  • The same configuration plus KUNIT=y, VIDEO_APPLE_AVE_KUNIT_TEST=m and VIDEO_APPLE_AVE_CMD_KUNIT_TEST=y, then make W=1 drivers/media/platform/apple/ave/: rc 0, 0 warnings. That includes ave-abi-test.o with ave_t6001_build. The KUnit run itself is the hosted KUnit ave job.

Rows: no lab Mac has an M1 Max or an M1 Pro, so I requested a J316c (M1 Max) row and a T6000 (M1 Pro) control row at this head through PEER-ROWS.

@github-actions github-actions Bot removed merge-conflict Conflicts with the base branch (bot) ci-failing A check failed at the PR head (bot) labels Dec 2, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 41522cb0baf2: no code blockers. After the main merge, this is a second builds[] entry for apple,t6000-ave, selected by segment size, plus its CRC in the known list and its layout. Main's probe already enforces "these sizes need this build's own CRC". The T6000 row stays as it was (builds[0]), and ave_t6001_build covers mixed sizes, a flipped CRC and the TEXT→DATA link cell. T6000 is still probe-only here, so this lets the M1 Max encoder bind. Encoding stays refused until the command constants are qualified. Hosted CI is green at this head (apple-build, KUnit ave, host-tests).

On provenance: the values are what the J316c reported at run time, namely the segment sizes from the probe error and the identity CRC that ave_fw_text_id_crc() computes. Keep the PR text to that.

Before merge: a J316c (M1 Max) row at this head with probe, two lifecycle cycles and the H.264 checks, plus a T6000 (M1 Pro) control. We have neither Mac, so both need peers.

This branch has not been deployed

No deployments
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) blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant