Skip to content

media: apple: ave: run command KUnit suites with the module - #2974

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
kunit/apple-ave-module
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
kunit/apple-ave-module

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

The AVE firmware ABI, MCTF and CMP420 KUnit suites require a built-in encoder. Fleet kernels build AVE as a module, so loading the encoder cannot exercise those suites, including the M2 firmware refusal checks from #2963.

Change

Link the three suites into apple-ave so the same tests run in both configurations. Keep the option unavailable when a built-in driver would depend on modular KUnit. Use the driver's module metadata for the linked suites and add a description to the standalone recovery test module.

Testing

Arm64 QEMU passed 47/47 AVE cases with the encoder built in and 47/47 after loading the test-enabled modules on the fleet85 kernel. The host ABI, recovery, input and IPC suites passed. Strict checkpatch reported zero errors, warnings or checks.

Configuration and per-suite results
  • Built-in and loaded-module results were identical: ABI 22/22, MCTF 4/4, CMP420 6/6, recovery 6/6 and sizing 9/9.
  • The fleet85 config selected the command suites with VIDEO_APPLE_AVE=m and KUNIT=m. The driver and both standalone test modules linked with W=1 and had descriptions. Kconfig kept the command suites disabled with VIDEO_APPLE_AVE=y and KUNIT=m.
  • The QEMU module run used fleet85 symbol exports and unsigned local test modules. The loader enabled KUnit using its existing test option. All suites ran against synthetic inputs without encoder hardware or firmware.

Assisted-by: LLM (Codex)

Link the ABI, MCTF and CMP420 suites with apple-ave so KUnit can run
them when the encoder is built as a module. Keep the test option
unavailable when a built-in encoder would call into modular KUnit.

Use the driver metadata for the linked suites and describe the separate
recovery test module.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@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.

Review at f793bc2. No source blockers. Linking the suites to the driver resolves the module-only symbol problem, and the explicit Kconfig condition rules out built-in AVE with modular KUnit. No test is linked when the KUnit option is off. The 47/47 built-in and 47/47 module results include the M2 refusal cases. Keep the new composite-object entries when reconciling the overlapping Makefile hunk in #2902.

@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 audit at live head f793bc2dd546cdbb3b4c993aa8462ada0cb50d14.

Technical Audit (=m vs =y, Kconfig, Kbuild, KUnit)

  • Kconfig (drivers/media/platform/apple/ave/Kconfig): VIDEO_APPLE_AVE_CMD_KUNIT_TEST remains bool with depends on VIDEO_APPLE_AVE && KUNIT and depends on KUNIT=y || VIDEO_APPLE_AVE=m. All matrix combinations behave cleanly: (y, y), (m, y), and (m, m) are permitted; (y, m) is properly excluded so a built-in apple-ave cannot reference modular KUnit symbols; when disabled, zero test objects are linked into apple-ave.
  • Makefile (drivers/media/platform/apple/ave/Makefile): apple-ave-$(CONFIG_VIDEO_APPLE_AVE_CMD_KUNIT_TEST) += ave-abi-test.o ave-mctf-test.o ave-cmp420-test.o appends to apple-ave-y when enabled, which Kbuild links into the apple-ave composite object for both =y and =m, giving the command suites direct visibility to internal AVE symbols without adding EXPORT_SYMBOL* exports.
  • Module metadata & KUnit section layout: kunit_test_suite() places unique static pointers in .kunit_test_suites, so linking all three suites into apple-ave.ko alongside module_platform_driver(ave_driver) is safe. Removing duplicate #include <linux/module.h> / MODULE_LICENSE / MODULE_DESCRIPTION from the three linked test files delegates cleanly to ave-drv.c (MODULE_DESCRIPTION, MODULE_LICENSE("GPL"), MODULE_IMPORT_NS("DMA_BUF")). Adding MODULE_DESCRIPTION to standalone ave-recovery-test.c resolves the modpost warning under VIDEO_APPLE_AVE_KUNIT_TEST=m (matching ave-sizes-test.c).
  • Symbol hygiene & teardown: All helpers/cases in the three linked test files are static (no collisions with apple-ave-y), and dynamic allocations use kunit_kmalloc/kunit_kzalloc or kunit_add_action_or_reset(..., t_free, p).

Checklist (§1–§6) & CI

  • §1 No model gating: Pass.
  • §2 Production-ready, no hacks: Pass — zero runtime/cmdline changes; zero test code linked when VIDEO_APPLE_AVE_CMD_KUNIT_TEST=n.
  • §3 Safety: Pass.
  • §4 Clean-room & attribution: Pass — commit f793bc2dd546 carries human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, with zero AI trailers in commits; PR body discloses Assisted-by: LLM (Codex).
  • §5 Evidence: Pass — KUnit build/packaging change with synthetic inputs and no hardware/firmware path modified; verified 47/47 cases in arm64 QEMU both built-in and as loaded modules on fleet85 (W=1 clean, (y, m) exclusion verified), plus host AVE suites (ave-host, ave-recovery, ave-input, ave-ipc, ave-pm-tests, ave-probe-pm-tests).
  • §6 Naming: Pass.
  • Live CI (f793bc2dd546): 7/7 checks COMPLETED / SUCCESS (host-tests, source, rust-build, kunit, DWC3/ATC builtin-no-atc, DWC3/ATC modular-no-atc, DWC3/ATC builtin-modular-atc). Note that CI kunit currently runs apple_sep* only; AVE KUnit execution was verified locally in arm64 QEMU.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 47dd3aa into integration/aurora Nov 23, 2026
7 checks passed
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