Skip to content

arm64: dts: apple: t8132-j773g: USB4/Thunderbolt on the Mac mini's rear ports - #2641

Open
DjDeveloperr wants to merge 4 commits into
integration/aurorafrom
djdev/j773g-usb4
Open

DjDeveloperr wants to merge 4 commits into
integration/aurorafrom
djdev/j773g-usb4

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the Mac mini M4 (J773g), a USB4 or Thunderbolt partner on any of the three rear ports gets no data at all. The SN201202x port controllers enter USB4 by themselves, for example with a USB4 NVMe enclosure or another Mac. The ATC PHY has no CIO calibration, so it refuses the mux state, and the device tree has no host router to tunnel through. On the mini (macOS 27.2 firmware, 7.3.0-m4drv8), every boot logs this for Back Middle (USB4 NVMe enclosure: USB4_STATUS mode 0x07, EUDO 0x2667e000) and for Back Left (another Mac):

sn201202x 1-0c: failed to configure Type-C connection: -19
sn201202x 1-0c: cable revalidation failed after 3 attempts

macOS runs all three rear ports as USB4/Thunderbolt.

Change

  1. t8132-j773g: ATC PHY CIO calibration for atc-phy0, atc-phy1 and atc-phy3. The values are converted from the J773g's own ADT in the layout of the J713 and J604 files (arm64: dts: apple: t8132-j604: add the ATC PHY CIO calibration #1932). The 27.2 and 26.6.2 ADTs give identical values.
  2. t8132: ACIO3, the USB4 host router behind ATC3. It covers the router, mailbox, DART, NHI, LSTX, its PCIe tunnel (apciec3) and the tunnel's calibration, at the ADT's addresses. It sits in t8132-atc23.dtsi, disabled. A checker compared ACIO0/1/3 against the J773g ADT: every address, interrupt, LSTX pin, MSI slice, range and PMGR domain matches.
  3. t8132-j773g: wire up the routers. Back Middle (hpm0) is ACIO0, Back Left (hpm1) ACIO1 and Back Right (hpm3) ACIO3, linked to each connector's port@2 as on the J713. The PMGR domains and the router calibration and DROMs are converted from the ADT.
  4. PCI: apple: take each PCIe-C bridge's MSI slice from the DT (apple,msi-vector-base), not from a per-SoC table of ECAM apertures. The table had no entry for ACIO3's tunnel (0x1c80000000, slice 0xc0), so it would fail with "invalid or missing MSI slice". Every DT that passed the table passes this check with the same slice. The fix-up for old T6030 boot DTs keeps its table.

No other T8132 board changes: J713 and J623 DTBs are byte-identical, and J604/J624 gain only the disabled ACIO3 nodes. The W=1 warnings are unchanged; on J604 one existing warning moves by three lines.

Testing

  • DTBs build with the kernel's cpp and dtc on all T8132 boards. dtschema 2026.9 reports no new messages and 0 undocumented compatibles. pcie-apple.c builds with W=1 with no new warnings; host tests pass.
  • Mac mini M4 (J773g), macOS 27.2 firmware, 2026-11-20. This PR's DT commits on its bring-up kernel, with aura soc: apple: sep: retry a failed sensor bring-up before a verify (Touch ID after resume) #339 for the USB3 calibration.
    • Back Middle (ACIO0): the USB4 NVMe enclosure links as USB4 Gen 4, 2 × 20 Gb/s. Its NVMe enumerates through the PCIe tunnel at 8 GT/s ×4 and reads at 502 MB/s (read-only O_DIRECT). The -19 / cable revalidation failed errors on this port are gone.
    • Back Right (ACIO3): the router probes; no USB4 partner was attached. Its link and its PCIe tunnel (which needs the pcie-apple.c commit) are untested.
    • Back Left (ACIO1): untested on hardware. Its nodes follow the ADT the same way as ACIO0's.
    • The router firmware reports per-lane link errors while the link trains, then brings the link up at Gen 4. The vendor OS shows the same with this enclosure, so this is normal training.
    • pcieport 0001:02:00.0: of_irq_parse_pci: failed with rc=-22 (the enclosure's downstream bridge) is generic PCI core behaviour, not something this PR adds. With CONFIG_PCI_DYNAMIC_OF_NODES a bridge's dynamic interrupt-map is built before its children are scanned, so INTx behind the tunnel can't be resolved. Every device there uses MSI/MSI-X, as on macOS.
  • The pcie-apple.c commit doesn't change the MSI slice for any DT that passed the old table. T6040 and T8122 PCIe-C rows would still be welcome.

Related: #1702 and #1703 (USB2 fallback for USB4/TBT partners on T8132 ports without CIO calibration) remain the path for boards with no router or calibration.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

An early read before the J773g rows:

  • t8132-atc23.dtsi (980ba9d): neither new DART has power-domains. usb4_3_dart (iommu@a80000) and usb4_3_pcie_dart (iommu@41c000000) are separate devices, so the router node's power-domains don't cover them. Their ACIO0 counterparts in t8132-usb4.dtsi each carry their engine's domain (usb4_0_dart: <&ps_atc0_cio>, usb4_0_pcie_dart: <&ps_atc0_cio_pcie>). Without that, the DART's first register read at probe can fault whenever the boot loader left ATC3's CIO block off. That is how a DART probe has taken a T8132 down before. Please add <&ps_atc3_cio> and <&ps_atc3_cio_pcie> to match ACIO0/1. These nodes are disabled on the J604/J624, but the J773g enables them.
  • pcie-apple.c (6a67ca8): replacing the ECAM table with apple,msi-vector-base is the right direction. The T6040 (0x20/0x40/0x60) and T8132 (0x60/0x80) values in the DTs match the removed table. The old check also tied the slice to the interrupt specifier (aic_irq == aic_base + base), and the new one accepts any base with count == 32. A DT whose apple,msi-vector-base disagrees with its msi-parent/interrupt range would then program the wrong slice, with no error. Keeping a consistency check between the two, per SoC from the AIC node rather than from ECAM addresses, would keep that safety net.
  • This change to pcie-apple.c reaches every PCIe-C bridge on T6030/T6040/T6050/T8132, so a boot row on one of those Macs with a USB4 partner (probe lines and an enumerated tunnel device) would be worth having besides the mini.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Hardware row, Mac mini M4 (J773g), macOS 27.2 firmware, 2026-11-20: Back Middle USB4 PASS

This PR's DT commits on the board's bring-up kernel, with aura #339 for the USB3 calibration. Back Left's router stayed disabled in this run. The pcie-apple.c commit was not in this kernel; ACIO0's tunnel doesn't need it.

  • Back Middle (ACIO0), USB4 NVMe enclosure: thunderbolt-apple-acio 401ac0000.cio probes, its firmware comes up, and the PCIe-C cold init completes. The thunderbolt domain lists the enclosure's router, generation 4, at 20 Gb/s × 2 lanes in each direction.
  • The enclosure's NVMe enumerates through the PCIe tunnel at 8 GT/s ×4. It was kept read-only and unmounted; a 1 GiB O_DIRECT read ran at 502 MB/s.
  • Before this DT, the same port logged failed to configure Type-C connection: -19 ×3 and cable revalidation failed every boot. Both are gone.
  • Back Right (ACIO3, cio@419ac0000): the router probes; no USB4 partner was attached, so its link and PCIe tunnel are untested.
  • dtschema 2026.9: no new messages; -m: 0 undocumented compatibles.
  • The router firmware reports per-lane link errors while the link trains, then the link comes up at Gen 4 (normal training). pcieport 0001:02:00.0: of_irq_parse_pci: failed with rc=-22 comes from the PCI core's dynamic DT nodes; the devices use MSI/MSI-X. See the PR description.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Force-pushed (5cf253b): rebased on current integration/aurora. ACIO3's router DART and tunnel DART now carry their engines' power domains (ps_atc3_cio, ps_atc3_cio_pcie), as ACIO0/1's do on integration. The dt-checks DART power-domain lint passes locally (0 new findings). No other change.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of fa6585a: Blockers: 1.

From our last comment:

  1. Resolved: the ACIO3 DARTs now carry their engines' domains, usb4_3_dart <&ps_atc3_cio> (arch/arm64/boot/dts/apple/t8132-atc23.dtsi:237) and usb4_3_pcie_dart <&ps_atc3_cio_pcie> (:329), matching ACIO0/1.
  2. Not resolved: drivers/pci/controller/pcie-apple.c:3325 still checks only the slice's shape, and the extra check at :3435 (args.args[1] < pcie->msi_vector_base) does nothing. AIC MSI interrupts are in the thousands and slice bases are at most 0xe0, so it always passes. If a DT's apple,msi-vector-base and its msi-ranges start disagree, the wrong slice gets programmed with no error, and MSIs land in another bridge's vectors. The window base can be checked without going back to a per-SoC table: args.args[1] - msi_vector_base is the window's first AIC interrupt (1698 - 0xc0 = 1506 for ACIO3, t8132-atc23.dtsi:373-374). Require it to equal the internal host's msi-ranges start, or a window-base property on the shared MSI node, and refuse the slice otherwise.
  3. Still open: the pcie-apple.c change has no hardware row. The J773g row ran without that commit, so ACIO3's tunnel, the only path that needs it, is untested. No T6040/T6030/T8122 PCIe-C row has been posted either.

Since then: 5cf253b added the power domains, and fa6585a is a rebase with identical PR file contents. Nothing else changed.

HW row: J773g on this head (with the pcie-apple.c commit) with a USB4 partner on Back Right: invalid or missing MSI slice absent, tunnel device enumerated with MSI-X working. Plus one T6040 (J616s) boot with a USB4 partner showing the PCIe-C bridges probe with unchanged slices. Both with 0 AVC, 0 failed units and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

Without the CIO calibration the ATC PHY driver serves a USB4 or
Thunderbolt partner on the Mac mini's rear ports as USB2 only. The boot
chain passes the SuperSpeed calibration on, but not the CIO one, so
describe it here as the J713 and J604 do.

The values are the J773g's own, converted from its ADT (macOS 27.2; the
26.6.2 ADT has the same tables) for atc-phy0, atc-phy1 and atc-phy3, the
PHYs of the three rear ports. ATC2 drives the front ports' on-board hub
and has no host router. Each property lists these ADT tunables in this
order, each entry at its ADT offset plus the block's offset in the bank:

  cio-axi2af    tunable_ATCAXI2AF, _WR_DIS, _LOCK_LOCK (axi2af bank)
  cio-lioa      tunable_ATCAXI2AF_LIOA_IOA (lioa bank)
  cio-fabric    tunable_ATC_FABRIC (fabric bank)
  cio-config    tunable_ATC_COMMON_CFG (common-config bank)
  cio-common    tunable_AUSCMN_DIG +0x800, AUSPLL_CORE +0x2200,
                CIO3PLL_CORE +0x2a00, CIO3PLL_TOP +0x2800,
                ACIOPHY_PLL_TOP +0x1000, CIO_SHIM +0x4000,
                ACIOPHY_TOP +0x0 (core bank)
  cio-laneN     tunable_LNn_RX_TOP_CIO_DFLT, RX_SHM_CIO_DFLT,
                TX_TOP_CIO_DFLT, TX_SHM_CIO_DFLT at +0x9000, +0xb000,
                +0xc000, +0xd000 (lane 1: +0x7000 more)
  cio-laneN-eq  tunable_LNn_RX_EQ_CIO_EQA at +0xa000 (lane 1: +0x11000)
  cio-post      tunable_AUSCMN_SHM +0xa00, CLKMON_CFG +0x2600

This is the J713 file's layout: from the J773g ADT it gives the J713
file's register offsets entry for entry, and the J713's own values but
for the per-PHY PLL and common-block words (AUSPLL_CORE +0x40,
CIO3PLL_CORE +0x4c, AUSCMN_SHM +0x4). The J773g lists carry three more
entries per lane, kept in ADT order: RX_TOP_CIO_DFLT has a fifth one
(+0x280) and RX_EQ_CIO_EQA a 22nd one, a second write of +0xc0.

Every offset fits the bank the driver applies it to. Nothing on the boot
path changes: the CIO calibration is applied only when the port
controller reports a USB4 or Thunderbolt partner.

Signed-off-by: Diljit Singh <hey@djdev.me>
The T8132's ATC3 has a USB4/Thunderbolt host router of its own (ADT
acio3), which the J773g's Back Right port uses. Describe it, disabled,
next to the SoC's other ATC2/ATC3 nodes in t8132-atc23.dtsi, in the form
of ACIO0 and ACIO1 in t8132-usb4.dtsi: the router with its mailbox,
DART, NHI and LSTX pin, and its PCIe tunnel (ADT apciec3) with the
tunnel's DART and calibration. ATC2 has no host router.

From the J773g ADT (macOS 26.6.2 and 27.2 agree):
- acio3, acio-cpu3, dart-acio3, apciec3, dart-apciec3 and
  apciec3-piodma: the same block offsets as ACIO0's, 0x18000000 above
  them, and interrupts 186 above, three times ACIO1's step. The NHI
  rings are listed as for ACIO0/ACIO1, the lower block (1473..1484)
  first.
- The router's SRAM is the DATA segment of iop-acio3-nub.
- LSTX is AOP GPIO 23 (acio3 gpio-lstx, as 17 and 19 for ACIO0/1).
- The CIO reconfiguration is CIO3_RECONFIG (acio3 rid 3): reset 3.
- PMGR: ATC3_CIO, ATC3_CIO_PCIE, ATC3_CIO_USB and ATC3_PCIE, the
  domains at 0x4a0, 0x4b0, 0x4b8 and 0x498.
- MSI: the pcic3-bridge slice, vectors 0xc0..0xdf of the window at
  AIC 1506 (apciec3 msi-vector-offset).
- PCIe-C, tunnel DART and OE fabric calibration: apciec3's
  atc-apcie-*-tunables and apcie-config-tunables, dart-apciec3's
  dart-tunables-instance-0 and apciec3-piodma's oe-fabric tunables.
  They match apciec0/1's (t8132-pciec-tunables.dtsi).

The same check against the J773g ADT finds ACIO0 and ACIO1 in
t8132-usb4.dtsi as the ADT has them. Boards that include this file get
the new nodes disabled (the tunnel container is populated only by its
router), so no DTB changes behaviour.

Signed-off-by: Diljit Singh <hey@djdev.me>
The Mac mini's three rear USB-C ports have a USB4/Thunderbolt host router
each, as its ADT's nub-spmi-a0 port controllers name them (acio-parent):
Back Middle (hpm0, ATC0) is ACIO0, Back Left (hpm1, ATC1) ACIO1 and Back
Right (hpm3, ATC3) ACIO3. Enable the three routers with their mailboxes,
link each to its port controller's connector (port@2) as the J713 does,
and give the routers' PMGR domains to Linux: without a board status the
T8132 PMGR policy keeps them disabled. The front ports have no router.

The routers' calibration and DROMs are the J773g's own, converted from
its ADT (acio0, acio1, acio3; the 26.6.2 and 27.2 ADTs agree) the way
the boot loader converts them:
- apple,tunable-rc: top_tunables, hbw_fabric_tunables at +0x4000 and
  lbw_fabric_tunables at +0x8000;
- apple,tunable-pcie-adapter: pcie_adapter_regs_tunables;
- apple,tunable-nhi: hi_up_tx_desc (+0xf0000), hi_up_tx_data (+0xec000),
  hi_up_rx_desc (+0xe8000), hi_up_wr (+0xf4000), hi_up_merge (+0xf8000),
  hi_dn_merge (+0xfc000) and fw_int_ctl_management (+0x4000) fabric
  tunables;
- apple,thunderbolt-drom: thunderbolt-drom as the ADT has it.

They are the J713's values but for one top_tunables word (0xac:
0x80008000 here, 0x5ce75ce7 on the J713), and ACIO3's equal ACIO0's but
for its DROM. The DROMs keep the ADT's router UUID field, which holds
the router index; a boot loader that fills these through the usb4-N-*
aliases replaces it with a per-machine UUID.

Signed-off-by: Diljit Singh <hey@djdev.me>
The T8122, T8132 and T6040 PCIe-C hosts share one AIC MSI window, and
each bridge owns a 32-vector slice of it: the ADT bridge's
msi-vector-offset, which the device tree gives as apple,msi-vector-base,
with the slice's first AIC interrupt in msi-ranges. apple_msi_init()
refused any slice it could not find in a per-SoC table of ECAM
apertures and AIC window bases, so a bridge the table left out never
got MSIs. The T8132's third USB4 router (ACIO3, the Mac mini's Back
Right port, ECAM 0x1c80000000, slice 0xc0) is one: its PCIe tunnel
failed with "invalid or missing MSI slice", and so would any new bridge.

Take the slice from the device tree, and check both its shape (32
vectors, 32-aligned, above the internal host's first slice, inside the
8-bit map target) and its alignment with the shared window: derive the
window's first AIC interrupt from the internal PCIe host's msi-ranges
on the same interrupt controller, and require
msi-ranges_irq - apple,msi-vector-base to equal that window base. Every
device tree that passed the table check passes this one with the same
slice, while any DT whose apple,msi-vector-base and msi-ranges disagree
is refused. The fix-up for the old experimental T6030 boot DTs, which
gave every host the whole window and no apple,msi-vector-base, keeps
its ECAM table: those DTs name the bridge only by its aperture.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora (a84637dca209) at 07685b5a2114 and addressed the MSI slice validation blocker:

  • Added apple_pciec_msi_window_base() in drivers/pci/controller/pcie-apple.c to derive the shared AIC MSI window base from the internal PCIe host's msi-ranges on the same interrupt controller (requiring consistency across internal hosts) and checked aic_irq >= aic_base && aic_irq - aic_base == base in apple_pciec_msi_slice_valid().
  • Verified locally: pciec-policy-tests.py and cio-native-tests.py pass, checkpatch.pl is clean (0 errors, 0 warnings on 07685b5a2114), and asahi profile compile-check of drivers/pci/controller/pcie-apple.o and arch/arm64/boot/dts/apple/t8132-j773g.dtb passed (rc=0, 0 warnings).

The J773g ACIO3 and T6040 hardware rows remain pending.

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 07685b5: No blockers.

From our last comment:

  1. Resolved earlier: the ACIO3 DARTs carry their engines' domains (unchanged since 5cf253b).
  2. Resolved: drivers/pci/controller/pcie-apple.c:3339 apple_pciec_msi_window_base() takes the shared window's first AIC interrupt from the internal host's msi-ranges on the same AIC (and refuses disagreeing internal hosts), and :3326 now requires msi-ranges start - apple,msi-vector-base to equal it. Checked against the trees at this head: T8132 1602/1634/1698 minus 0x60/0x80/0xc0 = 1506 (t8132.dtsi:1402), T6040 2103/2135/2167 minus 0x20/0x40/0x60 = 2071 (t604x-j614-j616.dtsi:2709, t6040-j773s.dts:300), and the T6030 legacy fix-up (t6030-usb4.dtsi:99) ends at 1342 + slice against t6030.dtsi:1482. A DT whose two values disagree is now refused instead of programming another bridge's vectors, and the per-SoC ECAM table is gone except for the legacy T6030 fix-up.
  3. Still open: no hardware row for the pcie-apple.c commit. ACIO3's tunnel, the only path that needs it, and the T6040 PCIe-C bridges whose check changed have not run on this head. Approve once those rows are in.

Since our comment only pcie-apple.c changed (the three DT commits have the same patches as the previous head). The window lookup drops its node references on every path, including the early return, and it skips tunneled and apple,msi-vector-base hosts, so only internal hosts set the base.

HW row: J773g on 07685b5 with a USB4 partner on Back Right: no invalid or missing MSI slice, tunnel device enumerated with MSI-X interrupts counting in /proc/interrupts. Plus one J616s (T6040) boot with a USB4 partner: all three PCIe-C bridges probe with slices 0x20/0x40/0x60. Both with 0 AVC, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

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.

2 participants