Skip to content

media: apple: ave: name the M2 27.2 handshake source, test the refusal - #2938

Closed
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
m2mini/ave-t8112-272-followup
Closed

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
m2mini/ave-t8112-272-followup

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

#2904 (the M2's macOS 27.2 encoder build) was merged at 4d459a4 while its review follow-ups were still being tested. The review had four non-blocking points: the source of device 12 / handshake type 12 wasn't named, the KUnit case only checked the fallback and not the size refusal, that refusal didn't print the sizes, and ave.h didn't say when to use next_build instead of builds[].

Change

  • The ave_t8112_26b123 comment names the source the way the T8142 one does. The ADT names the chip (ave soc-id "t8112"), this build's device table numbers it 12/12, and the 13.5 build (ave_t8112) uses 18/15.
  • The plain size check in ave_fw_probe() now calls ave_fw_sizes_match(), the predicate ave_fw_select_build() already uses. It's the same expression, so no variant changes behaviour. KUnit now asserts that the M2 chain's near-miss sizes are refused and that both real builds match.
  • That refusal prints TEXT/DATA, like the builds[] path, so a third build is easy to identify from a log.
  • ave.h says when to use builds[] (same start, different CRC/layout) and when to use next_build (the build needs its own start fields and has its own sizes).

Testing

