Skip to content

Apple M6 (T8152) USB4/Thunderbolt host router, rear port ACIO3 (on top of #191) - #197

Open
joshuaswarren wants to merge 16 commits into
omacom:integration/aurorafrom
joshuaswarren:m6-usb4
Open

joshuaswarren wants to merge 16 commits into
omacom:integration/aurorafrom
joshuaswarren:m6-usb4

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary

The USB4 / Thunderbolt host router of the Apple M6 (T8152) Mac mini, on the rear port (ACIO3): the ACIO CPU start through the MXWrap block, an optional NHI pdf register range, the binding, and the ACIO3 device tree nodes. Five commits.

The first ten commits of this branch are #191 (the M6 base). Only the last five commits are new here: the diff of this PR shows the base too until #191 merges, then I rebase. Review the last five.

It is not needed for the release candidate, and there is no rush to review or merge it.

Commits

# Commit Notes
11 thunderbolt: apple: start the ACIO CPU through the MXWrap block on T8152 a T8152 entry in the existing apple_cio_hw table, plus the missing apple,t8152-usb4-acio match entry
12 thunderbolt: apple: make the NHI "pdf" register range optional the M1/M2 pdf offset aborts on T8152; the rings start without it
13 dt-bindings: thunderbolt: apple: describe the T8152 ACIO and NHI resets is not required for apple,t8152-usb4-acio (the reset layer comes later)
14 dt-bindings: mailbox: apple: add the T8152 ACIO mailbox apple,t8152-acio-mailbox with the apple,asc-mailbox-v4 fallback, so the in-tree mailbox driver binds without a change
15 arm64: dts: apple: t8152-j873g: add the ACIO3 (USB4) nodes new t8152-j873g-usb4.dtsi, one include line in t8152-j873g.dts; no reset node

Measured, on an M6 Mac mini (an older tree, the same logic)

  • The ACIO CPU starts through the wrapper, the NHI probes, the rings come up with TX and RX interrupts, and the USB4 domain and host router enumerate.

Not measured

  • This branch on hardware.
  • Lane training beyond enumeration; tunnels; hot plug; the cable-plug event path (bring-up used a debug-only manual cable event that is not part of this series).
  • The cpu region mapped non-posted (the base does this for the other SoCs) on T8152.
  • M1/M2 hardware: their code paths and table entries are unchanged.
  • The kernel's own make dtbs_check / dt_binding_check. A hand-run dt-validate (dtschema 2026.9) of the board file is below.

Blocked / not in this branch

  • The apple,t8152-ascwrap-v8-mailbox mailbox compatible, the CIO reset driver and the resets property are separate changes. The ACIO node therefore cannot work on a board built from this branch alone.

Receipts

arm64 clang, W=1, integration/aurora at 42672ed plus the 15 commits of this branch, 16K pages, USB4_APPLE_SOC=m, PCIE_APPLE=m: the eight objects of #191, drivers/thunderbolt/apple.o and apple/t8152-j873g.dtb, all rc 0, 0 warnings. dtcheck.sh (dtschema 2026.9) on the board file: see the first comment. check-commits: Signed-off-by on all 15 commits; no checkpatch errors (warnings: the MAINTAINERS notice for new files).

The T8152 GPIO block has the same layout as the T8140 one. Match
"apple,t8152-pinctrl" with the T8140 hardware data.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
T8152 has a SART with a new register layout: the per-entry config,
physical address and size registers sit at 0x00, 0x60 and 0xc0. Add the
operations for it and match "apple,t8152-sart". The binding lists the
new compatible as a stand-alone entry.

Measured on an M6 Mac mini with an earlier form of this change: the
machine boots and runs its root file system from NVMe, which uses this
SART. This version is compile-checked only.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
On T8152 the queue setup registers (admin queue, IO queues, the linear
submission queue control) live at different offsets, and a few of them
accept writes but read back zero. Add a register translation for that
layout, skip the read-back checks that cannot work, and describe the
controller with a new hardware data block matched by
"apple,t8152-nvme-ans2".

The ANS is a virtual PMGR device on this SoC and has no reset line, so
the hardware data block carries a no_reset_control flag. Only T8152 skips
the reset lookup. Every other SoC still requires a reset control and
fails the probe without one, as before.

The binding gets the new compatible. On T8152 the resets, power-domains
and power-domain-names properties are not required, and the controller
has two register regions (the NVMMU registers live in the first one).

Measured on an M6 Mac mini with an earlier form of this change: the
machine boots and runs its root file system from NVMe. This version is
compile-checked only.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Author

Receipts at head a70664c5392dcc13048875f528e242619e798280:

  • Compile: arm64 clang W=1, 16K pages, USB4_APPLE_SOC=m, PCIE_APPLE=m: the eight objects of Apple M6 (T8152) Mac mini base: PMGR, USB2, DART, NVMe, board fragments #191, drivers/thunderbolt/apple.o and apple/t8152-j873g.dtb, all rc 0, 0 warnings (offload-build, checkG.log).
  • dtcheck.sh (dtschema 2026.9, by hand) on t8152-j873g.dts: cpp rc 0, dtc -@ rc 0 with 0 warning lines, dt-validate 0 lines. The 72 binding examples print one message, display/apple,dcp-typec-routes.yaml, which is in the baseline on any tree.
  • check-commits: Signed-off-by on all commits; no checkpatch errors.
  • Not run: a boot, the kernel's own make dtbs_check / dt_binding_check.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The latest changes appear safe to merge within the PR’s stated bring-up scope.

Summary

Adds the T8152 rear-port USB4 host router, its device-tree nodes, and bindings. The latest changes replace the incorrect ASC mailbox fallback with a dedicated counted-FIFO implementation.

  • The T8152 rear port starts its USB4 host router through ACIO3.
  • T8152 DARTs manage address translation through a shared doorbell.
  • T8152 USB2 controllers start in fixed host or peripheral mode.
  • T8152 power slots become power domains that wait for hardware acknowledgments.
  • T8152 NVMe, SART, and pin-control devices gain matching Linux support.

Reviews (7) · Last reviewed commit: "arm64: dts: apple: t8152-j873g: add the ..." · Reviewed by Greptile

Comment thread drivers/thunderbolt/apple.c Resolved
@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at a70664c for the four new commits (1f5fbab dt-bindings, 9537aff NHI pdf, fb9b7c3 ACIO start, a70664c ACIO3 dts). The ten commits below them are the #191 head 9af1827 that I reviewed there.

Read: the four commit diffs and thunderbolt/apple.c at this head (start sequence, probe, ring configure).

Checked:

  • ACIO start (fb9b7c3): the new T8152 hw entry has mxwrap without lstx_explicit, so the M3_CTRL start write is skipped and the MXWrap RUN write starts the CPU. t6030 has both flags and still takes the lstx branch, so its behaviour is unchanged. The "cpu" region is mapped when mxwrap is set (probe fails with a message if it is missing). The swallowed M3_STAT timeout is fine because apple_rtkit_boot has already succeeded by then; that is the real evidence the firmware runs. The comment names the NHI HOP_COUNT check as the readiness test, which only proves the NHI block answers; say "RTKit boot".
  • NHI pdf (9537aff): the RX options+4 write is kept when pdf_base is set (M1/M2) or the controller is type 7, as before; only a DT with no "pdf" range skips it. One consequence: a M1/M2 DT that loses its "pdf" range now probes without an error where it used to fail. Nit.
  • Binding: resets stay required for every compatible except T8152, and the driver gets the reset optionally, consistent. reg/reg-names allow the third "cpu" entry, ranges allow the second window.
  • dts: unit addresses match the first reg of each node. ACIO ranges: child 0 maps 0x411000000 for 16 MiB, child 0x2000000 maps the doorbell page at 0x200000000; the DART's second reg 0x2000280 falls inside it and corresponds to the 0x280 offset in the comment. The DART driver maps the doorbell without claiming the region, so sharing is safe. NHI interrupts 1842 to 1865 are 12 TX plus 12 RX with matching names; iommus list 12 TX SIDs (0-11) and 12 RX SIDs (16-27), all below the 28 streams. The ACIO node lists four power domains and the driver attaches a list (devm_pm_domain_attach_list).
  • The loader fills the tunables and the DROM; the DROM placeholder [00] is only valid with the loader. Nit.

Not checked: any address, interrupt or tunable against the ADT (no ADT here); compile and dt check receipts are the author's, not reproduced; nothing run on hardware.

@joshuaswarren

Copy link
Copy Markdown
Author

New head df61647fa3fda857ebd3a80a119dfa4d24bc7a86, four commits, same code. Per the review at a70664c5 (w7Q):

  • M3_STAT comments: the struct entry comment, the poll fallback comment and the commit text of the first commit now name the RTKit boot as the readiness evidence, not HOP_COUNT.
  • M1/M2 device tree without pdf: the commit text of the NHI commit says such a tree now probes without PDF writes and without an error or message. I did not add a dev_dbg.

Receipts at this head: arm64 clang W=1, 16K pages, USB4_APPLE_SOC=m, PCIE_APPLE=m: the eight objects of #191, drivers/thunderbolt/apple.o and t8152-j873g.dtb, all rc 0, 0 warnings. dtcheck.sh (dtschema 2026.9): dtc -@ 0 warning lines, dt-validate of the board file 0 lines, the 72 examples print only the baseline message. Not run: a boot, the kernel's own make dtbs_check.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at df61647

Read: the four rebased commits (76e5e12, 6b47316, 666bf60, df61647) against the ones I reviewed at a70664c, compared as diffs with the hash lines removed.

  • The binding and dts commits are identical. The NHI commit differs only in hunk line offsets.
  • The ACIO commit differs only in the two comments (the readiness check is now named as the RTKit boot) and hunk offsets. No code change.
    The review at a70664c therefore carries over, including the two nits I left (a M1/M2 DT that loses its "pdf" range probes silently; the DROM placeholder). Not run: build. Compile and dt check receipts are the author's, not reproduced. Merge still needs CI and a second non-author GREEN.

Comment thread drivers/iommu/apple-dart.c Resolved
Comment thread drivers/usb/dwc3/dwc3-apple.c Resolved
Comment thread drivers/pmdomain/apple/pmgr-psd.c Resolved
@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at df61647

Read: the four commits above the #191 head (76e5e12, 6b47316, 666bf60, df61647); drivers/thunderbolt/apple.c, both USB4 bindings and t8152-j873g-usb4.dtsi at the #198 head, which carries these four commits unchanged.

Checked

  • Addresses and numbers against the M6 ADT dump.
    • ACIO3: NHI 0x211f00000 (0x100000); rc is three adjacent 0x4000 blocks from 0x211ac0000; cpu is the second acio-cpu3 region 0x211100000 (0x4000); the mailbox at 0x211178080 sits at +0x80 of the first acio-cpu3 region; its interrupts are 1873 and 1872; sram 0x211080000 lies inside the third acio-cpu3 region. Each plus 0x200000000 equals the dtsi.
    • The 24 NHI interrupts are 1842 to 1865; the ADT lists 1854 to 1865 first, the dtsi orders TX before RX as its comment says.
    • DART: reg 0x211a80000 (0xc000), interrupt 1869, 28 SIDs, vm-base 0x10000000000, vm-size 0x30000000000. All 22 apple,tunable tuples equal dart-tunables-instance-0.
    • PSD windows are 0x303a10000 + (slot << 8) for slots 70, 66, 62 and 89: 0x303a14600, 0x303a14200, 0x303a13e00, 0x303a15900. Slots 70, 66, 62 are the ACIO3 power-gates; 89 is the second power-gates entry of apciec3.
  • dt check (dtschema 2026.9) on this head's board file: dtc -@ 0 warning lines, dt-validate 0 lines, 72 binding examples with one message, the baseline one (dcp-typec-routes).
  • ACIO start. lstx_explicit is tested first, so t6030 keeps its M3_CTRL write and else if (!mxwrap) changes only T8152. apple_rtkit_boot() runs before the M3_STAT poll, so swallowing that timeout leaves the RTKit boot as the readiness check, as the comments now say.
  • NHI binding. reg needs two entries for every compatible except t8142 and t8152, so an M1/M2 tree without pdf fails the schema before the driver sees it.

Findings

  1. ACIO binding is looser than the driver. reg-names[2] is enum [pcie-adapter, cpu], reg allows 3 items and ranges 2 items for every compatible. Nothing requires cpu for t6030 and T8152, but apple_cio_probe() returns -EINVAL ("Missing MxWrap cpu region") without it. I removed the cpu region from the T8152 ACIO node: dt-validate reports 0 messages. Add per-compatible clauses: cpu required for t6030 and t8152, ranges maxItems 2 only for t8152.
  2. apple,t8152-ascwrap-v8-mailbox has no binding and no driver. Checkpatch reports UNDOCUMENTED_DT_STRING on it. Add the binding, or leave the mailbox node out until it lands.
  3. Every T8152 ACIO start waits 500 ms for nothing. The comment says M3_STAT never becomes ready, so the readl_poll_timeout(..., 500000) always times out and then logs the warning. When m3_stat_optional is set, read M3_STAT once and skip the wait.
  4. Source comments cite bring-up sessions. "window 7, 2026-10-23", "Window 4 (2026-10-23)", "PROVEN window 9" and the PROVEN/INFERRED tags mean nothing to a reader of the tree. State the fact instead (for example "a read at ACIO + 0xdb0000 aborts on T8152").

The four PSD parents set to ps_atc3_usb_aon and the DROM placeholder are stated in the PR and the commit text.

Not checked

Compile and checkpatch receipts (checkpatch warnings reproduced: UNDOCUMENTED_DT_STRING for the mailbox compatible, FILE_PATH_CHANGES), any hardware behavior, the sram size 0x20000 (the ADT region that contains it is larger). Merge still needs CI and the owner's word.

Comment thread drivers/usb/dwc3/dwc3-apple.c Resolved
@joshuaswarren

Copy link
Copy Markdown
Author

New head 034b64ca3b844c5ed90f3d974cceeba406644494 (rebased on the same base as the other M6 PRs, plus the fixes for the Greptile and reviewer findings; every Greptile thread of the previous heads has a reply with the commit and is resolved).

Receipts at this head (CT-local, arm64 clang W=1, 16K pages, PCIE_APPLE=m, USB4_APPLE_SOC=m): thunderbolt/apple.o, the eight objects of #191 and t8152-j873g.dtb, rc 0, 0 warnings. dtcheck.sh (dtschema 2026.9) on the board file: dtc -@ 0 warning lines, dt-validate 0 lines, the binding examples print only the baseline message of display/apple,dcp-typec-routes.yaml. Changes since the last GREEN: a failing phy_init() or phy_power_on() in dwc3_apple_core_start() now goes through dwc3_apple_core_stop(); the PSD parents (ps_atcN_usb_aon, ps_atcN_usb); iommus exactly four; the host-only lists skipped for a fixed peripheral; the Gen3 doorbell guarded for non-arm64 builds; a locked Gen3 DART no longer takes the range flush through TLB_CMD; the PSD group power-off restores the stopped slots. Not run: a boot, the kernel's own make dtbs_check.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at 034b64c

Read: the fourteen commits against the ones I reviewed at df61647, compared per commit as diffs with the hash lines removed. The ten base commits are the #191 head b8943e8 (delta review posted there). Of the four ACIO commits, the NHI "pdf", binding and ACIO3 dts commits are identical; the ACIO start commit changed in one place: for T8152 (m3_stat_optional) apple_cio_start no longer polls M3_STAT at all (state is set to 0 and the RTKit boot above is the readiness check), where the previous version polled for 500 ms and then ignored the timeout. The other hw tables still take their original poll (the strict and the normal branch are unchanged), and the later strict-firmware check cannot trigger on T8152. Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN.

@joshuaswarren

Copy link
Copy Markdown
Author

New head dfde2fd2c42f8e5d55b78661223d1876b3546a33, five commits (a mailbox binding commit is new). Per the review at df61647f (w7X issuecomment-6375472148):

  1. ACIO binding looser than the driver: fixed. The node has a cpu region on purpose (rc, sram, cpu; cpu is the MXWrap block the driver needs). The base binding allowed at most three reg entries while the t6030 device trees already carry four, and it did not require cpu. Now reg allows up to four, reg-names is a oneOf, and an allOf requires cpu for apple,t6030-usb4-acio and apple,t8152-usb4-acio and forbids it for the other compatibles.
  2. Mailbox without a binding: added. apple,t8152-acio-mailbox with the apple,asc-mailbox-v4 fallback and the interrupts named like the ANE mailboxes, so the in-tree driver binds through the fallback. Not run on hardware through that driver.
  3. M3_STAT wait: skipped when m3_stat_optional is set (earlier head).
  4. Session stamps in comments: removed from both dtsi files; facts only.

Receipts at this head (CT-local, arm64 clang W=1, 16K pages): the eight objects of #191, thunderbolt/apple.o, soc/apple/mailbox.o and t8152-j873g.dtb, all rc 0, 0 warnings. dtcheck.sh: board file 0 messages, only the baseline example message. A t8103-j274 board checked by the author: 0 messages with the new ACIO binding; the t6030 board could not be run, checked by reading.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at dfde2fd

Read: the fifteen commits against the ones I reviewed at 034b64c, compared per commit as diffs with the hash lines removed. The ten base commits and the ACIO start and NHI commits are identical to what I cleared. What changed:

  • ACIO binding: reg allows four entries, with reg-names as three alternatives (rc, sram, pcie-adapter[, cpu]; rc, sram, cpu); the "cpu" region is now required for apple,t6030-usb4-acio and apple,t8152-usb4-acio and forbidden for the others. The T8152 dts uses rc, sram, cpu, which is the third alternative.
  • New commit, mailbox binding: apple,t8152-acio-mailbox with the apple,asc-mailbox-v4 fallback, added to the existing branches that fix the interrupt-names order (recv-not-empty first). The dts mailbox node now uses that pair and lists 1872 (recv-not-empty) before 1873 (send-empty), which is the order that branch requires; the ADT lists 1873 as inbox empty and 1872 as outbox not empty, which the new comment states.
  • dts: comment cleanup (session stamps and PROVEN/INFERRED tags removed), nothing else.
    One thing I cannot establish from here: the previous mailbox compatible (apple,t8152-ascwrap-v8-mailbox) is replaced by the generic v4 fallback, so the driver now takes the asc-mailbox-v4 path for this node; the comment says the layout is the counted-FIFO one of the SMC and ANS mailboxes, which w71's board run is the evidence for. Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN.

On T8152 the ATC USB blocks (and the GPU) are behind a per-slot service
request in the power state director, on top of the normal PMGR power
states. Expose each slot, or a group of slots that must come up together,
as a generic power domain. Power-on writes the slot request and waits for
the acknowledge; power-off requests state 6 in reverse order.

Add the devicetree binding.

When a power-on request times out, the slot that timed out is put back to idle with the slots before it, because its acknowledge was not seen but it may still start.

When a group power-off fails, every slot is put back to its active state, including a slot whose off request timed out and may still finish stopping, because genpd keeps the domain marked on after a failed power-off and would skip power_on at the next resume.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The fixed host ports on T8152 need only the USB2 part of the PHY. Add a
driver that applies the bootloader-supplied calibration, handles host and
device mode, and leaves the USB3 and USB4 lanes alone.

Add the devicetree binding.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
A hub with the Apple ID 05ac:800f sits behind the front ports of the M6
Mac mini. Add that ID to the hub quirk table with
HUB_QUIRK_DISABLE_AUTOSUSPEND so the kernel keeps it powered.

The match is on the vendor and product ID alone. Every hub with this ID
loses autosuspend, not only the one on this machine. The constant is
named after the ID, USB_PRODUCT_APPLE_HUB_800F, because the ID is
Apple's and the part behind it was not identified from the descriptor.

This quirk was not measured on its own: it only keeps the hub awake.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add a peripherals fragment to the M6 Mac mini board file: the always-on
GPIO controller with the reset hog for the front-port USB hub, and the
four PSD service slots for the USB ports.

The NVMe controller, its mailbox and its address filter are not described
here. The NVMe node needs a mailbox driver change that is not in this
tree yet.

The fragment holds only addresses, interrupt numbers and wiring. The boot
loader adds the register tunables that some blocks need. The PMGR power
domains are not described yet, so nodes that need them are left out.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the DART of the Apple M6 (T8152), a third-generation DART whose
topology is fixed by the hardware. Its streams are described by static
parameters instead of being probed, and it takes no MMIO access until the
first use, because the block can be power gated behind the ATC USB
domains.

The binding requires a second register region (the TLB invalidate
doorbell) for the T8152 compatible only.

The change adds:
- the apple,t8152-dart compatible and its hardware description;
- static topology and "first use" initialisation of every DART;
- the Gen3 TLB invalidate and the fault handler;
- the reset path for DARTs that the boot loader leaves locked.

A DART that the boot loader leaves locked is held powered for its
lifetime. That applies to Gen3 hardware only. The other generations keep
their behaviour. The first-use initialisation re-reads the parameters and fails if the
page size differs from the one assumed at probe. It runs under a spinlock, and
every function it calls is non-sleeping (register accesses and an atomic
poll).

Measured on an M6 Mac mini with the earlier form of this change: the
display controller DART attaches locked on every boot. This version is
rebased on current integration/aurora and was compile-checked only. The
USB DART paths need the T8152 PSD power domains and were not run on
their own.

The doorbell store and the TLBI of the Gen3 invalidate are arm64 instructions: they are built only with CONFIG_ARM64, and other architectures (COMPILE_TEST) get a stub that returns -EOPNOTSUPP. A locked Gen3 DART no longer takes the range flush through TLB_CMD, which Gen3 does not accept; it uses the full-stream Gen3 callback.

Gen3 does not take commands through TLB_CMD, so the unlock after a lock-on-error exception is not sent there: the DART logs once that this is not supported. The stale-exception drain of a reset does not read 0x704 on Gen3, like the fault handler.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the apple,t8152-dwc3 compatible to the Apple dwc3 glue. The ATC ports
of the M6 (T8152) controller never switch roles through the Type-C
controller. The glue starts the controller as a fixed host, with or
without a hub child, or as a fixed peripheral when the node sets
dr_mode = "peripheral".

The T8152 profile is USB2 only: it needs maximum-speed = "high-speed",
takes no reset line, and its USB3 PHY is optional. The calibration lists
come from the device tree (apple,tunable-* properties that the boot loader
fills in at runtime; the binding does not require them in the board file) and are applied to the register windows in a fixed order after
the core is reset. The pipe handler is set up for the selected role.

The apple,t8103-dwc3 paths keep their behaviour. The controller stays a
syscore device while it runs, as before: no separate suspend or resume
path is added for T8152.

The earlier form of this change ran on an M6 Mac mini USB2 front port.
This version is rebased on current integration/aurora and was
compile-checked only. SuperSpeed does not train yet and is not part of
this change.

A fixed peripheral does not require the host-only calibration lists at probe, since it never applies them. The binding lists exactly four iommus entries, two stream IDs on each of two DARTs.

If the T8152 USB2 PHY fails to initialise or power on during core start, the failure goes through the same shutdown as a failed core init, so the reset and syscore flags set earlier are cleared again.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the power management blocks and the USB controllers of the Mac
mini (M6, J873) next to the peripherals fragment:
- the two PMGR blocks and their power domains, in t8152-j873-pmgr.dtsi;
- for each of the four USB ports (usb0, usb1, usb2 and usb3 of the SoC):
  two DART instances, the USB2 PHY and the dwc3 controller.

The register windows, interrupts and DART tunables are the values of the
Apple device tree of the machine. The boot loader adds the apple,tunable-*
lists of the USB2 PHY and the controller at runtime.

The bindings list the apple,t8152-pmgr and apple,t8152-pmgr-pwrstate
compatibles, and the dwc3 and USB2 PHY bindings take the tunable lists as
optional, because the boot loader adds them.

The fragment is a plain description of the hardware. The ports that the
change describes run USB2 only: SuperSpeed and USB4 are not part of it.

This commit compiles to a device tree blob with dtc without warnings. It
was not booted. The bring-up it comes from enumerated the front-port USB2
hub and a USB disk at 480 Mb/s.

The four PSD service slots get their PMGR domains (the aon and the port domain of their port) as parents, so genpd powers them before the slot request.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Author

NOT GREEN at 2f5704e

One finding blocks; the other three items I raised on df61647f are fixed and checked.

Fixed, checked

  • ACIO binding per compatible. reg-names is now a oneOf (rc, sram, pcie-adapter[, cpu] / rc, sram, cpu) and the cpu region is required for apple,t6030-usb4-acio and apple,t8152-usb4-acio only. I removed the cpu region from the T8152 ACIO node again: dt-validate now reports reg-names: ['rc', 'sram'] does not contain items matching the given schema, where before it reported nothing.
  • M3_STAT. apple_cio_start() no longer polls M3_STAT when m3_stat_optional is set; the RTKit boot is the readiness check and the 500 ms wait on every start is gone.
  • Comments. The session stamps and the PROVEN/INFERRED tags are gone from the dtsi.
  • dtcheck.sh (dtschema 2026.9) on the combined tree: dtc -@ 0 warning lines, dt-validate of the board file 0 lines, 73 binding examples with only the baseline dcp-typec-routes message.

Blocking

The ACIO mailbox compatible binds the in-tree mailbox driver to the wrong register layout. dt-bindings: mailbox: apple: add the T8152 ACIO mailbox and the dtsi node use compatible = "apple,t8152-acio-mailbox", "apple,asc-mailbox-v4", and the commit text says the register layout is the counted FIFO (receive at +0, transmit at +0x10, status at +0x20). In drivers/soc/apple/mailbox.c at this head, apple,asc-mailbox-v4 selects apple_mbox_asc_hw, the classic ASC layout: A2I_CONTROL 0x110, A2I_SEND0 0x800, I2A_CONTROL 0x114, I2A_RECV0 0x830. There is no counted-FIFO table in this tree (counted_fifo does not occur in the file). The node maps reg = <0x4 0x11178080 0x0 0x80>, so once the ACIO driver starts RTKit the mailbox driver reads and writes at offsets up to 0x838 from that base, which are other registers of the co-processor wrapper, not the mailbox. The schema check cannot see this, and before this change the node had no matching driver at all.

Either of these fixes it:

  1. Drop the apple,asc-mailbox-v4 fallback and add the counted-FIFO hardware table and its compatible match to mailbox.c in this PR (the PR then carries a driver commit), or
  2. Keep the mailbox node and its binding commit out of this PR until that driver support exists.

Not checked

Compile receipts (the author's), hardware, and the counted-FIFO layout itself (I took the layout from the commit text; I only checked what the fallback compatible does in the driver).

@joshuaswarren

Copy link
Copy Markdown
Author

New head bdb5d361006c16979e0b866b59baaef446cfb977: rebased on the new #191 head 9fbb3568; commits unchanged. The mailbox finding of the review at 2f5704e2 is real and is being fixed by the author of the series (counted-FIFO driver support in the same series, or the node left out until it exists); no head is claimed GREEN until then.

On T8152 the macOS driver starts the ACIO CPU through the coprocessor
wrapper block (the "cpu" region, acio-cpu reg[1]): write 0x10 to
+0x28, idle state is +0x44 bit 1. That is the block t6030 already
uses, so add a T8152 entry to the per-SoC table with mxwrap set and
no rc M3_CTRL start (whether T8152 has that bit at all is not
decoded). The apple,t8152-usb4-acio compatible selects it.

T8152 never shows M3_STAT ready, so this entry does not wait for it (a
500 ms poll would time out on every start): the RTKit boot of the
co-processor is the readiness check instead.

Measured on an Apple M6 (T8152) Mac mini, rear USB-C port (ACIO3),
with this start sequence in an older tree: M3_STAT never becomes
ready, the NHI answers the first HOP_COUNT read (12 hops), and the
USB4 domain plus host router enumerate. Not measured: this patch on
this base (compiled only), the non-posted mapping of the "cpu" region
on T8152 (the driver maps it non-posted as for t6030), and any other
SoC; their table entries and code paths are unchanged.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
T8152 has no "pdf" range: the ACIO+0xdb0000 block that M1/M2 device
trees map there aborts on a read, and macOS never writes the RX ring
options+4 word either. Treat the range as optional: map it only when
the node describes it, and when it is absent program the ring options
without the RX options+4 and PDF writes.

Measured on an Apple M6 (T8152) Mac mini, rear USB-C port (ACIO3): a
read of the M1/M2 pdf offset takes a synchronous external abort; with
the ring options programmed and both the options+4 and PDF writes
skipped, all rings start, the first TX and RX ring interrupts fire and
the USB4 domain enumerates. The location of the RX sof/eof mask on
T8152 is unknown; receive frames arrive without it. M1/M2 keep the
existing behaviour whenever the node carries the range.
A M1/M2 device tree that loses its "pdf" range now probes without the
PDF writes and without an error or a message.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the apple,t8152-usb4-acio and apple,t8152-usb4-nhi compatibles,
describe the co-processor wrapper ("cpu") register range of the acio
node, and make the NHI "pdf"
range optional: T8152 has no PDF range at all. T8152 binds one DART
stream per ring like t6030/t6031/t8122, so it takes the 24-iommu
case.

The "cpu" range is required for apple,t6030-usb4-acio and
apple,t8152-usb4-acio, whose driver does not probe without it, and is
not allowed for the other compatibles. The t6030 device trees already
carry it as a fourth range after the PCIe adapter, which the binding
did not allow; T8152 has no PCIe adapter range and lists rc, sram and
cpu.

Existing boards are unaffected: their reg entries stay valid as they
are, and they still require the reset. apple,t8152-usb4-acio does not
require it: its reset driver is separate work and the board tree does
not describe the reset yet.

Measured: the device tree built from these bindings enumerates the
USB4 host router on the Mac mini (M6, T8152) on an older tree. Not
measured: dt-schema validation of this patch.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The ACIO (USB4/Thunderbolt) co-processor of the T8152 talks to the
application processor through a mailbox with its own register layout:
a 0x80-byte window with the receive FIFO at +0, the transmit FIFO at
+0x10 and a status word at +0x20 that counts the receive occupancy and
the free transmit slots. That is neither the classic ASC layout of
apple,asc-mailbox-v4 nor the older M3 layout, so the compatible has no
fallback. Only two of its interrupts are known, the receive-not-empty
and the send-empty line, as for the ANE mailboxes; the interrupt
constraints are the ones of the ANE mailboxes.

The layout was read from the macOS driver and ran on hardware in an
older tree: it carried the RTKit boot of the co-processor. Not measured:
this binding on this base. Measured: the device tree that uses it passes
the schema check.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
apple,t8152-acio-mailbox has a different register interface than the
ASC mailboxes: the status word at +0x20 holds the receive occupancy in
bits 3:0 and the number of free transmit slots in bits 11:8, the receive
FIFO is at +0, the transmit FIFO at +0x10, and each 128-bit message is
moved with one paired 64-bit access. Reading or writing the classic ASC
offsets (control at +0x110, send at +0x800, receive at +0x830) from this
window would touch unrelated registers of the wrapper block.

Add a counted_fifo flag to the hardware table, test "transmit full" and
"receive empty" through two helpers that honour it, and move the message
read and write into helpers that use one load or store pair for the
counted layout (arm64 only; the entry is refused elsewhere). Every
other hardware table keeps its flags unchanged and its two separate
64-bit accesses.

Measured here: arm64 compile. Run on hardware in an older tree: this
layout and the paired access carried the RTKit boot of the ACIO
co-processor. Not measured: this patch on this base, the send-empty
interrupt path of this mailbox.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the free rear USB-C port (ATC3, ACIO3) of the Mac mini (M6,
T8152): four ATC3 power-state-director slots, the ACIO coprocessor
mailbox, the acio node with its rc, sram and coprocessor-wrapper
("cpu") registers, and the NHI with its 24 ring interrupts and all 24
ring DART stream ids bound (tx ring N = SID N, rx ring N = SID 16+N).
Behind the acio node sits its own Gen3 DART with a static topology.

The acio node carries no "pdf" range, no reset and no Type-C graph:
the ATC3 PHY CIO-mode link and the hpm3 wiring are separate work. The
PCIe-C tunnel container is not part of this patch.

Addresses are physical: ADT bus address + 0x200000000 for every ADT
address below 0x400000000. The boot loader fills the apple,tunable-*
properties and apple,thunderbolt-drom through the usb4-3 aliases.

Measured on the Mac mini (M6, T8152) with these nodes on an older
tree, plus the power-domain, DART, reset and mailbox support they
need: the ACIO firmware boots, the NHI answers, rings start, and the
USB4 domain and host router enumerate. Not measured: this patch on
this base (device tree compile only); ACIO0 and ACIO1 (NCM tether,
Studio Display) are not described and there is no ACIO2; the
interrupt order of the ring interrupts was confirmed for rings 0 of
both directions only.

Depends on support outside this patch: apple,t8152-dart (in this
tree), the apple,t8152-psd domains with the ps_atc3_usb_aon parent for
the three CIO slots (the parent is a guess), and a reset driver for the
CIO reconfigure pair. The mailbox compatible is described by the
previous patch. Without that reset the ACIO cannot be powered, so this
node describes hardware and does not boot it by itself; the binding does
not require resets for apple,t8152-usb4-acio until that driver exists.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Author

Review at bdb5d36: I withdraw my GREEN at dfde2fd until the mailbox finding is fixed.

My review at dfde2fd said I could not establish that the T8152 ACIO mailbox node behaves the same under the generic apple,asc-mailbox-v4 fallback as under the compatible it replaced; the other reviewer's finding on exactly that point stands (as the author describes it, the mailbox driver needs counted-FIFO support for this node, which is not there yet), and w71 is fixing it in the series or taking the node out. I have not re-derived that finding myself. The base commits of this head are the #191 head 9fbb356 (my delta review is posted there: PSD power-on rollback includes the failed slot, PSD power-off restores every slot, Gen3 DART drain and unlock changes) and that part is fine. I will re-read the mailbox change by exact head when it lands.

@joshuaswarren

Copy link
Copy Markdown
Author

New head f40f1bb135828837d789875d8f930401e5c1eab5, six commits: fixes w7X's mailbox finding at 2f5704e2. The binding gives apple,t8152-acio-mailbox its own compatible with no apple,asc-mailbox-v4 fallback, and a new driver commit adds the counted FIFO (RX +0, TX +0x10, status +0x20, paired 64-bit access per 128-bit message, arm64 only) as its own hw table in drivers/soc/apple/mailbox.c; the other tables are unchanged. Receipts (CT-local arm64 clang W=1, 16K pages): the base objects, thunderbolt/apple.o, soc/apple/mailbox.o and t8152-j873g.dtb rc 0, 0 warnings; dtcheck board file 0 messages. NOT measured: this patch on this base, the send-empty interrupt path. The layout was used for the ACIO RTKit boot on an older tree.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at f40f1bb

Read: the sixteen commits against the ones I reviewed at bdb5d36, compared per commit as diffs with the hash lines removed; mailbox.c at this head around every use of the status bits. The ten base commits are the #191 head 9fbb356 (delta review posted there); the ACIO start, NHI pdf and ACIO binding commits are identical. Changed or new:

  • Mailbox binding: apple,t8152-acio-mailbox is a single compatible with no ASC fallback; the text says why (the status word counts RX occupancy and free TX slots instead of full/empty flags). The interrupt-name branch from before still covers it.
  • New driver commit (mailbox.c, counted_fifo hw table): tx_full is "no free TX slot bits" and rx_empty is "no RX occupancy bits" for counted FIFOs, with the old tests unchanged for every other hardware; send and receive use a paired stp/ldp access on arm64 (message words at 0x10/0x18 for TX and 0x00/0x08 for RX, with wmb before the store and rmb after the load), the old writeq/readq pair otherwise; the hw table is RX +0, TX +0x10, one status word at +0x20 with occupancy in bits 3:0 and free slots in bits 11:8, no per-mailbox irq control, which matches the low-nibble outbox count I saw in the ANE bring-up module. The probe refuses a counted-FIFO node on non-arm64. No raw use of control_full/control_empty is left outside the two helpers (the one write to i2a_control is behind ap_initializes_mailboxes, false for this table). The match table lists the new compatible; the generic v4 fallback is gone from the dts, which now uses only the new compatible.
    Not checked: the register layout against the hardware (w71's board evidence), that the mailbox node's MMIO mapping is non-posted. Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN.

@joshuaswarren

Copy link
Copy Markdown
Author

GREEN at f40f1bb

The blocking finding on 2f5704e2 is fixed. Read the two mailbox commits, the changed device tree commit and drivers/soc/apple/mailbox.c at this head; the other three commits are identical to the ones I reviewed at 2f5704e2.

Checked

  • Compatible. apple,t8152-acio-mailbox has no fallback now (the dtsi node and the binding agree), so it no longer binds through apple,asc-mailbox-v4 to the classic layout. The binding description gives the reason (the status word counts occupancy and free slots, unlike the full/empty flags of the ASC mailboxes) and the interrupt constraints are the ANE group's.
  • apple_mbox_t8152_acio_hw. counted_fifo, status word at +0x20 for both directions, transmit at +0x10 and +0x18, receive at +0x00 and +0x08; control_full is GENMASK(11, 8) (free transmit slots) and control_empty GENMASK(3, 0) (receive occupancy). Every register the driver touches for this entry lies inside the 0x80-byte window of the node (largest offset 0x28).
  • Every use of the flags goes through the helpers. control_full and control_empty occur only in apple_mbox_tx_full() and apple_mbox_rx_empty() and in the hardware tables; the send loop, the timed poll inside it, the re-check after the send-empty wait and the receive loop all call the helpers. For the counted layout "full" means no free slot and "empty" means zero occupancy; for every other table the helpers return the old test unchanged.
  • Message access. apple_mbox_write_msg() and apple_mbox_read_msg() use one stp or ldp for the counted layout, with wmb() before the store and rmb() after the load; all other tables still use the two writeq_relaxed and readq_relaxed accesses, and the msg1 field is packed and unpacked as before. The pair instructions are compiled only for CONFIG_ARM64, and probe returns -EOPNOTSUPP for a counted FIFO elsewhere. ap_initializes_mailboxes and has_irq_controls are false for the entry, so the probe and start code does not touch other offsets.
  • dtcheck.sh (dtschema 2026.9) on the tree of Apple M6 (T8152) PCIe-C tunnel on the rear port (on top of #191 and the USB4 PR) #198 at e21d7e6f, which contains this PR: dtc -@ 0 warning lines, dt-validate of the board file 0 lines, 72 binding examples with only the baseline message. The device tree check with the cpu region removed from the T8152 ACIO node still fails as required.
  • Checkpatch on the three new commits: only UNDOCUMENTED_DT_STRING warnings, which come from the stub tree I run it in (the binding is in the same PR).

Not checked

Compile receipts (the author's), hardware, the send-empty interrupt path (the commit says it is not measured), and the register layout itself (I checked what the driver does with it). Merge still needs CI and the owner's word.

@joshuaswarren

Copy link
Copy Markdown
Author

Status at head f40f1bb135828837d789875d8f930401e5c1eab5: two independent reviews GREEN at this exact head, all Greptile threads replied and resolved, arm64 clang W=1 compile of the touched objects rc 0 with 0 warnings, device-tree schema check 0 messages. Not done: a boot on hardware, CI. Needs a maintainer's CI approval and merge. Not needed for the release candidate.

@joshuaswarren

Copy link
Copy Markdown
Author

[Joshua's agent] This PR is awaiting maintainer review. Is anything else needed from us?

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