Skip to content

soc: apple: mailbox: Make the send-empty IRQ optional (poll TX) - #65

Merged
RyanTheTide merged 2 commits into
aurora-silicon:aurora-wipfrom
joshuaswarren:ane-dt-polltx-aurora
Oct 8, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:aurora-wipfrom
joshuaswarren:ane-dt-polltx-aurora

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR now holds only the mailbox change, as asked in review. The ANE device-tree nodes and the apple,ane.yaml binding move to the ANE driver PR. The earlier 6-commit version stays available as tag ane-dt-polltx-aurora-v1 (30071bf4).

What. apple-mailbox no longer requires a send-empty IRQ. A node without it gets no IRQ request for that line, and apple_mbox_send() polls the A2I control register for FIFO space, as its atomic path already does (100 us steps, 500 ms timeout). A node that names send-empty takes the old path unchanged; all 71 apple-mailbox nodes in arch/arm64/boot/dts/apple do. The binding gets the apple,t6021-ane-mailbox variant, for which recv-not-empty is the only required interrupt. The other variants keep their constraints.

Why. The Apple device tree gives the T602x ANE one interrupt line, so a node that describes the ANE coprocessor mailbox has no send-empty, and apple-mailbox does not bind it today.

Test status.

  • This series is build-tested only; it has not been booted. On aurora-wip e60f880: drivers/soc/apple/mailbox.o for arm64 with W=1 gives 0 warnings (aarch64-linux-gnu-gcc 12.2.0, linux-aurora package config with RUST off, because the build host has no bindgen). checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on both commits. make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml (dtschema 2026.9): exit 0, no findings.
  • An equivalent lab patch ran on an M2 Max (Asahi 7.1.13 base) from 2026-09-24 to 2026-09-30, and apple-mailbox bound the one-interrupt ANE mailbox there. The FIFO-full poll itself never ran: with the macOS 13.5 ANE firmware, the host sends no mailbox message after probe.
  • Since 2026-09-30 the out-of-tree ANE driver runs on a stock kernel without this patch. Its overlay gives the ANE mailbox a placeholder send-empty line (AIC 1833) that never fires, and the driver leaves the mailbox stopped by default (receipt). So no current user needs this patch. It lets the in-tree device tree describe the ANE mailbox without a placeholder IRQ.
  • Open question: while the mailbox was started on the M2 Max, AIC 884 fired about 700,000 times per second with the I2A FIFO empty. 884 can be the ANE doorbell and not the mailbox receive line.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Update on the jw16 (M1 Max) caveats in the description. The SET0 power state is now confirmed: with ane.ko bound, the SET-window read returned word0 0x3ff and the aggregate state act=0xffffff. The genpd domains set1-4, base and sys_cpu are on. The unplanned reboot still has no established cause. The journal and netconsole stop at a debugfs automount, and pstore is empty. That session had read a raw pmgr regmap through debugfs, and we have not repeated that read.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Mailbox change LGTM.

As for adding device tree nodes, I think it's best added with the driver PR itself, without it, the nodes would be no use here in the kernel.

And as far as t602x support is concerned - disabling it would be a temp. workaround - it can be resolved in the driver right? I'm not too familiar with ANE. But if keeping it enabled does nothing harmful, we can just leave it enabled for simplicity.

The T6021 (M2 Max) ANE coprocessor mailbox is an ASC mailbox, but only
one of its interrupts is known: the Apple device tree gives the ANE a
single interrupt line. The binding requires the four ASC mailbox
interrupts in a fixed order, so a node for this mailbox fails
dtbs_check.

Add the apple,t6021-ane-mailbox compatible with the apple,asc-mailbox-v4
fallback. For it, recv-not-empty is the only required interrupt;
send-empty, send-not-empty and recv-empty may follow in that order.
Without send-empty, the OS must poll the FIFO status before it sends.

The other variants keep their constraints. The four-interrupt rule moves
into a condition that excludes the ANE and AOP setup mailboxes, and the
AOP setup mailbox states its minimum of two interrupts, which the
top-level limit gave it before.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The T6021 (M2 Max) ANE coprocessor mailbox has one known AIC line, which
the device tree names recv-not-empty. apple-mailbox insists on a
send-empty IRQ as well, so it cannot bind that mailbox.

Look send-empty up with platform_get_irq_byname_optional(). When the
node has none (-ENXIO), do not request it, and let apple_mbox_send()
wait for FIFO space by polling the A2I control register, the way its
atomic path already does (100 us steps, 500 ms timeout, under tx_lock).
Any other lookup error still fails the probe with -ENODEV.

A mailbox whose node names send-empty takes the old path unchanged: the
IRQ is requested at the same point with the same flags and name, and a
non-atomic send still sleeps on tx_empty. All 71 apple-mailbox nodes in
arch/arm64/boot/dts/apple name send-empty today.

The Rust wrapper (RUST_APPLE_MAILBOX) needs no change. It only calls
apple_mbox_get_byname(), apple_mbox_start(), apple_mbox_send() and
apple_mbox_stop(), and never reads the IRQ fields, so a Rust client
gets the poll through apple_mbox_send().

An equivalent change ran on an M2 Max lab kernel (Asahi 7.1.13 base)
from 2026-09-24 to 2026-09-30, where apple-mailbox bound the
one-interrupt ANE mailbox. The FIFO-full poll itself did not run there:
with the ANE firmware in use (from macOS 13.5), the host sends no
mailbox message after probe.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren joshuaswarren changed the title Add Apple Neural Engine nodes and poll-TX mailbox soc: apple: mailbox: Make the send-empty IRQ optional (poll TX) Oct 2, 2026
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Thanks, Dj. I've cut this PR down to the mailbox change and its binding update. The ANE nodes and the ANE binding will come with the driver PR, as you suggested. On t602x: the driver now runs the firmware from its own memory, so it no longer depends on iBoot's preloaded copy. The nodes can stay enabled on M2 Pro, Max and Ultra with no workaround, and I'll do it that way in the driver PR.

@chriskearney

Copy link
Copy Markdown
Contributor

Included in our 11.25 release candidate (iconidentify/aurora-linux) together with #155. With the send-empty IRQ present, behaviour is unchanged: every existing mailbox node in the Apple DTs still has it, so only the two new ANE mailboxes take the polling path. M1 Air lab boot: no regressions, and no mailbox errors across DCP, SMC, SEP and audio.

@RyanTheTide
RyanTheTide merged commit 2e1656f into aurora-silicon:aurora-wip Oct 8, 2026
RyanTheTide added a commit that referenced this pull request Oct 8, 2026
[follow-up to #65] soc: apple: mailbox: propagate IRQ lookup errors

Original contributor commits are preserved. Conflict resolutions retain the audited shared driver APIs and their integrated review fixes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr pushed a commit that referenced this pull request Oct 15, 2026
Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
DjDeveloperr pushed a commit that referenced this pull request Oct 16, 2026
soc: apple: mailbox: Make the send-empty IRQ optional (poll TX)

Original contributor commits are preserved. Conflict resolutions retain the audited shared driver APIs and their integrated review fixes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.

4 participants