Skip to content

arm64: dts: apple: t6040: PCIe-C tunnels on every M4 Pro (on #2069) - #3512

Merged
RyanTheTide merged 7 commits into
mainfrom
feat/t6040-pciec-every-board
Nov 28, 2026
Merged

RyanTheTide merged 7 commits into
mainfrom
feat/t6040-pciec-every-board

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: Turns the PCIe-C tunnels (apciec0-2 and their DARTs) on for every M4 Pro (T6040) board. Until now the J616s deleted its routers' apple,pcie-tunnel link ("No PCIe tunnels yet"), so a Thunderbolt enclosure on any of its ports never enumerated. The tunnels are SoC blocks with no board wiring: the J614s, J616s and J773s ADTs list the same three controllers and DARTs with the same tunables. So t6040-pciec.dtsi now enables them and boards no longer have to. Stacked on #2069: review only the top commit d20d264f.
Tested: DTB comparison: the J614s and T6041 DTBs are identical to #2069's, and the J616s and J616s tether DTBs are identical to the J616s one-shot (main + #2069 + J616s enable) that our lab boots for the RX 7900 XTX TB5 enclosure row. dtbs_check: 0 warnings at main and at this head (J614s, J616s, J616s tether, J773s).
Risk: two-way door · T6040 only. Nothing comes up on its own: the USB4 router driver populates a tunnel only when a PCIe tunnel is requested, and only where the board enables that router (the J773s routers are still off, so its nodes stay idle). Revert = revert the one commit.
Not yet: J616s enumeration row with the TB5 enclosure at this head. It will be posted here.

Details
  • t6040-pciec.dtsi: the T6040_PCIEC(n) macro also sets status = "okay" on usb4_N_pcie_tunnel, apciecN_dart and usb4_N_pcie.
  • t6040-j614s.dts: drops its nine now-redundant enables. Its DTB is unchanged.
  • t6040-j616s.dts: drops the three /delete-property/ apple,pcie-tunnel and the "No PCIe tunnels yet" comment. The ATC PCIe power domains were already enabled there.
  • ADT evidence: arch/arm64/boot/dts/apple/adt-coverage/t6040-j616s.txt lines 96-166 map /arm-io/apciec0-2 and dart-apciec0-2. The J616s-vs-J614s tunable comparison is in J614s: PCIe-C on the Thunderbolt ports (Studio Display USB, audio, camera) #2069 (comment) thread.

petrskuta and others added 6 commits November 25, 2026 07:01
t6040_pciec_hw was modelled on T8132: the kernel_init (oe-fabric) cold
init, the T8132 port reset values and SID-indexed RID2SID slots. The
ADT's apciec,t6040 has no oe-fabric region (config, rc, port0, fabric,
debug, ioa, ltssm, intr2axi), so cold init failed mapping it (-ENODATA).
Its fabric, rc, debug, config and DART tunables are T6050's with small
value differences.

Make it an Intr2AXI controller with T6050's no_port_reset, and allocate
RID2SID slots as T6050 does: with iommu-map-mask 0xff the Studio
Display's xHCI (RID 0x300) and its Thunderbolt bridge (RID 0x100) share
SID 0, and an SID-indexed slot failed the xHCI's enable with a silent
-EBUSY ("Can't enable PCI device, BIOS handoff failed").

Tested on the J614s with a Studio Display (2022) on the left port: cold
init completes (link up), the display's Titan Ridge bridges and xHCI
enumerate and xhci_hcd binds, #1589.

Signed-off-by: Petr Škuta <[email protected]>
Enable the left port's tunneled PCIe (usb4_0_pcie_tunnel, apciec0_dart,
usb4_0_pcie) and keep the ACIO's apple,pcie-tunnel, so a Thunderbolt
device's PCIe functions reach a root port. No boot loader hands the port
over, so the kernel cold-initializes it (apple,pciec-kernel-init).

From the j614s ADT (macOS 26 IODeviceTree) apciec0 and dart-apciec0:
- the controller's fabric, rc and debug tunables and the port's config
  tunables;
- the DART's tunables and its DMA window: vm-base 1 TiB + 2 GiB, vm-size
  0x7ff00000, the first 16 KiB a dead mapping;
- bypass streams 253 and 255 (bypass-253, bypass-255): the port's own
  writes, its MSIs turned into AIC writes, use them. Without the bypass
  no MSI arrived (xHCI "Command Aborted") and the DART fault IRQ stormed.
As on T6050's PCIe-C DART: full error reporting, CTC flush and the ATC0
PCIe power domain.

Tested on the J614s with a Studio Display (2022): its USB2 and USB3 Gen2
hubs, speakers and microphones (snd-usb-audio), camera (uvcvideo), HID
and a USB-C port (a USB 3.1 drive at 5 Gb/s) work,
#1589.

