Skip to content

soc: apple: aop: explain the AFK init resend after a full mailbox - #2351

Merged
DjDeveloperr merged 1 commit into
mainfrom
hack/aop-audio-c
Nov 24, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
hack/aop-audio-c

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

AopData::start_afk() (drivers/soc/apple/aop.rs:1566-1576 at 0abc2f3, from a3fab20 / #547) sends an AFK init request a second time when the first send found the mailbox full for the whole 500 ms send timeout. The comment says the firmware "can still be busy finishing its own boot". That does not match the code: start_afk() only runs after wake() has waited for endpoint discovery and the IOP power-state acknowledgment, so the firmware has finished its boot handshake.

Change

The comment now states what the code actually knows:

No functional change. The resend is still bounded to one and logged on every use.

Testing

  • make O=... drivers/soc/apple/aop.o (arm64, LLVM, release config): no warnings.

Still to run

Nothing for this change. The capture that would settle the cause is described in #2344: a J616s warm boot with apple_mbox/rtkit dyndbg, timing the IOP power ack against each endpoint start and AFK init.

Hardware rows (combined test kernel, 2026-11-20)

This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:

  • kernel errors, failed units and SELinux denials;
  • microphone capture byte counts;
  • camera frame counts;
  • USB speeds;
  • panel brightness steps;
  • every retry/refusal message these drafts touch;
  • 2 s2idle cycles on M1 Pro, M2 and J616s.

M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.

This PR: Comment only. "AFK init not sent" count: 0 on all four Macs.

The single resend of an AFK init request whose send found the mailbox
full for the whole send timeout said the firmware "can still be busy
finishing its own boot". That is not what the code waits for: the send
already waits on the mailbox's send-empty interrupt, start_afk() runs
only after the RTKit power handshake, and the firmware sends no other
event when it reads its inbound FIFO again. Say so, point at the
J616s report the resend came from, and at the issue that tracks why the
FIFO stays full. No functional change.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

No blockers.

Checked the new comment against the code at the head. AFKEndpoint::start() (drivers/soc/apple/aop.rs:485) is a plain send_message(), and apple_mbox_send() (drivers/soc/apple/mailbox.c:722-735) returns -ETIMEDOUT before apple_mbox_write_msg(), so "never written, resend is safe" holds. start() (aop.rs:1536) runs wake() before start_afk(), so the old "still finishing its own boot" text was wrong. The resend is still one attempt, logged, then the endpoint fails (aop.rs:1567-1584). The commit carries only a human Signed-off-by.

  1. Nit, aop.rs:1572-1573: "The send already waits on the mailbox's send-empty interrupt" is only true on the IRQ path. A mailbox without a send-empty line busy-polls (mailbox.c:768-778), and a poll-only v8 mailbox sleep-polls (:738-752). "The send already waits (send-empty interrupt or poll) for the whole timeout" would be accurate on every mailbox type.

CI: host-tests failed in apt-get update (exit 100, runner mirror), before any test ran. Rerun it; the kunit, rust-build and DWC3/ATC jobs pass.

HW row: none needed for a comment-only change. The combined-kernel row (0 "AFK init not sent" on all four Macs) is enough. This can leave draft.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Adversarial pass at e5c3b15: no blockers; comment-only, the resend logic is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

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

Formal §1–§6 review at e5c3b1515d42bc58d222f58f6ee034278d7ce1c2:

Changes requested before approval:

  1. §6 Live CI is red (UNSTABLE): host-tests failed at e5c3b1515d42 (job 135603109369, failed during Pin the host toolchains before tests ran) and has not been rerun or re-verified green on this head. All live CI checks must be green before approval.
  2. Comment accuracy (drivers/soc/apple/aop.rs:1570-1575):
    • The new comment states "The send already waits on the mailbox's send-empty interrupt", which is only accurate for the IRQ path in drivers/soc/apple/mailbox.c. apple_mbox_send() sleep-polls on poll-only v8 mailboxes (mailbox.c:738-754) and G17 (:755-769), and busy-polls via readl_poll_timeout_atomic when atomic || mbox->irq_send_empty < 0 (:770-783). Please clarify that the send already waits (via send-empty interrupt or polling) for the full send timeout.
    • Avoid bare GitHub issue numbers (#547) and (#2344) in kernel source comments (aop.rs:1573-1575), since they carry no context outside this repository; describe the symptom in the source comment (or use full repo-qualified links if needed) and keep issue references in the commit message.

Other checks verified clean:

  • §1–§4: Comment-only change (no functional/locking/lifetime change, not superseded on integration/aurora 70a00e583b03); commit carries human author/committer and human Signed-off-by: only; PR body carries Assisted-by:.
  • §5: source, rust-build, kunit, and all three DWC3/ATC jobs passed on e5c3b1515d42, and the 4-Mac combined-kernel run reported 0 "AFK init not sent" lines.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at e5c3b151: not ready yet

Check Detail
CI at head ok 7 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA e5c3b151, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:platform

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

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Reran the flaky host-tests job (which had failed on transient apt toolchain pinning); all 8 CI checks are now green at e5c3b1515d42. Only the comment-wording update from the earlier review remains.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 24, 2026

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

Verdict: MERGE at e5c3b1515d42

Blockers: none.

Checked: no Apple material. The diff only changes comments in drivers/soc/apple/aop.rs (no code lines), so there's no runtime change and no row is needed. All 8 CI checks are green after the toolchain-pinning flake was re-run. This replaces my earlier review.

Evidence

Follow-up for the wording (not blocking): "the send already waits on the mailbox's send-empty interrupt" is true on the IRQ path. Poll-only v8 and G17 mailboxes sleep-poll, and the atomic path busy-polls (mailbox.c:738-783). "waits for the mailbox to drain (by interrupt or by polling)" would cover all three.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 24, 2026 19:41

Superseded by the review at e5c3b15

@DjDeveloperr
DjDeveloperr merged commit 223e329 into main Nov 24, 2026
8 of 9 checks passed
@RyanTheTide
RyanTheTide deleted the hack/aop-audio-c branch November 27, 2026 13:21
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) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants