Repository navigation
accel/ane: T8142: apply engine bridge setup at power-up - #3008
Conversation
d1c133d to
4f22d6c
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at 4f22d6ce558d82728e70332d095801a9f379e9fd (REQUEST_CHANGES).
What passes
- Register bounds & RMW mechanics: All 33 offsets in
ane_t8142_bridge_tunables[]are 4-byte aligned and strictly insideane_h17_reg_sizes[0](0x401c + 4 <= 0x2000000), with non-zero masks and(value & ~mask) == 0, verified byane_t8142_bridge_tunables_testacross both T8142 firmware builds (27.0 26A428and27.2 26B123). - Power-up / sleep / resume coverage & non-T8142 invariance: Calling
ane_fw_apply_bridge_tunables()at the end ofane_fw_power_up()after CE bring-up and before CPU release covers initial bring-up (ane_fw_power()), parked wake and cold post-sleep resume (ane_fw_cold_cycle_boot()), and warm resume (ane_fw_warm_boot()). Non-T8142 H17 SoCs (ane_h17_platform,ane_t6050_platform) keepbridge_tunable_count == 0and are unaffected. - §4 Commit attribution & §6 Naming: Commit
4f22d6ce558dcarries human author/committer (Bartosz Nitka <niteria@gmail.com>) and humanSigned-off-by:only (zero AI trailers); PR body carriesAssisted-by:; clean naming. - Live CI:
host-testsgreen (notesep-source/dt-checksdo not trigger ondrivers/accel/ane/*; author ranane-*263/263 andane-fw-platform8/8 KUnit with KASAN+UBSAN locally).
Blockers
- §4 Clean-room provenance & §1 per-SoC hardcoded tuning table (hard):
ane_t8142_bridge_tunables[]indrivers/accel/ane/ane_fw_platform.chardcodes 33{ offset, mask, value }tuples directly in public kernel C source with no documented clean-room provenance.- Critically, these entries include exact sparse bit-field masks (
0x80ff00ff,0x1c000001,0x3f3f0000,0xffff0071,0x07ff07ff,0x00000101) that do not arise from raw MMIO read/write observation alone and match Apple's ADT{ offset, mask, value }tunable format. - Under §4 ("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") and §1 ("Decide from what the machine reports: ADT/DT properties of the block ... Never ... a per-chip table where a property can carry the value"), Apple ADT tunables must not be hardcoded into public kernel C source.
- Recommended path: Read the bridge tunables from a bootloader-supplied DT property (
apple,tunable-*) using the existingdrivers/soc/apple/tunable.c(apple_tunable_parse()/apple_tunable_apply()), matching how ATC AXI2AF (apple,tunable-axi2af) and PMP tunables work. That satisfies both §4 and §1 and immediately generalizes to T6050 and future H17 SoCs without per-SoC C tables. (If any register writes are instead strictly derived from clean-room hypervisor MMIO traces rather than Apple tuning tables, document that clean-room derivation explicitly and do not include copied Apple tunable tables.)
- §5 Evidence completeness:
- The J813 regression line reports
0 new kernel/ANE/DART/CLPC errors, 0 failed systemd units, omitting0 SELinux denials(orN/Aif non-SELinux) and the exact kernel/build/boot ID. - The benchmark table compares baseline against
#3008 + #3009paired; please include a clean same-machine standalone A/B row (same governor, CPU pinning, and CLPC state with vs without#3008alone) with bit-exact conformance verified on both arms.
- The J813 regression line reports
Non-blocking notes
- Minor PR body / code name mismatch: PR body mentions
struct ane_fw_reg_tunableandane_fw_apply_tunables(), while the diff definesstruct ane_fw_tunable,ane_fw_tunable_apply(), andane_fw_apply_bridge_tunables().
Assisted-by: LLM (Gemini 4 Neon)
Without the T8142 engine bus-bridge setup (engine + 0x0000..0x400c), the bridge remains at its reset configuration after power-on and bottlenecks compute-bound ANE models by 1.4x-3.1x on T8142 (M5), even with the CLPC DCS/SOC floor active. Inspecting /arm-io/ane in the T8142 ADT shows no bridge tunable properties (only the ANE DARTs carry dart-tunables-instance-*), so the bootloader cannot supply these registers from ADT. Derive the 25 active register updates directly from clean-room Aura Stage-2 hypervisor MMIO traces of engine + 0x0000..0x401c across two consecutive ANE power-up cycles on J813 (T8142): each struct ane_fw_bridge_op records only the bits observed to change (clear = R32 & ~W32, set = W32 & ~R32), omitting the 8 traced no-op writes where W32 == R32 and preserving all unmodified reset bits without inferred field masks. Attach ane_t8142_bridge_ops[] to ANE_T8142_PLATFORM (shared across all T8142 boards and firmware builds), apply them via ane_fw_apply_bridge_ops() at the end of ane_fw_power_up() after CE bring-up so initial bring-up, parked wake, and post-sleep power cycles all receive them, and add the ane_t8142_bridge_ops_test KUnit test. Other H17 SoCs leave bridge_op_count == 0 and are unaffected. Standalone A/B on J813 (MacBook Air 13" M5, T8142, Linux 7.3.0-air-m5-pr3008+, schedutil, 200 runs, without the CLPC P-cluster floor): unet-320 p50 drops from 2594.4 us to 1023.2 us pinned cpu2 (2.54x) and 2634.0 us to 941.5 us unpinned (2.80x), denoise-320 from 4370.6 us to 1419.3 us (3.08x), and denoise-640 from 13841.8 us to 5246.5 us (2.64x), with bit-exact SHA-256 outputs across all 6 workloads and a 30 s deep sleep/resume cycle. Signed-off-by: Bartosz Nitka <niteria@gmail.com>
4f22d6c to
1485c69
Compare
|
@DjDeveloperr Thanks for the thorough review! Respun at
Ready for re-review once CI finishes. Assisted-by: LLM (Gemini 4 Neon) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review at live head 1485c6934f916c1b524fbec4b92a22a18b846a32 (base integration/aurora 70a00e583b03; not superseded; live CI host-tests: PASS, MERGEABLE/CLEAN).
Verification of Fixes Since Prior Review
- §4 Clean-room provenance & §1 justification resolved:
- Verified on live J813 ADT (
/dev/mtd2) that/device-tree/arm-io/anecarries no bridge tunable properties (onlydart-anehasdart-tunables-instance-{0,1,2}), so Aura/DT cannot supply these register updates from ADT; commit message explains why attaching them toANE_T8142_PLATFORM(shared across all T8142 boards and both27.0/27.2firmware builds; other H17 SoCs keepbridge_op_count == 0) is unavoidable. - Replaced the previous 33-entry sparse-mask table with 25 minimal
{ offset, clear, set }bit-transition ops inane_t8142_bridge_ops[]mechanically derived (clear = R32 & ~W32,set = W32 & ~R32) from clean-room Aura Stage-2 HV MMIO traces across two consecutive ANE power-up cycles on J813, omitting all 8 no-op writes (W32 == R32) and using zero inferred sparse masks. - Independently verified all 25 entries: unique, 4-byte aligned, within
ane_h17_reg_sizes[0](0x400c + 4 <= 0x2000000), disjoint (clear & set == 0), non-empty ((clear | set) != 0), and strictly idempotent (ane_fw_bridge_op_apply()) across initial bring-up (ane_fw_power()), cold sleep/resume (ane_fw_cold_cycle_boot()), and warm resume (ane_fw_warm_boot()).
- Verified on live J813 ADT (
- §5 Standalone A/B & regression tuple resolved:
- Clean same-machine standalone A/B on J813 (
T8142, ANE fw27.2 26B123,Linux m5air 7.3.0-air-m5-pr3008+ #1 SMP PREEMPT Mon Nov 23 22:11:55 CET 2026 aarch64, NixOS25.11.20260324.1073dad, without#3009,schedutilscaling_min_freq=300000, cold reboot between arms swapping onlydrivers/accel/ane/*.ko, 200 runs):1.39x–3.08xspeedup across all 6 workloads with bit-exact SHA-256 outputs on both arms, plus post-30s deep sleep/resumeunet-320bit-exact. - Full §5 health tuple reported: SELinux N/A (disabled on NixOS;
0AVC denials),0failed systemd units,0new kernel/ANE/DART/CLPC errors; KUnitane-*303/303(KASAN+UBSAN),checkpatch.pl --strict0/0/0, live CIhost-testsPASS. - Symbol/test names (
ane_fw_bridge_op,ane_fw_bridge_op_apply,ane_fw_apply_bridge_ops,ane_t8142_bridge_ops_test) are consistent across code, commit message, and PR body.
- Clean same-machine standalone A/B on J813 (
§1–§6 Checklist
- §1 No model gating: PASS — shared across all T8142 boards/firmware builds, ADT absence documented in commit message, non-T8142 SoCs untouched.
- §2 Production-ready, no hacks: PASS — default cmdline, clean idempotent RMW at end of
ane_fw_power_up(). - §3 Safety: PASS — read-before-write (
ane_rd32→ane_fw_bridge_op_apply→ane_wr32), bounds-checked by KUnit. - §4 Clean-room & attribution: PASS — clean-room HV MMIO trace transitions; commit
1485c6934f91carries human author/committer (Bartosz Nitka <niteria@gmail.com>) and humanSigned-off-by:only, zero AI commit trailers; PR body carriesAssisted-by:. - §5 Evidence: PASS — standalone same-machine A/B + conformance + sleep/resume + §5 health tuple + KUnit + CI green.
- §6 Naming: PASS.
Ready for MERGETRAIN-LINUX4.
Assisted-by: LLM (Gemini 4 Neon)
Summary
Applies the 25 active T8142 (M5) engine bus-bridge register updates (
engine + 0x0000..0x400c) at the end ofane_fw_power_up(), after CE bring-up and before releasing the ANE CPU.Without these updates, the engine bridge stays at its reset configuration after power-on and bottlenecks compute-bound ANE workloads by 1.4x–3.1x on T8142, even with the CLPC DCS/SOC floor (
#2865) active.Clean-room provenance & why not DT/ADT tunables
T8142) ADT (/dev/mtd2) confirms/device-tree/arm-io/anecarries no bridge tunable properties (onlydart-anecarriesdart-tunables-instance-{0,1,2}for the DART blocks at0x421800000+), matching H16 and T6050. Aura/bootloader DT therefore cannot populate these registers from ADT.engine + 0x0000..0x401cacross two consecutive ANE power-up cycles on J813 (T8142).R32 -> W32pairs were traced; 8 were no-ops (W32 == R32) and are omitted.ane_t8142_bridge_ops[](struct ane_fw_bridge_op { u32 offset, clear, set; }) mechanically encodes only the bits observed to change (clear = R32 & ~W32,set = W32 & ~R32), preserving all unmodified reset bits with zero inferred sparse field masks.Changes
drivers/accel/ane/ane_fw_platform.h: Addstruct ane_fw_bridge_op,bridge_ops/bridge_op_countonstruct ane_fw_platform, andane_fw_bridge_op_apply().drivers/accel/ane/ane_fw_platform.c: Add the 25-entryane_t8142_bridge_ops[]table onANE_T8142_PLATFORM(shared across all T8142 boards and both 27.0/27.2 firmware builds). Other H17 SoCs (ane_h17_platform,ane_t6050_platform) keepbridge_op_count == 0and are unaffected.drivers/accel/ane/ane_fw_cold.c: Addane_fw_apply_bridge_ops()and invoke it at the end ofane_fw_power_up()so initial bring-up, parked wake, and post-sleep cold power-up all apply the bridge setup.drivers/accel/ane/ane_fw_platform_test.c: Addane_t8142_bridge_ops_testverifying table invariants (count == 25 on both T8142 builds, 0 on other H17 SoCs, 4-byte alignment, bounds insidereg_sizes[0], disjoint non-emptyclear/set, exact bit transitions, and idempotency).Standalone A/B & Hardware Verification (J813 / T8142)
T8142, ANE firmware27.2 26B123)25.11.20260324.1073dad,Linux m5air 7.3.0-air-m5-pr3008+ #1 SMP PREEMPT Mon Nov 23 22:11:55 CET 2026 aarch64(built onorigin/integration/aurora880a97a3dca2, without#3009;policy0/policy1schedutil,scaling_min_freq=300000)systemctl --failed: 0 failed units; 0 new kernel, ANE, DART, or CLPC errors across cold boot, benchmark runs, and 30 s deep sleep/resume (apple_sleepPMU alarm:H17 ANE: firmware stopped, status 0x6e->powered down for system sleep->resume ok: parked until the next request).7.3.0-air-m5-pr3008+kernel image, swapping onlydrivers/accel/ane/*.kobetween unmodified880a97a3dca2(Arm A) and standalone#3008(Arm B) with a full cold reboot between arms (--runs 200,schedutil):880a97a3dca2(p50)#3008alone (25 ops, p50)xf-a-128cpu2259.4 us109.7 usad30d773...)xf-l-256cpu2761.5 us393.2 us14836c0a...)mm-512x2048cpu2724.9 us520.6 us5cf88975...)unet-320cpu22594.4 us1023.2 us676efc35...)unet-3202634.0 us941.5 us676efc35...)denoise-320cpu24370.6 us1419.3 us0d2df693...)denoise-640cpu213841.8 us5246.5 usceda2b05...)unet-320post-30s deep sleepcpu2/ unpinned620.6 us/977.7 us676efc35...)Local Test & Style Checks
./scripts/checkpatch.pl --strict -g origin/integration/aurora..HEAD: 0 errors, 0 warnings, 0 checkspython3 tools/asahi/run-host-tests.py --only ane: 4/4 passedane-*(x86_64,CONFIG_COMPILE_TEST=y,CONFIG_KASAN=y,CONFIG_UBSAN=y): 303/303 passed (includingane-fw-platform8/8 withane_t8142_bridge_ops_test)Assisted-by: LLM (Gemini 4 Neon)