Repository navigation
media: apple: ave: admit the M1 Max (T6001) encoder firmware build - #3357
DjDeveloperr wants to merge 3 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 <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>
|
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
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>
|
I forward-merged main Main changed the firmware admission in Commands and results at
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. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
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 through main's existing firmware gate: abuilds[]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 buildsdrivers/media/platform/apple/with no warnings; with the AVE KUnit options added,W=1buildsdrivers/media/platform/apple/ave/(including the newave_t6001_buildcase) with no warnings. The KUnit run itself is the hostedKUnit avejob.Risk: two-way · M1 Pro, M1 Max, M1 Ultra (the shared
apple,t6000-avevariant). 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-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:0xd00000x128000460c7a7c0xec0000x13400065d16c38ave_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.65d16c38selectsave_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'sbuilds[]by size and CRC, so the M1 Max build needs only the table entry. The forward merge takes main'save_fw_probe()as it is.KUnit.
ave_t6001_buildchecks both builds' sizes and CRCs, the size matches and misses throughave_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
main1b2c3613cdbc, 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-testswith and without--old-ref,ave-probe-pm-testswith and without--negative-control).make LLVM=1 ARCH=arm64 defconfig,merge_config.sh -mwitharch/arm64/configs/asahi.config,olddefconfig,modules_prepare, thendrivers/media/platform/apple/): rc 0, no warnings.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.