Skip to content

tools: keep the AV1, G15 and TypeC host tests building with their extracted sources - #294

Merged
chriskearney merged 4 commits into
integration/aurorafrom
tools/avd-av1-tail-ref-ts-helper-r2
Oct 30, 2026
Merged

chriskearney merged 4 commits into
integration/aurorafrom
tools/avd-av1-tail-ref-ts-helper-r2

Conversation

@chriskearney

@chriskearney chriskearney commented Oct 30, 2026 •

Copy link
Copy Markdown

These host tests compile production code extracted from the driver sources against host models. Three pending driver changes alter that extracted code, so the tests no longer build or hold for them.

This PR changes only the four host-test files below; no driver code. Each test keeps its existing checks for the current sources and adds the new checks only when the extracted source has the new shape.

AV1 tail controls: tools/asahi/avd-av1-tail-tests.py (for #260)

  • When avd_av1_set_prob() calls avd_av1_ref_ts(), the tool extracts that u64 helper together with its types. Without the helper it builds as before.
  • In --mutation mode, a control program that does not build now reports no mutant verdict and exits 0. The runner's expected-failure check then rejects it instead of counting a caught mutant. Other harness errors are not reclassified.
  • With the helper present, four invalid ref_frame_idx[0] cases (-1, -128, 8, 127), with primary_ref_frame = 0, check:
    • the U64_MAX lookup;
    • inheritance from the destination's own CDF area, compared with a non-periodic pattern computed before the call;
    • that no other destination byte changed.
  • A manual fallback-offset mutation moves that read by one byte, and the new cases catch it. It is not registered in host-tests.json.

G15 admission model: tools/asahi/g15-display-order-tests.py (for #288)

  • The model gains dev_warn!, params::sleep_hold() and a failing ASC read. The one- or two-argument hold_power() mock is chosen from the extracted admit(). Existing scenarios and mutants are unchanged.
  • With the sleep-hold argument, new checks cover:
    • the hold through system sleep is taken only on T6031 with g15_sleep_hold on;
    • turning it off warns once;
    • T6030 never holds through sleep;
    • a failing ASC read returns before any hold is taken.
  • Four mutants each fail one of these checks: the hold on any platform, the parameter ignored, no warning, and the ASC read after the hold.

TypeC selftests: tools/testing/selftests/drivers/gpu/apple-dcp/pm.py and lifecycle.py (for #163)

When cd321x_display_taken() takes only the return code (-ENOSPC: occupied pipeline; -EBUSY: transient):

  • the probe controls check that contract;
  • the disconnect scenario classifies through the real helper, with -ENOSPC as the occupied display;
  • a new transient -EBUSY case must retry before the USB role is switched.

The two-argument form keeps its old checks. The probe control also zero-initializes its cd321x_pm_state: cd321x_pm_init() leaves setup_pending unset, and cd321x_pm_ready() reads it.

Validation (host only)

test current integration/aurora with the pending change
AV1 1792 controls pass; alignment mutants caught #260: 1796 pass; alignment, helper and fallback-offset mutants caught
G15 passes as before (2 admit() mutants) #288: passes with the sleep-hold checks; 6 admit() mutants caught
TypeC probe and disconnect units pass (disconnect unit byte-identical to before; probe differs only by the zero-initialization) #163: probe and disconnect pass; wrong-classifier, occupied-retried and transient-ignored mutants caught

Each test was built with its own flags (-Werror, and ASan/UBSan where the test uses them). These are host models of extracted code. They say nothing about firmware, hardware, suspend or runtime behaviour.

The recorded CI failures of #260, #288 and #163 stand until each runs on a tree that contains this PR. Normal CI, code-owner review and the merge queue apply.

🤖 Generated with Claude Code

chriskearney and others added 2 commits October 30, 2026 11:28
The suite rebuilds avd_av1_set_prob() and its neighbours from avd-av1.c
by name and compiles them with -Werror. A driver whose
avd_av1_set_prob() calls a static u64 avd_av1_ref_ts() helper (#260)
no longer builds there: the helper is not extracted, the extractor only
accepts int and void functions, and u64, s8 and U64_MAX are not
defined. The control run then exits 1 before printing anything.

Extract avd_av1_ref_ts() ahead of avd_av1_set_prob() when the driver
defines it, accept u64 in the extractor and define the three types. A
driver without the helper builds exactly as before.

The two --mutation suites are registered as expected to fail, and any
non-zero exit counted as a caught mutant, including a control program
that did not build. In --mutation mode a build failure now reports
that no mutant verdict was reached and exits 0, so CI flags the suite
instead of passing it. Other harness failures are not changed.

Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndex

With avd_av1_ref_ts() in the driver, check what avd_av1_set_prob()
does when the primary reference slot holds an invalid index: -1, as
userspace passes for intra frames, -128, 8 and 127. It must look up
no reference slot (timestamp U64_MAX, which matches no capture buffer)
and inherit from the destination's own CDF area, the fallback
avd_get_ref_buf() takes for an unknown timestamp.

avd_av1_set_prob() writes the probabilities back to the destination's
CDF area, so the destination after the call cannot show where they were
read from. The case fills the destination with a non-periodic pattern,
takes the expected CDF bytes from that pattern before the call, compares
the probabilities with them, and checks afterwards that every
destination byte still matches the pattern. --mutation fallback-offset
moves only the fallback read (reference == destination) by one byte;
the case catches it.

The reference lookup fixture now records the timestamp and falls back
to the destination for an unknown one; the existing inheritance cases
still require the lookup to ask for timestamp 1000. The new cases and
the new mutation apply only when the driver defines the helper; without
it the suite runs the same 1792 controls as before, and the new
mutation reports that no mutant verdict was reached.

Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chriskearney chriskearney changed the title tools/asahi: avd-av1-tail-tests: extract avd_av1_ref_ts() and cover invalid primary references tools/asahi: update AV1 tail controls for the reference lookup helper Oct 30, 2026
chriskearney and others added 2 commits October 30, 2026 11:46
The suite builds admit() from g15/boot.rs against host models. With
the T6031 system-sleep hold (#288), admit() reads the ASC control word
before it takes the hold, passes whether to hold through system sleep
to glue::hold_power(dev, sleep_hold), reads params::sleep_hold() and
warns with dev_warn! when g15_sleep_hold=0 on T6031. The model has no
dev_warn!, no params module and a one-argument hold_power(), so the
admit() control no longer builds.

Add dev_warn! (counted), params::sleep_hold() and a failing ASC read to
the model, and pick the hold_power() mock from the admit() it is given:
with the sleep-hold argument it records the value passed; without it,
the model is the old one. Every existing scenario and mutant runs
unchanged on both.

For an admit() with the sleep-hold argument, also check that the hold
is taken through system sleep only on T6031 with g15_sleep_hold on,
that g15_sleep_hold=0 on T6031 warns once, that T6030 never holds
through sleep, and that a failing ASC read returns before any hold is
taken on either SoC. Four mutants (the hold on any platform, ignoring
the parameter, no warning, the ASC read after the hold) each fail one
of those checks.

Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a tree where an occupied display pipeline is reported as -ENOSPC on
every SoC, cd321x_display_taken() takes only the return code, and
-EBUSY means a transient mux or PHY failure. The probe controls still
call the two-argument form and no longer build there, and the
disconnect scenario injects -EBUSY as an occupied display, which such a
tree retries instead.

When the tree has the one-argument helper, check its contract in the
probe controls (-ENOSPC is taken; -EBUSY, -EAGAIN, -ETIMEDOUT, -EIO and
0 are not). In the disconnect scenario, let the mode stub classify its
error through the real helper, inject -ENOSPC as the occupied display,
and add a transient -EBUSY case that must retry before the USB role is
switched. A tree with the two-argument helper runs the old checks
unchanged.

The probe control also zero-initializes its cd321x_pm_state:
cd321x_pm_init() does not set setup_pending, which cd321x_pm_ready()
reads.

Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Generated-by: LLM
@chriskearney chriskearney changed the title tools/asahi: update AV1 tail controls for the reference lookup helper tools: keep the AV1, G15 and TypeC host tests building with their extracted sources Oct 30, 2026

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We went through the four commits and ran the three suites on pancake (aarch64, gcc 16, rustc 1.93.1) against current integration/aurora 31748f0, with and without this PR and each target PR merged in. All merges are clean, including all four together.

Nothing here loosens a guard. No pins, hashes or host-tests.json entries change, and on the current tree the generated tests are the same as before: the disconnect unit is byte-identical, the probe unit differs only by budget={0} (pm.py:550), which matches production since cd321x comes from devm_kzalloc() in i2c.c/spmi.c. Each new branch is keyed on the new source shape (avd-av1-tail-tests.py:189, g15-display-order-tests.py:397, pm.py:617, lifecycle.py:464), and if that shape drifts, the build fails loudly instead of silently falling back to the old checks. The one removed assert, timestamp==1000 in the AV1 avd_get_ref_buf() mock (avd-av1-tail-tests.py:82), is replaced by an equivalent last_timestamp==1000 check in the only case that does a lookup.

The --mutation change at avd-av1-tail-tests.py:220 tightens things. On #260 without this PR, both registered mutants "pass" in CI only because the controls don't build (exit 1 counts as caught for an expect: fail entry). We reproduced that locally.

Results:

tree AV1 control / round-up / cpu-unaligned / fallback-offset G15 TypeC probe / disconnect
base 1792 pass / caught / caught / n.a. pass, 2 admit() mutants pass / pass
base+#294 1792 pass / caught / caught / exit 0, no verdict pass, 2 mutants pass / pass
#260 alone build fails (avd_av1_ref_ts implicit) / exit 1 / exit 1
#294+#260 1796 pass / caught / caught / caught
#288 alone admit() does not build (dev_warn, params, 2-arg hold_power)
#294+#288 pass, 6 admit() mutants caught
#163 alone probe fails to build (2 args) / pass
#294+#163 pass / pass
all four 1796 pass, 3 mutants caught pass, 6 mutants pass / pass

Our own mutants beyond the PR's:

  • AV1 on #294+#260: dropping idx < 0, dropping idx >= V4L2_AV1_TOTAL_REFS_PER_FRAME, or returning 0 instead of U64_MAX in avd_av1_ref_ts() all fail invalid_primary_index. s8→u8 passes, but that one is equivalent.
  • G15 on #294+#288: an inverted t6031 test, the ASC read moved after the hold, and a warning when the hold is on all fail the control.
  • TypeC on #294+#163: cd321x_display_taken() as -EBUSY, false, -ENOSPC || -EBUSY and ret != 0 fail both probe and disconnect (the new transient case at lifecycle.py:473). -ENOSPC || -EAGAIN is caught by probe only. Without this PR, disconnect passes all of them, because its shim never called the real helper.

On the targets:

  • #260 and #288: their only CI failure is the host test fixed here.
  • #163: its host-test failure is typec-probe, fixed here. Its compile job failed separately because it couldn't fetch refs/pull/163/merge (exit 128), so KUnit was skipped and its changed cd321x_display_taken_test hasn't run in CI. Being 3152 behind didn't cause a conflict (it merges cleanly), but it will need a rerun or rebase after this lands.

Two small notes, neither blocking:

  • fallback-offset isn't registered in host-tests.json. It can't be until #260 lands, because it exits 0 before that. It would be worth adding with expect: fail in #260 or right after.
  • With #163, the model encodes -EBUSY as transient on every SoC. That follows #163's change, so whether older SoCs still need -EBUSY as "taken" is a question for #163, not this PR.

Test-only, CI is green, and nothing changes for the current tree, so it fits the RC. Landing it first unblocks #260 and #288 on a rerun.

@chriskearney

Copy link
Copy Markdown
Author

Physical boot smoke completed for the kernel from merge ref 9e0fe1b8 (31748f0e plus this PR), built by run 41112080671. The package was linux-aurora 7.2.11.aurora11-1.478, SHA256 dc15bad609a1480ff7e62ce2f75f693c3c76a76f3469621eaf2d880eb07d3a76.

Board Boot OMT pass / fail / skip Candidate regressions vs reference
J293 34 s 37 / 10 / 26 0
J313 27 s 41 / 8 / 24 0
J416C 70 s 42 / 7 / 24 0
J613 32 s 43 / 7 / 23 0
J516S 30 s 41 / 4 / 28 0
J700 44 s 44 / 5 / 24 0

All six passed boot-health and the focused smoke script and returned to their installed kernels. OMT failures/skips remain as reported; some references used older OMT versions. This exercises integration kernel code, not the four host-test files changed by this PR. The installed device trees were preserved. This is not HDMI/DSC, HEVC, suspend, new-DT or full hardware qualification.

One recovery failure is retained: J516S's first return to installed 7.2.11-10-2 had an AOP RTKit init crash and lost microphone sources. One ordinary reboot of that same installed kernel restored all sources and original audio settings. Cause is unproven; carry-over from the candidate warm reboot cannot be excluded. The fresh installed-kernel baseline also retained a Vulkan package-inventory check regression against its older reference.

Protected boot files, installed packages/configuration and audio were checked after return; leases are released. Restoration limits remain explicit: the first four ESP aggregate hashes included a per-boot random seed, so complete ESP byte equality is not established there; J293 lost two pre-existing unowned test-module trees with unproven attribution. Empty labd menu markers and J416C's saved-versus-live command-line difference are recorded. These are bounded smoke results, not a claim of identical whole-machine inventories or a clean first return on every machine.

Normal current-base merge-queue checks still apply.

@chriskearney
chriskearney added this pull request to the merge queue Oct 30, 2026
Merged via the queue into integration/aurora with commit 8970439 Oct 30, 2026
14 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