Signed-off-by: Petr Škuta <[email protected]>
The ADT's apciec0-2 and dart-apciec0-2 carry identical tunables, DMA
windows and bypass streams, so describe the PCIe-C of the left port once
in t6040-j614s-pciec.dtsi and use it for all three ports. Port 0 is
unchanged; ports 1 and 2 keep their ACIO's apple,pcie-tunnel now.

Signed-off-by: Petr Škuta <[email protected]>
The PCIe-C DART window, bypass streams and the DART, controller and
port tunables are T6040 SoC data: the J616s ADT carries the same values
as the J614s for apciec0-2 and dart-apciec0-2. Move them from
t6040-j614s-pciec.dtsi to t6040-pciec.dtsi, included by t6040.dtsi, so
a T6040 board only enables the tunnel, DART and controller of each port.

The J614s DTB is unchanged. Other T6040 boards gain the properties on
nodes that stay disabled.

Signed-off-by: Petr Škuta <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>

# Conflicts:
#	arch/arm64/boot/dts/apple/t6040.dtsi
The PCIe-C tunnels (apciec0-2 with dart-apciec0-2) are part of the T6040
and have no board wiring: the J614s, J616s and J773s ADTs all list the
same three controllers and DARTs with identical tunables. Enable the
tunnel, its DART and its controller in t6040-pciec.dtsi instead of in
each board, and stop deleting the routers' apple,pcie-tunnel link on the
J616s, which left an enclosure on any of its Thunderbolt ports without
PCIe.

Nothing comes up on its own: a controller is only populated when its
USB4 router, which the board enables, asks for a PCIe tunnel. On boards
whose routers are still off (J773s) the nodes stay idle.

The J614s and T6041 DTBs are unchanged; the J616s and J616s tether DTBs
gain the three tunnels.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 28, 2026 10:34

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at d20d264f

Blockers:

  1. Stacked on open #2069: land after #2069 merges (and wait for the 22 queued CI checks to finish green).
  2. Missing live J616s Thunderbolt/PCIe-C enumeration row at d20d264f (noted under Not yet:).

Checked:

  • Top commit d20d264f: cleanly eliminates per-board gating by placing status = "okay" inside shared arch/arm64/boot/dts/apple/t6040-pciec.dtsi, dropping the redundant board-level enables from t6040-j614s.dts (J614s and T6041 DTBs remain byte-identical to #2069), and removing /delete-property/ apple,pcie-tunnel; from t6040-j616s.dts; dtbs_check 0 warnings.
  • Checked for Apple material, tool attribution, private serials, and board gating: clean; MERGEABLE on main; human Signed-off-by present.
Evidence
  • Head: d20d264f (base: main, mergeable: MERGEABLE, +112/-10 across 5 files; top commit only on top of #2069).

Each PCIe-C DART sits in its port's ATC PCIe power domain. Now that the
tunnels are enabled on every T6040 board, enable that domain with them,
so a board that does not enable it itself (J773s) does not carry an
enabled DART on a disabled domain. The J614s and J616s already enable
these domains; their DTBs are unchanged.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

dt-checks failed on the DART power-domain step: the three J773s tunnel DARTs were enabled on disabled ps_atcN_pcie domains. Fixed in 638bd1cb: the shared macro now enables each port's ATC PCIe domain along with its tunnel. A local apple-dart-pd-check.py run (base main vs this head, T6040 DTBs) reports new: 0. J614s, J616s, J616s tether and T6041 DTBs are unchanged, and still identical to the J616s one-shot that TB-PCIE booted. Only J773s gains the three domain enables.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared T6040 macro now enables the supplying ATC PCIe domain alongside each tunnel and DART. This addresses the J773s disabled-domain finding without a board gate. The owner reports no changes to the previously exercised J614s and J616s DTBs across this revision. Keep hosted DT checks and verification of J773s tunnel operation as landing gates.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s (M4 Pro) hardware row: pass. A Thunderbolt 5 PCIe enclosure enumerates and binds through this PR's PCIe-C description.

Kernel: a one-shot built from main 844781f plus exactly this PR's changed-file blobs (byte-identical to #2069 at cbf6a5af). The J616s DTB is byte-identical (sorted decompile) to #3512. It also carries #2301 (the Gen4 cable word for T6040 routers, a separate draft). Without #2301 the router trains at Gen3 and the enclosure never gets a USB4 link, so there's no PCIe tunnel to test; that's a router-side issue, not this PR's.

  • Enclosure: an RX 7900 XTX (Navi 31) in a TB5 dock on the left-front port.
  • Gen4 training completed, TBT5 2x40 Gb/s. The PCIe-C tunnel on that port cold-initialized, linked up and enumerated the card at 0001:05:00.0, and the main-branch amdgpu bound (PSP/SMU OK, DCN 3.2, 24 GB VRAM, MSIs working).
  • Tunnel DMA (amdgpu SDMA benchmark): host→VRAM 48.2 Gb/s, VRAM→host 49.6 Gb/s, about 76% of PCIe 4.0 x4.
  • vkmark on the 7900 XTX: 20954.
  • With no device plugged, the other two tunnels stay idle, and all three routers bind with their apple,pcie-tunnel links.

Not covered here: a display picture on the eGPU (an amdgpu DMUB issue when GDM releases its outputs, followed up separately). Lab evidence: traces/gpu/20261128-j616s-egpu/.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s row: an RX 7900 XTX in a Thunderbolt 5 eGPU enclosure works over PCIe-C on the M4 Pro (left front port)

Kernel: main 844781f + #2069 (the T6040 PCIe-C driver and shared DT) + #3512's J616s DT change (byte-identical J616s DTB) + #2301 (USB4 Gen4 cable word), on the J616s fleet configuration and the default command line. The DTB was loaded as a one-shot Stage 2 trial. MacBook Pro 14" M4 Pro (J616s), AOOSTAR EG02 (Intel JHL9480, TB5) with a Sapphire RX 7900 XTX, 2026-11-28/29.

  • Without thunderbolt: apple: request USB4 Gen4 wherever the host router has it (T6040/T6041 TB5) #2301 the link never forms. The router gets the 20 Gb/s cable word (0x13), sends no Gen4 broadcast and logs SBX disconnected!, then goes Dead End and restarts. That happened 3 of 3 times, and the enclosure only showed up as USB2. The host router's lane adapters do advertise Gen4 (LANE_ADP_CS_0 supported speeds 0xe).
  • With thunderbolt: apple: request USB4 Gen4 wherever the host router has it (T6040/T6041 TB5) #2301: the cable word is 0x803, Gen4 trains, and the enclosure comes up as TBT5 at 2 x 40 Gb/s. PCIe-C tunnel 1 cold-initializes and links up. The JHL9480, the Navi switch and the 7900 XTX enumerate at 0001:05:00.0. BAR0 is 256 MB: there is no room for the 32 GB resizable BAR, so it falls back to 256 MB. MSI works.
  • amdgpu from main binds: PSP 13.0.0, SMU 13.0.0, DCN 3.2 + DMUB, 24 GB VRAM. radeonsi's clear readback is exact, and RADV NAVI31 works.
  • PCIe throughput through the tunnel (amdgpu SDMA benchmark, 1024 x 64 MiB): host to VRAM 48.2 Gb/s (6.03 GB/s), VRAM to host 49.6 Gb/s (6.20 GB/s).
  • Benchmarks at 1920x1080: vkmark gives 20954 on the 7900 XTX and 14115 on the M4 Pro's own GPU. glmark2 (GL) gives 7950 on the 7900 XTX and 15046 on the M4 Pro. GL shows a flat ~0.1 ms per-frame floor; see Not yet.
  • Display: the 7900 XTX's HDMI drives Weston. FurMark GL 1920x1080 ran fullscreen for 150 s at avg 338 FPS (min 282), 100 % GPU, about 340 W, junction 85 C. The capture card recorded the HDMI output.
  • Over the whole session: no Gen4 link errors, no DART faults, no PCIe-C errors.

Not yet: s2idle and a bound hot-unplug with the eGPU on this Mac. The GL per-frame latency floor needs a look (Vulkan is unaffected). Stopping GDM while mutter drove the eGPU outputs left DMUB failing (Error queueing DMUB command), and loading amdgpu after GDM was stopped avoided it. That is a display-stack follow-up, not this PR.

Evidence

Lab trace traces/gpu/20261128-j616s-egpu/ (README): plug logs before and after #2301, enumeration, bind, benchmarks, throughput, the HDMI capture frames and clip. The Mac was restored to its saved default afterwards: saved kernel booted, no one-shot pending, SELinux enforcing, 0 failed units, boot images unchanged.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Second-family regression row (J316s, M1 Pro, T6000): pass. The same kernel used for the J616s row (main 844781f + this PR's exact blobs, fleet89 config) was booted as a one-shot on the J316s with its normal fleet DTB, so #2069's pcie-apple.c ran on another family.

  • Kernel 7.3.0-aurora-tbpcie1+: Enforcing, 0 failed units. The fleet smoke row (display, input, net, audio sink, GPU render) passed. All 3 USB4 routers bound with their tunnel links, and the internal PCIe (Wi-Fi/BT) came up.
  • Kernel error lines: 0 on the production boot, 3 on the trial boot, neither from this PR. bpf-restrict-fs: Failed to load BPF object happens because the test kernel was built without BTF. brcmfmac ... ring 4: r_ptr 0 outside depth 0 is main's 11-23 ring-pointer check firing intermittently: it also appears on a J713 fleet85 boot without this PR. J614s: PCIe-C on the Thunderbolt ports (Studio Display USB, audio, camera) #2069 only changes the T6040 PCIe-C match data.
  • Restored and verified: saved fleet89, empty next_entry, Enforcing, 0 failed units, test kernel removed.

Lab evidence: traces/usb/20261128-dt-complete-tunnels/m1pro-regress-tbpcie1/.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Code-owner heads-up for the 6-point rule: @aurora-silicon/omarchy-mac @aurora-silicon/aurora-maintainers, this is a DT-only PCIe-over-Thunderbolt change (Ryan's order: tunnels on in every Mac's DT). It has an App approval, hardware rows (see above) and local dt-checks with 0 new warnings. We plan to merge once CI is green and at least an hour has passed since this ping, unless someone objects here. Revert = revert the PR's commits.

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 638bd1cb: not ready yet

Check Detail
CI at head running running: KUnit clpc, KUnit apple-spmi-nvmem, KUnit trusted-keys
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 638bd1cb
Conflicts ok none
PR text ok Risk: two-way · T6040 only. Nothing comes up on its own: the USB4 router driver populates a tunnel only when a PCIe tunnel is requested, and only where the board enables that router (the J773s routers are still off, so its nodes stay idle). Revert = revert the one commit.

Areas: area:bringup

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@petrskuta

Copy link
Copy Markdown
Contributor

J614s hardware row at 638bd1cb: pass. The Studio Display comes up over PCIe-C (USB hubs, camera, audio) with this head's kernel and J614s DTB, same as on #2069.

MacBook Pro 14" M4 Pro (J614s, apple,t6040), Arch Linux ARM, default command line. Kernel 7.3.0-pr3512+ built at 638bd1cb34ba (LLVM=1, clang 23.1.5, Rust on, this unit's normal config). J614s DTB sha256 32bf97f7…153a, byte-identical to #2069 at cbf6a5af. Booted once as a one-shot aura-try Stage 2 (aura 1.0.0b14-g3ff77894, the same aura build as the normal boot, carrying this head's J614s DTB) plus a one-shot GRUB entry. Apple Studio Display on a Thunderbolt port, plus an HDMI display.

Compared with this unit's normal boot (#2069 build, same displays and cables) using the same check script:

Normal boot (7.3.0-pr2069+) This head (7.3.0-pr3512+)
PCIe-C tunnels 0-2 (usb4-pcie-tunnel-N pcie + DART) okay okay
Tunnel 2: JHL7440 bridges + USB controller 0001:03:00.0 present present
Studio Display USB: 05ac:101d USB2 hub, 05ac:1114 display, 05ac:101e USB3 Gen2 hub (10 Gb/s) present present
Studio Display audio (USB-Audio - Studio Display) present present
Studio Display camera (/dev/video*) present present
Displays: DP-3 5120×2880, eDP 3024×1890, HDMI 2560×1440 connected connected
System state / failed units running / 0 running / 0
Kernel err-level lines 6 9
  • The extra err lines are the same apple-dart 602300000.iommu: TLB command 0x1 for stream 0 timed out that the normal boot logs (5 here vs 2). That DART belongs to the external DCP (602e00000.dcp piodma) and the display subsystem, not to a PCIe-C DART. On the normal kernel its count ranges from 1 to 35 per boot across the last six boots, so it isn't from this PR.
  • Three extra /dev/video nodes (apple-prores, apple-prores-decode, apple-scaler) come from the main merge enabling ProRes and the scaler on T6040, not from this PR.
  • Not covered: no other Thunderbolt PCIe device (enclosure or eGPU) on this unit, and no unplug/replug or sleep cycle at this head.

RESULTS

VERDICT: pass on J614s. The PCIe-C tunnel with the Studio Display enumerates and binds at this head exactly as on #2069; no new error lines from the PCIe-C or tunnel DART paths.
NEXT LEVER: none needed for this PR on J614s.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at 638bd1cb. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J616s-eGPU+J316s;stacked-after-2069. (5) There's no blocking review. (6) Dj was pinged here 554 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 273e9fa into main Nov 28, 2026
21 of 23 checks passed
@RyanTheTide
RyanTheTide deleted the feat/t6040-pciec-every-board branch November 28, 2026 22:30
RyanTheTide added a commit that referenced this pull request Nov 29, 2026
arm64: dts: apple: t604x: enable ADT-present peripherals and move tunnel PIODMA (on #3512)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants