Repository navigation
Apple M6 (T8152) USB4/Thunderbolt host router, rear port ACIO3 (on top of #191) - #197
joshuaswarren wants to merge 16 commits into
Conversation
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>
|
Receipts at head
|
[Medium impact] The latest changes appear safe to merge within the PR’s stated bring-up scope. SummaryAdds 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.
Reviews (7) · Last reviewed commit: "arm64: dts: apple: t8152-j873g: add the ..." · Reviewed by Greptile |
|
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:
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. |
|
New head
Receipts at this head: arm64 clang |
a70664c to
df61647
Compare
|
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.
|
|
GREEN at df61647 Read: the four commits above the #191 head (76e5e12, 6b47316, 666bf60, df61647); Checked
Findings
The four PSD parents set to Not checkedCompile and checkpatch receipts (checkpatch warnings reproduced: |
df61647 to
5f2d8b5
Compare
5f2d8b5 to
034b64c
Compare
|
New head Receipts at this head (CT-local, arm64 clang |
|
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. |
034b64c to
dfde2fd
Compare
|
New head
Receipts at this head (CT-local, arm64 clang |
|
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:
|
dfde2fd to
2f5704e
Compare
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>
|
NOT GREEN at 2f5704e One finding blocks; the other three items I raised on Fixed, checked
BlockingThe ACIO mailbox compatible binds the in-tree mailbox driver to the wrong register layout. Either of these fixes it:
Not checkedCompile 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). |
2f5704e to
bdb5d36
Compare
|
New head |
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>
|
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. |
bdb5d36 to
f40f1bb
Compare
|
New head |
|
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:
|
|
GREEN at f40f1bb The blocking finding on Checked
Not checkedCompile 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. |
|
Status at head |
|
[Joshua's agent] This PR is awaiting maintainer review. Is anything else needed from us? |
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
pdfregister 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
apple_cio_hwtable, plus the missingapple,t8152-usb4-aciomatch entrypdfoffset aborts on T8152; the rings start without itresetsis not required forapple,t8152-usb4-acio(the reset layer comes later)apple,t8152-acio-mailboxwith theapple,asc-mailbox-v4fallback, so the in-tree mailbox driver binds without a changet8152-j873g-usb4.dtsi, one include line int8152-j873g.dts; no reset nodeMeasured, on an M6 Mac mini (an older tree, the same logic)
Not measured
cpuregion mapped non-posted (the base does this for the other SoCs) on T8152.make dtbs_check/dt_binding_check. A hand-rundt-validate(dtschema 2026.9) of the board file is below.Blocked / not in this branch
apple,t8152-ascwrap-v8-mailboxmailbox compatible, the CIO reset driver and theresetsproperty are separate changes. The ACIO node therefore cannot work on a board built from this branch alone.Receipts
arm64 clang,
W=1,integration/auroraat 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.oandapple/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).