Repository navigation
soc: apple: tunable: add KUnit tests - #2916
Conversation
Hardware tunables come from devicetree properties of (offset, mask, value) triplets and are written into a device's MMIO range. Add a suite that parses properties of a device node built by the test and applies the result to a buffer of kernel memory: the triplet decoding, the refusal of a missing, empty or badly sized property, of offsets that are unaligned or past the end of the resource, and the mask and value arithmetic and order of the writes. Tests only, no functional change. Signed-off-by: Ryan Murray <[email protected]>
|
Review at ba4b931. Test-only, with no change to tunable.c. The suite is its own module, calls the exported devm_apple_tunable_parse() and apple_tunable_apply() (no copied code), and the Kconfig is correct: tristate, defaults to KUNIT_ALL_TESTS, and selects APPLE_TUNABLE under the same ARCH_APPLE || COMPILE_TEST dependency. The test vectors are synthetic patterns (0xa5a5a5xx, 0xdeadbeef, 0xabcd0000), not machine tunables. Mutations are caught: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at ba4b931a5b2971732525a3009256f1a51ed737aa.
Checklist Summary
- §1 No model gating: Pass (test-only).
- §2 Production-ready, no hacks: Pass.
drivers/soc/apple/tunable.cis untouched (0 lines changed; no driver behavior change and no symbol visibility change underCONFIG_KUNIT=n).tunable-test.obuilds as a standalonetristateKUnit module calling only exporteddevm_apple_tunable_parse()andapple_tunable_apply(), with matchingARCH_APPLE || COMPILE_TESTdependencies and cleankunit_device_register()/devm/kunit_kzalloc()LIFO teardown. - §3 Safety: Pass (operates solely on a test-local
device_nodeand kernel memory buffer; touches no live DT or MMIO; all buffer bounds andDEFINE_RES_MEM(..., 0)unsigned size arithmetic verified). - §4 Clean-room & attribution: Pass (human author/committer and
Signed-off-by: Ryan Murray <[email protected]>only, zero AI trailers in commit; PR body disclosure present; synthetic patterns only). - §5 Evidence: Pass for test-only PR (
kunit.py12/12 + negative controls reported; waiting on CI completion). - §6 Naming: Pass.
Verdict
0 code or policy blockers found. Leaving as COMMENT only because CI is not yet fully green at this head (host-tests, source, DWC3/ATC builtin-no-atc, and DWC3/ATC modular-no-atc are green; kunit, rust-build, and DWC3/ATC builtin-modular-atc are still queued). Ready for APPROVE as soon as the remaining CI checks pass.
Assisted-by: LLM (Gemini 4 Neon)
DjDeveloperr
left a comment
There was a problem hiding this comment.
All 7/7 CI checks (including kunit, host-tests, source, rust-build, and the 3x DWC3/ATC build matrix) are now green on ba4b931a5b29. Standalone KUnit-only coverage for apple-tunable (tunable.c untouched) with 0 code or policy blockers — ready for MERGETRAIN-LINUX4.
Assisted-by: LLM (Gemini 4 Neon)
Problem. Apple hardware tunables are (offset, mask, value) triplets from devicetree that get written into a device's MMIO range. The parser and the apply step had no test.
Change. A new
apple-tunablesuite (drivers/soc/apple/tunable-test.c, a module of its own using the exported API) parses properties of a device node built by the test and applies the result to a buffer of kernel memory:Plus a standalone
drivers/soc/apple/tunable.kunitconfig. Tests only, no functional change.Testing.
kunit.py run --arch=arm64(QEMU, gcc): 12/12, standalone kunitconfig 12/12, and again with all six of this series' branches merged on integration/aurora 322eadc.kunit_test_suite().Still to run. Nothing on hardware: the change is test-only.
Assisted-by: LLM (Claude:Opus 5.5)