Skip to content

soc: apple: mailbox: Do not sleep past free FIFO space (aurora-wip rebase) - #630

Merged
RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mbox-tx-wake-every-sender-wip
Oct 30, 2026
Merged

RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mbox-tx-wake-every-sender-wip

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Replaces #596, which conflicts with aurora-wip.

This is the same change rebased onto aurora-wip. aurora-wip has the TX wait failed report from d9d9ee6. The resolution keeps this change's behaviour (complete_all(), a recheck every 2 ms, the interrupt left unmasked for other senders on a timeout) and prints that report once, at the 500 ms deadline of an interrupt-driven wait, so the G17 no-IRQ path stays quiet.

drivers/soc/apple/mailbox.c and include/linux/soc/apple/mailbox.h are byte for byte the files in 46b7a93f14c0, the resolved commit that fleet10 (7.3.0-aurora-fleet10) carries.

Testing (from #596, on fleet10)

  • Neo (J700), M2 and M1 Pro one-shot boots compared with fleet9: no mailbox errors, AOP ready times unchanged. fleet10 is the default on those three. Logs in aurora-ctl reports/fleet10-20261030.
  • J616s warm-reboot loop: 20 of 20 clean boots (fleet9 baseline hung on boot 15), 0 Failed to send management message, 0 TX wait failed, 0 AFK init not sent.
  • apple-dcp host selftests 80/80 on fleet10.

🤖 Generated with Claude Code

A sleeping sender that finds the send FIFO full waits on tx_empty for
the send-empty interrupt, and gives up after 500 ms. Two things make it
miss free space and time out with room in the FIFO:

- The interrupt reports an empty FIFO. A firmware that takes some of
  the queued messages but not all of them frees space without raising
  it.
- Two senders can wait at once, for example a driver starting its
  endpoints while the RTKit work item acknowledges a syslog message.
  The handler masks the interrupt and calls complete(), which wakes
  only one of them. The other sleeps on with the interrupt masked. A
  sender that timed out also masked it, stranding any sender still
  waiting.

On the J616s (M4 Pro) this delayed the AOP start on some warm boots.
One endpoint start failed 504 ms after it was issued, while the AOP
firmware was logging over syslog:

  2.891389 aop: ep 0x28 init sent
  3.395337 aop: Failed to send management message type 0x05: -110
  3.395341 aop: Retrying unsent endpoint start 0x29
  3.395354 aop: ep 0x2b init sent
  3.402107 aop: syslog message: ... AOP IS READY

The retry and the next three requests went out within 20 us, so the
FIFO had room when the first send gave up, and the firmware reported
ready 7 ms later. In an earlier boot the same stall made an AFK init
time out after the firmware had reported ready, and the probe failed.

Wake every waiter with complete_all(), and check the FIFO again every
2 ms while waiting, until the same 500 ms deadline. A woken sender that
still finds the FIFO full rearms the interrupt before it waits, as
before. A sender that times out now leaves the interrupt unmasked for
the others. tx_irq_unmasked still records the state, so the enable
stays balanced: the handler masks it when it fires, and provider
removal masks it otherwise. Atomic senders, which poll, are unchanged.

Rebased onto aurora-wip, which has the TX wait failed report. That
report now prints once, at the deadline of an interrupt-driven wait.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RyanTheTide
RyanTheTide merged commit a149ba9 into aurora-wip Oct 30, 2026
3 checks passed
@RyanTheTide
RyanTheTide deleted the fix/mbox-tx-wake-every-sender-wip branch October 30, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant