Skip to content

media: apple: ave: tests: build both host harnesses again and run them in CI - #2697

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
fix/ave-host-harnesses-20261122
Nov 22, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
fix/ave-host-harnesses-20261122

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

drivers/media/platform/apple/ave/tests/run.py and run-recovery.py build the production AVE encoder code against host boundaries, but nothing runs them, and neither builds on integration/aurora any more. run.py lacks the per-build firmware text CRCs that ave-layout.c now names, plus AVE_RC_CQ and GENMASK(). Under python3 -I, run-recovery.py can't import run.py, and it lacks ave_fw_stop_hung(). Once it does build, strict_6070_recovery fails: it still expects the 6070 behaviour from before b3f30b8 ("recover a 6070 encoder after a hung frame").

Change

  • run.py: copy every AVE_FW_TEXT_CRC_* and AVE_RC_* define from ave.h instead of naming them one by one, add GENMASK() to the shim, and turn off -Wunused-function (the harness pastes whole driver files, so clang flags helpers the tests don't call).
  • run-recovery.py: add its own directory to sys.path and extract ave_fw_stop_hung().
  • strict_6070_recovery now checks the current driver. A session still holds the firmware: -EBUSY, nothing touched. A core that won't stop: -EIO and still broken. Last session gone: the core stops, CTRL reads 0, the firmware counts as halted. The recovery limit still applies, and a recovering firmware still refuses.
  • tools/asahi/run-host-tests.py runs both harnesses (ave-host, ave-recovery), so the host-tests job keeps them building.

No driver code changes.

Testing

  • run.py and run-recovery.py pass with gcc 16.1 and clang 22 (ASan + UBSan, -Werror).
  • Negative control: with ave_fw_shutdown() returning -EBUSY for a broken 6070 again (the pre-b3f30b8e behaviour), strict_6070_recovery fails.
  • run-host-tests.py --only ave: 8/8. Full run-host-tests.py --jobs 8: 448 passed. The 5 failures don't involve AVE: the GCC 16 pmp-floor-tests --mutant class-twice case that tools/asahi: pmp-floor-tests: keep the class-twice mutant building on GCC 16 #2658 fixes, and the two Rust g15 suites (g15-pb-growth, g15-stats-drain, with their mutation runs) hitting the 900 s per-test timeout on a shared build host at load 55.

Still to run

  • Nothing on hardware: tests only.

Assisted-by: LLM (Claude:Opus 5.5)

…m in CI

tests/run.py and tests/run-recovery.py build the production AVE code
against host boundaries, but nothing ran them, and both had stopped
building on integration:

- run.py copied one firmware text CRC by name, while ave-layout.c now
  names one per build (T6041 25G83, T6050/T8142 26A428, T6050 26C5035,
  T8132/T8122 26B123), and it lacked AVE_RC_CQ and GENMASK(). Take every
  AVE_FW_TEXT_CRC_* and AVE_RC_* define from ave.h, and add GENMASK()
  to the shim. The harness pastes whole driver files, so clang's
  -Wunused-function on helpers the tests don't call is turned off.
- run-recovery.py imports run.py, which python3 -I does not find; it
  now puts its own directory on sys.path. It also lacked
  ave_fw_stop_hung(), which ave_fw_shutdown() calls since b3f30b8
  ("media: apple: ave: recover a 6070 encoder after a hung frame").
- strict_6070_recovery still expected the behaviour from before that
  commit (a broken 6070 firmware refuses runtime suspend). It now checks
  what the driver does: -EBUSY while a session holds it; with the last
  session gone the core is stopped and the firmware counts as halted;
  a core that does not stop stays broken with -EIO; the recovery limit
  still applies; a recovering firmware still refuses.

Both harnesses now run from tools/asahi/run-host-tests.py, so CI's
host-tests job builds them on every change.

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

Copy link
Copy Markdown
Contributor Author

Merge-train adversarial review (MERGETRAIN-LINUX2) at f90aa74: NO BLOCKERS.

Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below.

Full review

#2697 media: apple: ave: tests: build both host harnesses again and run them in CI @f90aa74b

VERDICT: NO BLOCKERS

Verified: on base b241e35 both harnesses fail: run.py fails with a cc -Werror build error, and run-recovery.py with ModuleNotFoundError: run under -I. On the PR head and on git merge-tree of head+b241e354 (the base has moved ave-drv.c/ave-fw.c/ave-layout.c/ave.h since a84637d), both pass: run.py --build gives "ok: CRC/boot gates..., ok: J700 builder...", and run-recovery.py gives "ok: recovery ownership...". The new strict_6070_recovery asserts (recovery-test.c:292-323) match the driver after b3f30b8. Test/CI-only, no kernel code touched.

Nits

  • run.py:110 -Wno-unused-function applies to the whole pasted host.c, so it also hides genuinely dead static helpers in the driver files. Prefer __attribute__((unused)) through the shim, or limit it to the pasted ranges.
  • shim.h:23 GENMASK assumes an LP64 host (~0UL >> (63 - h)). Fine for CI, but GENMASK_ULL-style 64-bit math or a static assert on sizeof(long) would be safer.
  • run.py:51-56 now copies every AVE_FW_TEXT_CRC_* / AVE_RC_* define, so the --baseline comparison silently includes CRCs the baseline never had. That does no harm, but say so in the comment.

Missing rows

  • None needed (host-only). The rows that matter come from the first CI run of run-host-tests.py with the ave-host and ave-recovery suites on this head.

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

Adversarial review at live head f90aa74bd3fd695dfddc54fcd6d503a3a7300248 against the pre-PR checklist: 0 code/policy/attribution/CI blockers. Host-test / CI-only change (zero kernel driver or DT changes), so no hardware rows are required.

Checked & clean

  • §1–§2 No model gating / no hacks: Host harnesses and CI wiring only; zero kernel code touched.
  • §3 Deep CI & harness correctness:
    • drivers/media/platform/apple/ave/tests/run.py: wildcard extraction of AVE_FW_TEXT_CRC_* and AVE_RC_* automatically covers newer firmware CRCs already landed on integration/aurora (including AVE_FW_TEXT_CRC_T8142_26B123), and ave_fw_check_boot()/ave_fw_check_build() remain compatible with current integration/aurora HEAD. -Wno-unused-function matches run-recovery.py for full pasted driver files under Clang -Werror.
    • drivers/media/platform/apple/ave/tests/run-recovery.py: adding the script directory to sys.path fixes from run import ... under python3 -I, and extracting ave_fw_stop_hung satisfies ave_fw_shutdown().
    • drivers/media/platform/apple/ave/tests/recovery-test.c: strict_6070_recovery() assertions (lines 292–328) accurately match production ave_fw_stop_hung() / ave_fw_shutdown() / ave_fw_runtime_suspend() post-b3f30b8ecdd3 (active session → -EBUSY, sticky CTRL → -EIO + broken, last session gone → CTRL 0 + AVE_FW_HALTED, 3-attempt recovery window limit → 4th -EBUSY, AVE_FW_RECOVERING → -EBUSY), with a verified negative control.
    • tools/asahi/run-host-tests.py: registers ave-host (run.py --build {out}) and ave-recovery (run-recovery.py) in SUITES invoked by .github/workflows/host-tests.yml. Verified in the live CI job log (44909440682) that both ran and passed (ok ave-host (5.0s), ok ave-recovery (2.0s)).
  • §4 Attribution: Commit f90aa74bd3fd carries human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by: only (zero AI trailers); PR body includes Assisted-by:.
  • §5 Evidence: GCC 16.1 + Clang 22 ASan/UBSan -Werror passes, negative control confirmed, and live host-tests CI green on f90aa74b.
  • §6 Naming: Clean.

Non-blocking nit

  • drivers/media/platform/apple/ave/tests/shim.h:23: GENMASK(h, l) uses (~0UL >> (63 - (h))), which assumes an LP64 host (sizeof(unsigned long) == 8). Fine on 64-bit Linux hosts/CI, though width-independent or GENMASK_ULL-backed math would be slightly safer.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 7deb482 into integration/aurora Nov 22, 2026
1 check passed
Alyx-ML added a commit to Alyx-ML/linux that referenced this pull request Nov 23, 2026
CI compiled only apple-sep.o and the DWC3 object. It ran only
sep.kunitconfig and mt7932.kunitconfig. Most Apple drivers and their
kunitconfig files had no CI at all. A change that broke them was only
found on hardware.

The new workflow has two jobs:

- apple-build: arm64 defconfig plus asahi.config with LLVM=1 and Rust
  1.96.0 (the host-tests pin), with the tree's own bindgen. It checks
  that every Apple driver is still in .config, so a driver that drops
  out cannot pass by building nothing. Then it compiles the Apple driver
  directories and the core files the user4k and KSM work touches.
- kunit: one arm64 QEMU run per suite (ANE boot, transport and PM; DCP
  fabric and topology; asahi; spi-hid; AVD and AVD PM; AVE; ISP; JPEG;
  ProRes; scaler; macsmc; CLPC; trusted keys). fail-fast is off. sep
  and mt7932 stay in their own workflows.

Two suites had no kunitconfig, so add them:

- drivers/mfd/macsmc.kunitconfig runs the macsmc MFD and macsmc-power
  KUnit tests.
- security/keys/trusted-keys/tests/.kunitconfig runs trusted_source,
  the tests for trust sources registered at runtime.

PR aurora-silicon#2697 adds the AVE host harnesses to host-tests. This does not
overlap with it.

Verified: the YAML parses, and every matrix kunitconfig exists in this
tree.

Signed-off-by: Alyx-ML <[email protected]>
Alyx-ML added a commit to Alyx-ML/linux that referenced this pull request Nov 23, 2026
CI compiled only apple-sep.o and the DWC3 object. It ran only
sep.kunitconfig and mt7932.kunitconfig. Most Apple drivers and their
kunitconfig files had no CI at all. A change that broke them was only
found on hardware.

The new workflow has two jobs:

- apple-build: arm64 defconfig plus asahi.config with LLVM=1 and Rust
  1.96.0 (the host-tests pin), with the tree's own bindgen. It checks
  that every Apple driver is still in .config, so a driver that drops
  out cannot pass by building nothing. Then it compiles the Apple driver
  directories and the core files the user4k and KSM work touches.
- kunit: one arm64 QEMU run per suite (ANE boot and PM; DCP fabric and
  topology; asahi; spi-hid; AVD; AVE; ISP; JPEG; ProRes; scaler;
  macsmc; CLPC; trusted keys). fail-fast is off.

Suites that already have their own workflow are not repeated: sep,
mt7932, the Apple display suite (apple-drm-kunit.yml) and pmgr-pwrstate.
Two kunitconfigs are left out because another one runs the same suites:
ane transport.kunitconfig (boot.kunitconfig also sets UBSAN_SHIFT, and
KASAN_INLINE is the default) and avd-pm.kunitconfig (PM_SLEEP is on by
default on arm64).

push on integration/aurora uses the same paths filter as pull_request,
as dt-checks.yml does, so an unrelated merge does not start the jobs.

Two suites had no kunitconfig, so add them:

- drivers/mfd/macsmc.kunitconfig runs the macsmc MFD and macsmc-power
  KUnit tests.
- security/keys/trusted-keys/tests/.kunitconfig runs trusted_source,
  the tests for trust sources registered at runtime.

PR aurora-silicon#2697 adds the AVE host harnesses to host-tests. This does not
overlap with it.

Verified: the YAML parses, every matrix kunitconfig exists in this
tree, and the push and pull_request paths lists are the same.
Alyx-ML added a commit to Alyx-ML/linux that referenced this pull request Nov 23, 2026
CI compiled only apple-sep.o and the DWC3 object. It ran only
sep.kunitconfig and mt7932.kunitconfig. Most Apple drivers and their
kunitconfig files had no CI at all. A change that broke them was only
found on hardware.

The new workflow has two jobs:

- apple-build: arm64 defconfig plus asahi.config with LLVM=1 and Rust
  1.96.0 (the host-tests pin), with the tree's own bindgen. It checks
  that every Apple driver is still in .config, so a driver that drops
  out cannot pass by building nothing. Then it compiles the Apple driver
  directories and the core files the user4k and KSM work touches.
- kunit: one arm64 QEMU run per suite (ANE boot and PM; DCP fabric and
  topology; asahi; spi-hid; AVD; AVE; ISP; JPEG; ProRes; scaler;
  macsmc; CLPC; trusted keys). fail-fast is off.

Suites that already have their own workflow are not repeated: sep,
mt7932, the Apple display suite (apple-drm-kunit.yml) and pmgr-pwrstate.
Two kunitconfigs are left out because another one runs the same suites:
ane transport.kunitconfig (boot.kunitconfig also sets UBSAN_SHIFT, and
KASAN_INLINE is the default) and avd-pm.kunitconfig (PM_SLEEP is on by
default on arm64).

push on integration/aurora uses the same paths filter as pull_request,
as dt-checks.yml does, so an unrelated merge does not start the jobs.

Two suites had no kunitconfig, so add them:

- drivers/mfd/macsmc.kunitconfig runs the macsmc MFD and macsmc-power
  KUnit tests.
- security/keys/trusted-keys/tests/.kunitconfig runs trusted_source,
  the tests for trust sources registered at runtime.

PR aurora-silicon#2697 adds the AVE host harnesses to host-tests. This does not
overlap with it.

Verified: the YAML parses, every matrix kunitconfig exists in this
tree, and the push and pull_request paths lists are the same.

Signed-off-by: Alyx-ML <[email protected]>
@RyanTheTide
RyanTheTide deleted the fix/ave-host-harnesses-20261122 branch November 27, 2026 13:21
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