Repository navigation
media: apple: ave: admit the M1 Max (T6001) encoder firmware build - #3357
DjDeveloperr wants to merge 2 commits into
Conversation
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]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Non-author review at
|
There was a problem hiding this comment.
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.
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
What: On the M1 Max (T6001, J316c), the encoder at
40d100000.video-codecnever 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 CRC65d16c38), but the sharedapple,t6000-avevariant accepts only the M1 Pro's sizes, so probe fails withunexpected 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 intoave_fw_admit()without changing its behaviour, so KUnit can test it directly.Tested: No Mac at
658ad317049cyet. At658ad317049c: the AVE KUnit suites (arm64 QEMU) pass 51/51, including the newave_fw_admit_gateandave_t6001_build; the AVE host tests andtools/asahiAVE tests pass;checkpatch.pl --strictis clean; the arm64 LLVMW=1build ofdrivers/media/platform/apple/ave/is clean.Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared
apple,t6000-avevariant); 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-avecompatible, 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_t6000therefore keeps its start fields and gets abuilds[]table, as T6041, T6050 and T8142 already have:0xd00000x128000460c7a7c0xec0000x13400065d16c38The 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.
65d16c38selectsave_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 becauseave_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_gatecovers the existing variants: a variant withoutbuilds[](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_buildcovers 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 inave_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'save-fw.chunks 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
main7de24c5c4206. 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-abi26,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_buildfails, 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 (defconfigplus the AVE.kunitconfig): no warnings.tools/asahi/run-host-tests.py --only ave-: 8/8 pass (ave-host,ave-input,ave-ipc,ave-recovery,ave-pm-testswith and without--old-ref,ave-probe-pm-testswith and without--negative-control).