The module was built from this head's ave/ against each Mac's default release (fleet82 or fleet81; their ave/ equals the #2904 merge). One module swap, default cmdline, then a plain reboot back to the default:

  • Mac mini J473 (M2, 27.2): the encoder binds. 12/12 encodes, run 1 == run 2, and all 6 bitstreams are byte-identical to the media: apple: ave: run the M2 encoder's macOS 27.2 firmware build #2904 rows. Encode, 15 s s2idle, encode: byte-identical output before and after.
  • M2 MacBook Air (13.5 firmware): 6/6 bitstreams md5-identical to the stock module. Encode, s2idle, encode: identical.
  • J615 (M3 Air, T8122 26B123 build): 4/4 bitstreams md5-identical to the stock module.
  • 0 SError, DART faults or encoder errors, Enforcing, 0 AVC on all three.
  • arm64 KUnit for drivers/media/platform/apple/ave: 47/47 pass. The host ABI tests (run.py, run-recovery.py) pass. checkpatch --strict on the diff is clean.

Still to run

  • None.
Row detail
  • J473 encodes: gst v4l2h264enc/v4l2h265enc default and video_b_frames=0, ffmpeg h264_v4l2m2m Main / hevc_v4l2m2m at 8 Mb/s, fixed raw 1080p30 source, 120 frames. The AVD decodes every stream (120 frames each).
  • s2idle: rtcwake -m freeze -s 15 on the PMU RTC, rc 0, 16 s wall, on the J473 and the M2 Air.
  • J615: gst videotestsrc smpte 1080p30, 120 frames. The PR module was swapped in on a fresh boot, before any encode, because the encoder can't be re-probed once its firmware has started. The stock encodes from the previous boot are the reference.
  • Same session, the J473 default boot with no module change: 4K AVD decode of H.264 High, HEVC Main / Main 10 and VP9 Profile 0 (3840x2160, 60 frames) is bit-exact against software decodes, twice each.
  • Review: media: apple: ave: run the M2 encoder's macOS 27.2 firmware build #2904 (comment) and the two review comments before it.

Assisted-by: LLM (Claude:Opus 5.5)

Review follow-ups for the M2's macOS 27.2 encoder build:

- The ave_t8112_26b123 comment now says where device 12 and handshake
  type 12 come from: the ADT names the chip (ave soc-id "t8112") and the
  build's device table numbers it 12/12, where the 13.5 build uses 18/15.
- The plain size check in ave_fw_probe() now calls ave_fw_sizes_match(),
  the predicate ave_fw_select_build() already uses. The expression is the
  same, so no variant changes behaviour, and KUnit can now assert that the
  near-miss sizes of the M2 chain are refused rather than only that they
  fall back to ave_t8112.
- That refusal now prints the TEXT and DATA sizes, as the builds[] path
  already does, so a third build is easy to identify from a log.
- ave.h says when to describe a build with builds[] (same start, other
  CRC) and when with next_build (start fields of its own).

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at e3cad61.

Nits. The refactor is exact: ave_fw_sizes_match() is the De Morgan form of the old probe expression for variants without builds[], and variants with builds[] still take the ave_fw_find_build() branch first. The new KUnit asserts pin both the refusals and the two real builds, and the rows on J473, M2 Air and J615 are byte-identical.

  1. ave-fw.c:238: the old one-line comment ("Whether these are the segment sizes of one of v's builds") is still there above the new block comment. Drop it.
  2. ave-drv.c:82-86: "This build's device table gives that chip device 12 and handshake type 12" reads as if the values were read out of the firmware image. If they were established by measurement, please say that instead: which values the start handshake accepts on the J473 (12/12 completes) and what happens with the 13.5 values (18/15) on this build. That's evidence we can cite, and it doesn't depend on the firmware's contents.
  3. Optional: ave_fw_sizes_match() is now non-static only for KUnit. EXPORT_SYMBOL_IF_KUNIT or a VISIBLE_IF_KUNIT wrapper keeps that intent visible.

No further rows owed; the posted rows cover all three users of the touched path.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist review at e3cad61f515e657e7cc56fa4930c9f5f31230887.

Checklist Summary

  • §1 No model gating: Pass — ave_fw_sizes_match() is an exact logical refactor of the previous ave_fw_probe() segment-size predicate; variants with builds[] still take ave_fw_find_build() first.
  • §2 Production-ready: Pass.
  • §3 Safety: Pass.
  • §4 Clean-room & attribution: Blocker (see below). Commit author/committer/Signed-off-by: are clean human attribution (Ryan Murray <[email protected]>), zero AI trailers.
  • §5 Evidence: Complete — J473 (M2, 27.2), M2 Air (13.5), and J615 (M3 Air, 26B123) all pass with bit-exact / md5-identical encodes, s2idle, 0 SError/DART/AVC; KUnit 47/47 + host ABI tests pass.
  • §6 Naming: Pass.
  • CI (at review time): host-tests green.

Blocking Finding

  1. §4 Clean-room wording (drivers/media/platform/apple/ave/ave-drv.c:82-84 and commit message):

    "This build's device table gives that chip device 12 and handshake type 12, so the handshake names 12 for both (the 13.5 build, ave_t8112, uses 18/15)."

    Citing an internal table inside Apple's firmware image ("This build's device table") in public kernel comments and the commit message violates §4 (hard): "No Apple code, strings, firmware, disassembly output or Apple tuning values in public code, PRs, issues or channels. Our own traces and measurements are fine." Please reword both the comment and commit message to cite observable hardware/measurement evidence only (e.g., that on J473 the 13.5 handshake values 18/15 fail/are refused while 12/12 completes the start handshake and produces bit-exact encodes).

Minor Cleanups (while amending)

  • drivers/media/platform/apple/ave/ave-fw.c:238: drop the leftover duplicate one-line comment /* Whether these are the segment sizes of one of v's builds */ directly above the new block comment.
  • Optional: annotate ave_fw_sizes_match() with VISIBLE_IF_KUNIT / EXPORT_SYMBOL_IF_KUNIT so its non-static linkage is explicitly KUnit-scoped.

Verdict

REQUEST_CHANGES — code logic, tests, CI, and §5 hardware rows are all solid, but the §4 clean-room wording in ave-drv.c and the commit message must be fixed before merge.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent source review at e3cad61f515e. The new helper keeps the exact size predicate and adds the refusal case; the reported encodes cover both T8112 firmware lines. The provenance concern in the existing review still applies to this head. Use independently documented device facts and observed handshake behavior as the source, and substantiate that provenance before merging the comment and commit text.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #2963. The replacement covers the firmware size refusal and diagnostic while retaining the existing encoder start configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants