Repository navigation
kboot, dapf: hand off second AVE encoder (ave1) with per-encoder firmware CRCs - #538
Conversation
M4 Max (T6041) exposes a second AVE encoder (/arm-io/ave1) backed by /arm-io/dart-ave1 with its DAPF aperture at reg index 3 (two 52-byte slices, matching dart-ave0, verified against the J616c ADT). Add /arm-io/dart-ave1 to dapf_entries[] under the ave1 DT alias so dapf_init_fdt() programs its filter when the kernel DT enables ave1, and expand the programmed/failed tracking arrays from 8 to 16 entries so all eight dapf_entries[] have headroom. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
dt_set_ave_node() previously assumed every video encoder shared a single pair of preloaded segment CRCs in /chosen and disabled any subsequent encoder whose raw CRC32 differed from the first encoder handed over. On M4 Max (T6041 / J616c), iBoot preloads independent firmware copies for /arm-io/ave0 and /arm-io/ave1 whose DATA (and potentially per-load TEXT) CRC32s vary per instance and per boot. As a result, dt_set_ave_node() always disabled /video-codec@285100000 (ave1) before reserving its memory-region segments, leaving only ave0 enabled for Linux. Remove the /chosen CRC mismatch refusal and export aurora,ave-<seg>-crc32 directly on each handed-over encoder DT node. Continue mirroring the first handed-over encoder's CRCs into /chosen when absent so SMBIOS firmware inventory and kernels that only read /chosen remain compatible without later encoders clobbering /chosen. Update the differing-CRC scenario in test_ave_handoff.py and add a J616c (T6041) regression scenario covering ave0+ave1 per-node CRCs and dart-ave1 DAPF handoff states. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 5522f1093c95
Blockers: none
Checked: Read the whole diff, both commits and the description. Nothing is gated on chip, board or firmware: dart-ave1 is a plain dapf_entries[] row under the ave1 alias (skipped when the alias or the ADT node is absent), and the per-node CRC export runs for every encoder dt_set_ave_node() hands over. Dropping the /chosen mismatch refusal is safe for the kernel: ave-fw.c still checks TEXT and DATA against a loader CRC before it runs anything, and an encoder whose copy differs from the /chosen one just fails that check on a kernel that only reads /chosen (no memory is lost: the reservations are made either way). /chosen is written only for the first encoder handed over and is never overwritten, so single-encoder Macs see the same /chosen as before plus the new per-node properties. The node offset is re-fetched by phandle before each fdt_setprop_string(), so the property writes do not use a stale offset. The tracking arrays grow from 8 to 16 with the existing bounds checks at dapf.c:890/894. Test 4 is changed to the new behaviour and test 13 covers the J616c layout (both encoders, differing DATA CRCs, dart-ave1 programmed/skipped/failed); the updated harness fails on main's kboot.c (negative control below), so it tests the change. DCO: human Signed-off-by on both commits, no AI trailers. No Apple binary/tuning data; the CRCs are checksums of the preloaded images as the existing tests already use. CI: all 16 checks green at this head.
Hardware: the J616c (M4 Max) row is at this head. dt_set_ave_node() is shared by every Mac with an encoder, so merge also wants one no-change regression boot at this head on a single-encoder Mac (our M1 Pro or M4 Air would do: encoder handed over, /chosen CRCs unchanged, encoder probes). Merge order: on a kernel without the per-node CRC lookup (linux#3304 is still open), a T6041 ave1 that is now handed over fails probe with "firmware data is not in its boot state", an error-level line it did not print before; landing linux#3304 first or together avoids that.
Non-blocking nits:
src/kboot.c(new export block): if the first encoder's/chosenexport fails half-way (text written, data not), it is disabled but/chosenkeeps its text CRC, and every later encoder then skips/chosenbecause one property exists. Only reachable with a full FDT, so cosmetic; checking both names, or writing/chosenonly after all per-node props succeed, would close it.src/dapf.c: with noave1alias in today's trees the newdart-ave1row is skipped anddt_set_ave_dapf()programs that filter anyway (your test covers both); fine, but the commit message could say the row is only for trees that carry the alias.
Evidence
- Local pytest 9.1.1 at
5522f109:test_ave_handoff.py,test_ave_text_dapf.py,test_dart_tunables.pypass; fulltests/python(-n 6): 1222 passed, 27 skipped, 0 failed. - Negative control: this head's
test_ave_handoff.pyon anorigin/maintree fails at its first per-node check (!strcmp(node_prop(0, M1_ENC0, "aurora,ave-text-crc32"), "460c7a7c")). git merge-tree --write-tree origin/main pr538: clean.- Kernel side read on aurora-silicon/linux
main:drivers/media/platform/apple/ave/ave-fw.cave_fw_chosen_crc()reads only/chosenforaurora,ave-text-crc32/aurora,ave-data-crc32. gh pr checks 538: 16/16 pass.
|
Regression row, M1 Pro (T6000 / J316s, single AVE encoder), PASS. This head runs unchanged in a combined trial image.
Evidence (buildbox): |
What: Add
/arm-io/dart-ave1todapf_entries[](under theave1DT alias, with tracking array headroom expanded from 8 to 16) and exportaurora,ave-{text,data}-crc32directly on each handed-over encoder DT node instead of disabling subsequent encoders whose preloaded firmware CRCs differ from/chosen.Tested: J616c M4 Max at
5522f109(paired with the companion Linux dual-encoderave1+ per-node CRC series): bothave0(video16) andave1(video17) hand over, probe, and pass H.264/HEVC 8-bit and 10-bit Main10 encode + 3 concurrent streams with 0 DART/IOMMU faults;test_ave_handoff.py(38/38 checks including J616cave0+ave1anddart-ave1DAPF states),test_ave_text_dapf.py, and Stage 1 + ESP Stage 2 builds pass.Risk: two-way door · M1 Max/Ultra, M4 Max (T6041), and other multi-encoder Macs; single-encoder Macs continue receiving
/chosenCRCs unchanged.Not yet: Live hardware test on M1 Max/Ultra or J614c (14" M4 Max); covered by unit tests in
test_ave_handoff.py.Details
src/dapf.c: registers/arm-io/dart-ave1(DAPF aperture reg index 3, aliasave1) alongside/arm-io/dart-ave0and widensdapf_programmed_paths/dapf_failed_pathsfrom 8 to 16 entries. On boards without an enabledave1alias or without/arm-io/dart-ave1in the ADT,dapf_init_fdt()skips it as before.src/kboot.c: on T6041 (M4 Max), iBoot preloads independent firmware copies for/arm-io/ave0and/arm-io/ave1whose DATA CRC32s differ per instance and per boot. Removing the/chosenmismatch refusal and writingaurora,ave-<seg>-crc32onto each handed-over encoder DT node lets every valid encoder come up while keeping the first handed-over encoder's CRCs mirrored in/chosen(without overwriting) for SMBIOS firmware inventory and older kernels that only read/chosen./chosenforave0). Paired with the companionaurora-silicon/linuxPR (pr/t6041-ave1-dual-encoder), Linux reads each encoder's per-node CRCs and enables bothave0andave1on T6041.Evidence
origin/main(8521ad7cf949):6b74964f2349dapf: add dart-ave1 for the M4 Max second video encoder5522f1093c95kboot: export per-encoder AVE firmware CRCs instead of disabling ave1USE_CLANG=1 pytest -v tests/python/test_ave_handoff.py tests/python/test_ave_text_dapf.py tests/python/test_dart_tunables.py tests/python/test_smp_handoff_gate.py: 4 passed (38/38PASS:assertions intest_ave_handoff).sh tests/run-pmp-boot-data.sh,sh tests/run-fdt-disable.sh,sh tests/run-aop-os-ram.sh,sh tests/run-t8122-gpu26-identity.sh: all pass.make -j12 USE_CLANG=1 CHAINLOADING=1andmake -j12 USE_CLANG=1 ESP_STAGE2=1 CHAINLOADING=1: both build cleanly with 0 warnings indapf.c/kboot.c.1.0.0b17-g5522f109):/video-codec@283100000(ave0) and/video-codec@285100000(ave1) handed over with distinct per-nodeaurora,ave-data-crc32values while/chosenretainedave0's CRCs.video16(ave0) andvideo17(ave1) passed H.264/HEVC 8-bit and 10-bit Main10 encode + 3 concurrent streams with 0 DART/IOMMU faults.