Repository navigation
media: apple: ave: T8132 (M4 Air) encoder on the macOS 27.2 stub, with device tree - #2675
Conversation
The M4 MacBook Air (J713) with the macOS 27.2 stub has its encoder firmware preloaded with TEXT 0x154000 and DATA 0x12c000, TEXT CRC 99fc929a, the same on every boot. The coprocessor and its start sequence are the M4 Pro's (T6041); the build boots as device 23 and takes handshake type 23, and speaks the 26B123 command layout. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8132 (M4) encoder has the T6041 resource layout: codec, mailbox and coprocessor banks by name and five named VENC power states. Drop its separate five-bank branch and list it with the T6041 group. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Describe the T8132 encoder like the T6041 one: the codec, mailbox and coprocessor banks by name, its five VENC power states by name, and the DART window above 0x100_00000000 that the bootloader maps the firmware into. Drop the unused pmgr and fabric banks and the clock reference to the disabled peripheral clock provider. On J713/J715 the VENC power states are enabled in the board's PMGR ownership file, so the T8132 platform handoff, which applies that file on the Air's loader tree, keeps them; the encoder's two DARTs get their power state again, and they and the encoder are enabled. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The known-CRC list and a few comments named the firmware and the macOS driver by their Apple component names. Call them "encoder firmware" and "the macOS driver" instead; the version numbers and build ids that identify each image stay. No code change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…eroed The 27.2 (26B123) T8132 build has the per-boot word at TEXT 0x4224 that the M4 Max build has. The MacBook Air (J713) loader leaves it zero, so its raw TEXT CRC is the known 99fc929a; the Mac mini (J773g) loader sets it on every boot, so its raw CRC reads f641c64b and probe refused it as unsupported firmware. Give the T8132 variant .text_boot_word = 0x4224: an unknown CRC is retried with that word zeroed, as for T6041, and a known one is used as it is, so nothing changes on the J713. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The encoder node lost clocks = <&peripheral_clocks 430> when it was described like T6041. The driver does not use the clock, but it is hardware description the other T8132 nodes keep, and the binding allows it. The provider is disabled today; fw_devlink ignores a disabled supplier, as for the enabled jpeg0/jpeg1 nodes that point at the same provider, so the encoder still probes. Note for the VENC states enabled in t8132-j713-pmgr.dtsi by the encoder enable: that ownership file is shared by every M4 Mac, so the VENC states are now enabled on all of them; each board still enables the encoder node itself. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Follow-up to the review on #2668, which carries over to this PR. Pushed f20c54a as three commits on top, with no force push:
Nits: the Apple component names are dropped from the driver's comments and the known-CRC list (d84656f, comments only). The body has the row table. Evidence is in traces/codec/20261121-j713-ave2 on the lab store. Assisted-by: LLM (Claude:Opus 5.5) |
|
J713 (M4 Air, macOS 27.2 stub) row: this PR's head merged into a candidate default kernel. That kernel carries the J713 deep-sleep, display and GPU series plus #2670, #2700 and #2694. Stage 2 was aura main tip + #404 + #379, on the stock command line, booted once with no module swaps.
|
|
No blockers. Admission fails closed: ave_t8132 pins the segment sizes and ave_fw_probe() accepts only TEXT CRC 99fc929a. The 0x4224 boot-word retry only recomputes the CRC, and the J713's raw CRC skips it. The node, binding and DART dma-range match the T6041/T6050 shape, and the four points from the #2668 review are covered on this head. Two rows before merge. First, t8132-j713-pmgr.dtsi now marks the six VENC states okay, and t8132_pmgr_policy() gives that status to any status-less pwrstate node on every M4 tree the handoff runs on, so please boot one non-Air M4 (J773g or an iMac) on this head and confirm the VENC domains probe and power off with no new errors. Second, run one s2idle/deep-sleep cycle on the J713 with apple-ave bound, then encode again after resume. Nit: the T8142 comment at ave-drv.c:217 now says device 27 "comes from the ADT", but the ADT only gives the soc-id string. Please reword it so it doesn't name the wrong source, and say in the T8132 commit how device/handshake 23 was observed. |
Merge-train batch 1 merged #1900 (T8142 AVE on 27.2), which touched the same firmware tables. Resolution: keep this branch's neutral firmware wording in ave-fw.c and ave-drv.c and add the T8142 27.2 CRC entry from #1900 to the known-CRC list beside the T8132 27.2 one. No code change beyond the union of both sides. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Merged integration/aurora 606d37e into the branch (2f5b721, plain merge, no force push): batch 1's #1900 had touched the same AVE firmware tables. The resolution keeps this branch's neutral firmware wording and adds the T8142 27.2 CRC from #1900 next to the T8132 one. There is no other code change. drivers/media/platform/apple/ave builds clean on the fleet config (arm64, LLVM). Dj's verdict is still needed at this head. |
|
J713 sleep-then-encode row, run on the J713 default kernel (7.3.0-bj713t6+, default cmdline, macOS 27.2). That kernel carries this PR at f20c54a. The only AVE driver difference to 2f5b721 is the M5 (T8142) 27.2 build entries, so the T8132 path is the same code. I encoded H.264 and HEVC with gst
The J713 default promotion gate also passed 13 deep sleeps with encode after the full-row deeps. Still owed from the list: a non-Air M4 boot showing the VENC domains, and Dj's verdict at 2f5b721. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial Pre-PR Checklist Review (head 2f5b721a67be)
0 code/policy/attribution/CI blockers. Holding only for the remaining §5 hardware row below.
Checklist Summary (§1–§6)
- §1 No model gating: Pass.
ave_t8132matches viaapple,t8132-ave, segment sizes, and TEXT CRC (0x99fc929a) with.text_boot_word = 0x4224fallback retry inave_fw_text_boot_id(), handling both J713 (raw CRC matches directly) and J773g (per-boot word set) without board gating. - §2 Production-ready: Pass. Default command line, fail-closed firmware admission,
clocks = <&peripheral_clocks 430>preserved,apple,dma-rangeand named banks/power domains match the T6041/T6050 shape. - §3 Safety: Pass. Firmware segment bounds, DART mapping verification, and CRC checks fail closed;
ave_fw_text_boot_crc()bounds-checksword_off. - §4 Clean-room & attribution: Pass. All 7 commits carry human identity (
Ryan Murray) andSigned-off-by:with no agent trailers; PR body carriesAssisted-by:. Commitd84656f2removed Apple component names from comments andave_known_text_crc[].- Non-blocking nit:
drivers/media/platform/apple/ave/ave-drv.c:218now says"The chip identity comes from the ADT (ave soc-id "t8142"): device 27, generation 16", whereas the ADT carries only thesoc-idstring, not the numericdevice 27, generation 16pair. Fine to clean up in a follow-up.
- Non-blocking nit:
- §6 Naming: Pass. Uses
aurora,ave-text-crc32; no disallowed names introduced. - CI: Green (
dt-checksSUCCESS,host-testsSUCCESS;mergeable=MERGEABLE).
Remaining §5 HW Row Before Approve
- Non-Air M4 boot (e.g., J773g Mac mini or iMac J623/J624) on this head:
arch/arm64/boot/dts/apple/t8132-j713-pmgr.dtsiis applied across M4 trees and now marks all six VENC power states (ps_venc_sys,ps_venc_dma,ps_venc_pipe4,ps_venc_pipe5,ps_venc_me0,ps_venc_me1)status = "okay". Please confirm on one non-Air M4 that the VENC domains probe and idle/power off cleanly with 0 new kernel errors, 0 SELinux denials, and 0 failed units. (J713 full encode/runtime-PM/s2idle/deep-sleep rows are complete.)
Assisted-by: LLM (Gemini 4 Neon)
|
On the non-Air M4 row: at 2f5b721 this PR doesn't turn on anything on a non-Air M4, so a J773g/J623 boot would not exercise it.
To check it, I compiled every T8132 board's DTB at the base (606d37e) and at 2f5b721 and diffed the decompiled trees:
When a non-Air M4 gets an encoder enable of its own, that PR will carry its own boot row. Diff methodcpp + dtc with the kbuild include paths, one detached worktree per commit, Lab store: traces/kernel/20261122-t8132-ave-dt-nonair/. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR Checklist Re-check — Upgrading to APPROVE (head 2f5b721a67be)
The sole remaining §5 hold (non-Air M4 VENC power-domain check) is resolved and independently verified against 2f5b721a67be:
arch/arm64/boot/dts/apple/t8132-j713-pmgr.dtsi(whereps_venc_{sys,dma,pipe4,pipe5,me0,me1}are set tostatus = "okay") is included only byt8132-j713-j715.dtsi(t8132-j713.dtsandt8132-j715.dts).- Non-Air M4 boards (
t8132-j773g.dts,t8132-j623.dts,t8132-j624.dts,t8132-j604.dts) includet8132-pmgr.dtsi(untouched by this PR); the onlyt8132-peripherals.dtsichanges visible in their compiled DTBs are ondart_ave0,dart_ave2, andave, all of which remainstatus = "disabled". - J713 hardware rows (ffmpeg + GStreamer H.264/HEVC 1080p/4K encode with byte-identical outputs, runtime PM / SVE idle word check, s2idle, deep sleep, 0 DART faults, 0 SELinux denials, 0 failed units) and CI (
dt-checks,host-tests) are all green with 0 code blockers.
Assisted-by: LLM (Gemini 4 Neon)
Replaces #2668, rebased onto current integration/aurora (conflicts in drivers/media/platform/apple/ave/{ave-drv.c,ave-fw.c,ave.h} and Documentation/devicetree/bindings/media/apple,t8140-ave.yaml: kept the base's T8122 variant and CRC next to T8132, and with the base's T6032 branch already gone, dropped the T8132 branch and listed T8132 in the shared and T6041 groups). The 26B123 layout commit is already on the base as 4c7a63d (with the T8132 CRC and layout lookup), so this carries the other three commits.
Problem. The M4 MacBook Air (J713, T8132) on the macOS 27.2 stub has no video encoder. The encoder node is disabled, the driver has no T8132 entry, and on the Air's loader tree the T8132 platform handoff keeps the VENC power states off. So only the decoder, JPEG and scaler nodes exist.
Change.
Review follow-up (Dj's #2668 review, f20c54a).
.text_boot_word = 0x4224(351ec42), so the J773g's raw CRC f641c64b is retried as 99fc929a. A known CRC is used as it is, so the J713 is unchanged. KUnit checks the T8132 word and CRC.clocks = <&peripheral_clocks 430>(f20c54a). Its commit message notes thatt8132-j713-pmgr.dtsiis shared by every M4 Mac.Testing. J713 on the 27.2 stub, kernel = the J713 lab default plus these commits, Stage 2 DTB with the same DT changes.
apple-avebinds at boot (/dev/video13). gstv4l2h264enc/v4l2h265encpassed 8/8 rows. 6 of the 8 bitstreams are byte-identical to the same rows on an M4 Pro (J616s, stock driver). The other two are long H.264 Baseline runs, within 0.3 % in size and 0.01 dB PSNR. Every stream decodes with no errors and the full frame count. The DART audit showed 0 unsafe streams, with 0 faults and 0 AVC denials. KUnit apple-ave: 30/30 passed (arm64 QEMU). dt_binding_check and dtbs_check passed on T8132 J713/J773g/J604 plus 19 other AVE boards. checkpatch --strict: clean. Rebased tree (buildbox, 2026-11-21):drivers/media/platform/apple/ave/arm64 LLVM=1 W=1 built with 0 warnings; KUnit apple-ave* 46/46 passed (arm64 QEMU); dt_binding_check apple,t8140-ave.yaml clean; dtbs_check against it clean on all 59 Apple boards with an encoder node (T8132 J604/J623/J624/J713/J715/J773g included), and the base binding fails the new J713 node as a control;run-host-tests.py --only ave6/6; checkpatch --strict clean.Review rows on the J713 (B8 default, 7.3.0-bj713x9+), driver = f20c54a: ffmpeg
h264_v4l2m2mMain without B-frames at 30 fps andhevc_v4l2m2mwithout B-frames at 60 fps, plus High at 24/30/60 fps, Baseline and HEVC at 30 fps. All 7 decode clean with the full frame count, 40-45 dB. gst 6/6 clean. Runtime PM: 2 legs x 3 suspend/restart cycles; mailbox 0x118 read 0 at every start, and both legs give byte-identical bitstreams. 0 SError, 0 DART faults. After the rebase and fixes: KUnit apple-ave 46/46, W=1 0 warnings, dt_binding_check and CHECK_DTBS on all 6 T8132 boards clean, checkpatch --strict clean.Still to run. J715 (same tree, no unit here). Short rows and 4K H.264 are slower than on the M4 Pro (see the table); the performance floor is not looked at yet. The 26.6.2 stub firmware (#1489 25G83 image) is not admitted by this change. That would need a second build entry with its own device numbers.
Review rows (J713, f20c54a)
Driver from f20c54a, built for the B8 default kernel (7.3.0-bj713x9+); swapped in once on a boot where the stock driver had not started the firmware. For the idle-word legs the lab build also had a LAB-only toggle (off = the PR's behaviour) that logs mailbox 0x118 at every start. Evidence: traces/codec/20261121-j713-ave2 on the lab store.
*The 24 fps value is identical on the M3 (J615, 30.87 dB), so it comes from the checker's 24 fps source, not the encoder.
Idle word: leg A (no clear) and leg B (clear 0x118 before each start), 3 cycles each of runtime suspended (sysfs) -> new session -> firmware restart. Word read 0x0 before all 6 starts. The 3 H.264 and 3 HEVC outputs of both legs share one hash per codec.
Rows (J713 vs J616s, same script)
gst videotestsrc smpte NV12 -> v4l2h26Xenc -> parse -> file; fps best of 2 (whole pipeline wall time); PSNR computed off-device against the regenerated source (md5 matches the on-device source).
Low absolute PSNR is the driver's default rate on a fast-moving test pattern, the same on both Macs.
Why the platform-handoff change: on the Air's loader tree,
t8132-platform-handoffappliest8132-j713-pmgr.dtsias the PMGR ownership policy. A first boot with only the board DT enabled showed the six VENC states forced to disabled. The encoder DARTs then waited on their power state until the deferred-probe timeout, and the encoder refused with "needs a translating IOMMU". With the states enabled in the ownership file, both DARTs probe and the encoder binds.Assisted-by: LLM (Claude:Opus 5.5)