Skip to content

accel/ane: h17: wake T6050 firmware waits on the channel IRQ - #4018

Open
satchlj wants to merge 1 commit into
mainfrom
satchlj/ane-h17-t6050-channel-irq
Open

satchlj wants to merge 1 commit into
mainfrom
satchlj/ane-h17-t6050-channel-irq

Conversation

@satchlj

@satchlj satchlj commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

What: Mark ANE_T6050_PLATFORM with ANE_FW_IRQ_CHANNELS and wire one-shot channel-IRQ wakes into the H17 cold backend (ane_fw_cold.c) so firmware waits end on the channel interrupt instead of sleeping out the full poll interval.
Tested: T6050 / J775c (Apple M5 Max, default command line) at exact head d64d5a4854a6 inside batched candidate 7f0aa88166ed (linux-aurora-ane4): boots cleanly, 0 failed units, 0 new kernel errors, 3/3 15 s RTC s2idle PASS (suspend_stats 3/0); AIC2 IRQ 66490 (ane-h17) wakes immediately after lazy first bring-up (435–526 IRQ wakeups per 100 executes across copy and IN_PLACE runs, 0 IRQ storms) and after each sleep cycle (181–183 wakeups per 41 executes). KUnit boot.kunitconfig + transport.kunitconfig 334/334 passed; checkpatch.pl --strict 0/0/0.
Risk: two-way door · T6050 Macs (M5 Pro / M5 Max); other H17 platforms retain irq_role != ANE_FW_IRQ_CHANNELS and keep existing polled behavior.
Not yet: Nothing.

Details

Matches the one-shot channel-IRQ wait pattern already used by ane_h16_backend.c on T6041:

  • Requests interrupt 0 with IRQF_NO_AUTOEN when soc->irq_role == ANE_FW_IRQ_CHANNELS, and frees it in ane_fw_observer_free().
  • Enables IRQ-assisted waits once the firmware is live (eager bring-up, lazy first bring-up in ane_fw_first_bringup(), warm resume, and cold sleep resume) and disables/synchronizes them before power-down or quarantine.
  • Arms the IRQ only past the initial 30 us spin window and falls back to the bounded poll cadence on timeout, exposing irq_wakeups and irq_timeouts in debugfs.
Evidence
$ ./scripts/checkpatch.pl --strict --git HEAD~1..HEAD
total: 0 errors, 0 warnings, 0 checks, 228 lines checked

$ ./tools/testing/kunit/kunit.py run --arch=arm64 --kunitconfig=drivers/accel/ane/boot.kunitconfig
$ ./tools/testing/kunit/kunit.py run --arch=arm64 --kunitconfig=drivers/accel/ane/transport.kunitconfig
Testing complete. Ran 334 tests: passed: 334

T6050 / J775c batched candidate 7f0aa88166ed (contains d64d5a4854a6 unchanged, default cmdline):
- Pre-sleep (lazy first bring-up):
  default-unpinned-copy (100 runs): PASS, irq delta wakeups=436 timeouts=2949
  default-cpu0-copy     (100 runs): PASS, irq delta wakeups=444 timeouts=2958
  default-cpu12-copy    (100 runs): PASS, irq delta wakeups=522 timeouts=2956
  default-unpinned-inplace (100 runs): PASS, irq delta wakeups=436 timeouts=2639
  default-cpu0-inplace     (100 runs): PASS, irq delta wakeups=435 timeouts=2965
  default-cpu12-inplace    (100 runs): PASS, irq delta wakeups=526 timeouts=3005
- Post-3x15s RTC s2idle (40 runs + 1 priming execute per cycle):
  cycle 1: PASS, irq delta wakeups=182 timeouts=1221
  cycle 2: PASS, irq delta wakeups=183 timeouts=1269
  cycle 3: PASS, irq delta wakeups=181 timeouts=1196
- Regression: failed_units=0, suspend_stats: success=3 fail=0, 0 new kernel errors, 0 IRQ storms

The H17 cold backend previously always slept on a polling cadence in
ane_fw_relax() even on platforms whose first interrupt line is the F2H
channel IRQ. On T6050 (M5 Pro/Max), IRQ 0 (AIC2 954) signals channel
replies and completion events, matching the one-shot wake pattern the
H16 backend already uses on T6041.

Mark ANE_T6050_PLATFORM with ANE_FW_IRQ_CHANNELS and wire one-shot
channel-IRQ waits into ane_fw_cold.c:

- Request interrupt 0 with IRQF_NO_AUTOEN when irq_role is
  ANE_FW_IRQ_CHANNELS, and free it on teardown.
- Enable IRQ-assisted waits once the firmware is live (both eager
  bring-up, lazy first bring-up, warm resume, and cold sleep resume)
  and disable/synchronize them before power-down or quarantine.
- Arm the IRQ only past the initial 30 us spin window and fall back to
  the bounded poll cadence on timeout, exposing wakeups/timeouts in the
  execute debugfs stats.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj marked this pull request as ready for review December 3, 2026 00:03
@satchlj
satchlj requested review from a team as code owners December 3, 2026 00:03

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

Reviewed d64d5a4. IRQ-backed waits are limited to the T6050 channel-IRQ role, retain bounded polling fallback, and are disabled and synchronized before power-down or quarantine. The reported J775c run covers first bring-up, execution, and wake from three s2idle cycles.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at d64d5a4

Checked: Only T6050 selects the new channel IRQ role. The IRQ stays masked until an eligible wait. The handler re-masks it and changes the sequence under the same lock, and power-down and quarantine disable and synchronize it. The AIC2 chip uses direct mask/unmask callbacks. I checked the unchanged polling fallback and verified the reported 334 boot/transport KUnit cases and J775c bring-up and three-resume receipts for this head.

@github-actions github-actions Bot added area:media Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Merge readiness at d64d5a48: ready to merge

Check Detail
CI at head ok 7 checks passed
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at d64d5a48
Conflicts ok none
PR text ok Risk: two-way · T6050 Macs (M5 Pro / M5 Max); other H17 platforms retain irqrole != ANEFWIRQCHANNELS and keep existing polled behavior.

Areas: area:media
Merge: gh pr merge 4018 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide RyanTheTide closed this Dec 3, 2026
@RyanTheTide RyanTheTide reopened this Dec 3, 2026
@github-actions github-actions Bot removed the ready-to-merge Meets the merge policy: merge it (bot) label Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:media Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants