Skip to content

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

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

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

Conversation

@DjDeveloperr

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, selected by segment size and matched on its exact CRC. The first commit moves the admission decision into ave_fw_admit() without changing its behaviour, so KUnit can test it directly.
Tested: No Mac at 658ad317049c yet. At 658ad317049c: the AVE KUnit suites (arm64 QEMU) pass 51/51, including the new ave_fw_admit_gate and ave_t6001_build; the AVE host tests and tools/asahi AVE tests pass; checkpatch.pl --strict is clean; the arm64 LLVM W=1 build of drivers/media/platform/apple/ave/ is clean.
Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared apple,t6000-ave variant); every AVE Mac through the refactored probe gate, which returns the same results.
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 second-generation check. 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

    The reserved segment sizes select the build. Its 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. An image of the M1 Max's sizes with any other CRC is refused with -ENODEV, including the M1 Pro's CRC and a CRC differing by one bit. The M1 Max's CRC with the M1 Pro's sizes is refused. Mixed sizes (0xec000/0x128000, 0xd0000/0x134000) and other sizes (0xf0000/0x134000) get -EINVAL. The DART window check (TEXT at 0, DATA right after TEXT), the link-cell check, the loader TEXT CRC and the DATA boot-state CRC are unchanged.

  • Refactor (commit 1). ave_fw_probe() used to decide admission in two places: sizes before TEXT is read, then CRC after. ave_fw_size_build() does the size step, which the probe still runs first because ave_fw_text_id() needs the build. ave_fw_admit() does the whole decision once the CRC is known. Error codes and messages are the same as before.

  • KUnit. ave_fw_admit_gate covers the existing variants: a variant without builds[] (T8112), two builds that share sizes, build CRCs with another build's sizes (T6050, the M2's 27.2 build), a build that names no CRC (T6041), and the probe-only M3 generation. ave_t6001_build covers the new build: both chips' builds admitted, the refusals above, the link cell with DATA at 0xec000 (the M1 Pro's DATA address in it is refused), and the layout lookup.

  • Overlap with arm64: dts: apple: t6041: enable second AVE encoder (ave1) and per-node CRC lookup #3304. That PR renames ave_fw_chosen_crc() and changes its two call sites in ave_fw_probe(). This branch does not touch those lines, and arm64: dts: apple: t6041: enable second AVE encoder (ave1) and per-node CRC lookup #3304's ave-fw.c hunks apply cleanly on top of it (patch --dry-run).

  • 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 7de24c5c4206. Head: 658ad317049c.
  • scripts/checkpatch.pl --strict -g main..HEAD: 0 errors, 0 warnings, 0 checks on both commits.
  • tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/media/platform/apple/ave/.kunitconfig: 51/51 pass (apple-ave-abi 26, apple-ave-mctf, apple-ave-cmp420, apple-ave-sizes, apple-ave-recovery). Mutation check: with the M1 Max build's CRC set to 0 (any known CRC), ave_t6001_build fails, because the M1 Pro and M2 CRCs are then admitted with the M1 Max's sizes.
  • make ARCH=arm64 LLVM=1 W=1 drivers/media/platform/apple/ave/ (KUnit config, VIDEO_APPLE_AVE=y): no warnings. The same with GCC 16 (defconfig plus the AVE .kunitconfig): no warnings.
  • Host tests: tools/asahi/run-host-tests.py --only ave-: 8/8 pass (ave-host, ave-input, ave-ipc, ave-recovery, ave-pm-tests with and without --old-ref, ave-probe-pm-tests with and without --negative-control).

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 <[email protected]>
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 <[email protected]>
@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 658ad317: not ready yet

Check Detail
CI at head no failing: KUnit asahi, KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp, KUnit jpeg
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 658ad317, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text ok Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared apple,t6000-ave variant); every AVE Mac through the refactored probe gate, which returns the same results.

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

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) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (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