Skip to content

soc: apple: aop: refuse EPIC calls once the firmware has crashed - #2800

Merged
RyanTheTide merged 2 commits into
mainfrom
isw/aop-crashed-refuse-calls-v2
Nov 29, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
isw/aop-crashed-refuse-calls-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What: AOP: refuse EPIC calls with ENODEV once the firmware has crashed, instead of leaking a tag per call until "too many inflight calls".
Tested: J615 (M3 Air) and J473 (M2 mini) at 726da32, in one combined one-shot test kernel 7.3.0-aurora-dsw1 (main d8c6043 + this PR + 15 other drafts). This PR's files there are byte-identical to the current head 480c8e1 (= 726da32 + a clean merge of main). J615 (AOP sensors present: 4 IIO devices) and J473: no AOP error lines, one 15 s s2idle rc 0 each, 0 failed units, 0 WARN/BUG.
Risk: two-way · Macs with an AOP
Not yet: an AOP crash (needed to see ENODEV instead of "too many inflight calls"; no repro)

Evidence
Original description

Replaces #2342 (same changes, commit trailers fixed).

Refs #2188 (the driver side after an AOP crash; the crash itself is not addressed here)

After RTKit reports the AOP crashed, every EPIC call still reserved a tag on its endpoint before rtkit refused the doorbell ("Device is crashed, cannot send message"). The call was then marked abandoned, keeping its tag until a reply arrives, and a crashed firmware never replies. After about eight calls the table was full, and every later call failed with "Too many inflight calls on endpoint 34". The result was the same, but the log no longer named the crash, and clients saw EIO from a full table.

epic_notify() now checks the crash flag before it reserves anything and fails the call with ENODEV, as calls already fail while the transport is closing. Clients such as the speaker service's pw1/pwrd/idle requests and the sensors report ENODEV for as long as the firmware stays down. No firmware message, power sequence or speaker-protection path changes, and the change applies to every AOP the driver binds.

Evidence

  • Base integration/aurora 0abc2f3. arm64 LLVM=1 build of drivers/soc/apple/, drivers/gpu/drm/asahi/ and drivers/media/platform/apple/avd/ with the fleet config (DRM_ASAHI=m with G15/G16/G18/M5, APPLE_AOP=m; rustc 1.97.1, bindgen 0.73.2): rc 0, and no error or warning in the changed file.
  • checkpatch.pl --strict: 0 errors, 0 warnings.

Not run on hardware. This needs an AOP crash to observe; the expected log after one is spkr pw1 failed: ENODEV on every later request, and no "Too many inflight calls".

After RTKit reports the AOP crashed, every EPIC call still reserved a
tag on its endpoint before rtkit refused the doorbell ("Device is
crashed, cannot send message"). The call was then marked abandoned, to
keep the tag until its reply arrives, and a crashed firmware never
replies. After about eight calls the endpoint had no free tag and every
later call failed with "Too many inflight calls on endpoint 34". The
result was the same, but the log no longer said the firmware was dead,
and the client errors changed from the crash to EIO from a full table.

Check the crash flag before a call reserves anything, and fail it with
ENODEV, as calls already fail while the transport is closing. EPIC
clients (the speaker service's pw1/pwrd/idle requests, the sensors) now
report ENODEV for as long as the firmware stays down, and no tag is used
up.

This does not change the crash itself, nor any AOP firmware or speaker
power sequence.

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

Copy link
Copy Markdown
Contributor Author

Review at 726da32 (non-author, draft). No blocker found; ready as it is, a crash row would be a bonus.

  • Merges cleanly onto integration/aurora 6748d83. One commit, human sign-off only. soc: apple: aop: refuse EPIC calls once the firmware has crashed #2342 is closed.
  • client.crashed is set once in the RTKit crash callback and never cleared (nothing restarts the firmware short of a reboot), so refusing in epic_notify() cannot strand a firmware that has come back.
  • The check sits before the abandoned-call test and before the slot search, so no tag, ring entry or sequence number is consumed for a refused call. The callers (epic_call(), epic_call_ret()) already return ENODEV while the transport is closing, and I found no client that tells EIO from ENODEV, so the error change has no effect beyond the log.
  • A crash that lands between the check and rtkit.send_message() behaves as before for that one call (tag abandoned); every later call is refused.
  • Not chip-specific: one flag in the common AOP data.

Small points, not blocking:

  • Calls already pending when the firmware crashes still wait for their timeout. Completing them from the crash callback with the same error would make the failure immediate; fine as a follow-up.
  • If a client retries on a timer, each refused call is now silent. One rate-limited or once-only line naming the first refused call after a crash would keep the cause visible in logs that have rotated past the crash line.
  • Row, if a crash can be provoked on a test machine: after the crash line, repeated speaker power requests log ENODEV, and "Too many inflight calls" does not appear.

Assisted-by: LLM (Claude:Opus 5.5)

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

The Acquire check rejects calls after a published crash before EPICv4 abandoned-call checks, ring writes or slot allocation. Normal send handling is unchanged. Keep hosted checks and a controlled post-crash caller row pending. The guard leaves crash-during-submit handling to the existing path.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 480c8e1e. App approved, rows J615+J473. Merges 1 h from now under the 6-point rule once hosted CI is green, unless you object.

@github-actions

Copy link
Copy Markdown

Merge readiness at 480c8e1e: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 480c8e1e
Conflicts ok none
PR text ok Risk: two-way · Macs with an AOP

Areas: area:platform

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

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at 480c8e1e. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J615+J473. (5) There's no blocking review. (6) Dj was pinged here 355 min ago with no objection. Revert: git revert -m 1 <merge>.

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

Labels

area:platform Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant