Skip to content

J614s: PCIe-C on the Thunderbolt ports (Studio Display USB, audio, camera) - #2069

Open
petrskuta wants to merge 10 commits into
aurora-silicon:integration/aurorafrom
petrskuta:pr/j614s-studio-display-usb
Open

petrskuta wants to merge 10 commits into
aurora-silicon:integration/aurorafrom
petrskuta:pr/j614s-studio-display-usb

Conversation

@petrskuta

@petrskuta petrskuta commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #2068. This branch is stacked on it, so only the last three commits are new here.

Tunneled PCIe now works on all three Thunderbolt ports of the J614s (T6040), the first M4 Pro/Max PCIe-C on hardware as far as I know. A Studio Display's xHCI enumerates behind it, and with it the display's USB2/USB3 Gen2 hubs, speakers, microphones, camera, HID interfaces and USB-C ports. Findings are in #1589.

Commits

  1. PCI: apple: T6040 PCIe-C is an Intr2AXI controller. t6040_pciec_hw was modelled on T8132, but the ADT's apciec,t6040 has no oe-fabric region, so kernel_init cold init failed (-ENODATA). Its tunables are T6050's with small differences, so it now takes the T6050 path: tunnel_intr2axi, no_port_reset, and RID2SID slots allocated rather than indexed by SID. With iommu-map-mask = <0xff> the xHCI (RID 0x300) and the display's bridge (RID 0x100) share SID 0, and the indexed slot failed the xHCI's enable with a silent -EBUSY.

  2. arm64: dts: apple: t6040-j614s: PCIe-C on the left Thunderbolt port. Enables the tunnel, DART and controller with apple,pciec-kernel-init, plus everything from the J614s ADT (macOS 26 IODeviceTree, apciec0 / dart-apciec0):

    • the controller's fabric/rc/debug tunables and the port's config tunables;
    • the DART's tunables and DMA window (vm-base 1 TiB + 2 GiB, vm-size 0x7ff00000, dead first 16 KiB);
    • apple,bypass-sids = <253 255> (bypass-253, bypass-255), as on T6050's PCIe-C DART. The port's own writes, its MSIs turned into AIC writes, use those streams. Without the bypass no MSI arrived (xHCI Command Aborted on every device) and the DART fault IRQ stormed.

    Full error reporting, CTC flush and the ATC0 PCIe power domain are also as on T6050.

  3. arm64: dts: apple: t6040-j614s: PCIe-C on all three Thunderbolt ports. The ADT's apciec0-2 and dart-apciec0-2 carry identical tunables, DMA windows and bypass streams, so the description moves to t6040-j614s-pciec.dtsi (one J614S_PCIEC(n) template used for ports 0, 1 and 2). Port 0 is unchanged.

Testing

  • MacBook Pro 14" M4 Pro, apple,j614s apple,t6040, os-fw 26.6.2, system-fw 27.2. This series on integration/aurora cc8cdb428. Hyprland 0.57.2.
  • Studio Display (2022) on the left port, hotplug: cold init completes (status 0x3, link up), domain 0001 has the root port 106b:1018, the display's Titan Ridge bridges 8086:15ef and xHCI 8086:15f0, and xhci_hcd binds.
  • USB: Apple USB2 hub 05ac:101d, USB3 Gen2 hub 05ac:101e (10 Gb/s), Studio Display 05ac:1114.
  • Speakers (snd-usb-audio, PipeWire playback): pass.
  • Microphones (recorded and played back): pass.
  • Camera (uvcvideo, UVC 1.50, MJPEG 1920x1080, live preview): pass.
  • USB-C port on the display: a USB 3.1 Gen 1 drive at 5 Gb/s, partitions read: pass.
  • s2idle suspend and resume with the display attached: the xHCI restarts, and the hubs, Studio Display audio, camera and the drive come back. Audio plays after resume.
  • All three ports, hotplug: left near MagSafe (ATC0), left rear (ATC1) and right (ATC2). Picture at 5K, each port's own PCIe-C cold-initializes, and the USB hubs, Studio Display audio and the drive come up. Audio plays.
  • Plug cycles: 6 hotplugs in 90 s across all three ports, one unplugged mid-setup: USB, audio and picture each time (~3.3 s to ready), no Command Aborted or DART/PCIe-C errors.

🤖 Generated with Claude Code

fbalazsy and others added 5 commits November 16, 2026 10:06
In CIO mode the T6040 ATC PHY's AUSPLL feeds the pixel clocks of the
router's DP IN adapters: one fixed AUSPLL frequency, a divider select per
link rate in TX_DP_CTRL0 (RBR 4, HBR 3, HBR2 1, HBR3 0), the clock switch
gate in the cfg bank, and the stop. DP IN 0 uses PCLK1 and switch 1; DP IN
1 uses PCLK2 and switch 2 and needs PCLK1 running as well.

appledrm drives it through apple_t6040_dp_tunnel_rate(), a symbol of its
own as for T6050, so phy-apple-atc and phy-apple-t6040-usb2 can both be
built. The PHY stops the tunnel clocks when it leaves CIO.

[petr: taken from fbalazsy/linux j616s/split-display (the tunnel clock,
 432f1ec "give the DP tunnel pixel clock a symbol of its own" and
 346a417 "give DP IN 1 of a tunnel its PCLK1 prerequisite") onto
 integration/aurora. Tested on the J614s with a Studio Display (2022) on
 Thunderbolt up to 5120x2880@60, aurora-silicon#1589.]

Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On T6040/T6041 the crossbar's 0x34 is a per-clock UHBR select (bit n set
when the link rate is UHBR) and the ATC enable of a DP IN output is at
0x38. The T6030 link wrote the ATC enable to 0x34, which set the UHBR
select of an HBR2 stream and left the ATC disabled: the tunnel trained
but no pixel data reached the DP IN. DP IN tunnels carry DP 1.x rates
only, so clear the UHBR select and set the enable at 0x38; the DP alt
mode output keeps the T6030 write. Resume checks the same register.

[petr: split out of fbalazsy/linux 5e66575 "drm/apple: T6041 display
 coprocessors across hibernation and S2R" (with its comment from
 ed490dd). On the J614s this took the Studio Display's video path from
 ~480 to ~976,000 packets/s at 1080p60, aurora-silicon#1589.]

Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Give the T6040 ACIO the M4 (T8132) DP IN policy and qualify T6040 and
T6041 for DP tunnels. Their DP IN adapters take the t8103 handshake and
the M3 flow, as on T8132; the pixel clock is the ATC PHY's AUSPLL
(apple_t6040_dp_tunnel_rate()).

Tested on the J614s (M4 Pro) with a Studio Display (2022) on the left
Thunderbolt port: 1920x1080, 2560x1440 and 5120x2880 at 60 Hz, extended
desktop, aurora-silicon#1589.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcp_tunnel_crossbar_up() routes the mux at the first
DidChangeLinkConfiguration and enables the connection only for
dcp_t602x_tunnel_route(), which never matches the T6041 crossbar on 26.6.
Its clocks then stay off until a retrain runs the up path again. 1080p
and 1440p got video only because the firmware retrained after the mode
set; 5120x2880 keeps the trained link ("Forcing link status to true for
synched-pipe config") and stayed dark with the crossbar's FIFO and pixel
clocks off.

Also enable the connection at the first link up for the T6041 crossbar.
Tested on the J614s with a Studio Display (2022): 5120x2880@60,
aurora-silicon#1589.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS runs the host router's TMU in mode 3 (bi-directional HiFi) with a
Studio Display attached, and the display's router and DP OUT adapter
report "Min Required TMU Mode" 3. Linux put the J614s host in
uni-directional LowRes and left the display's router alone because it
already read as bi-directional HiFi, so the host's time was never posted
to it. The display then dropped HPD one second into 5120x2880@60
("IOAVVideoInterface terminated ... display HPD removed").

Add QUIRK_TMU_HIFI_BI: the host router configured for bi-directional
HiFi, and every device router configured, disabled, given the host's
time and enabled again. Set it for T6040/T6041.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tunnel's AUSPLL start sets CLKOUT_MASTER 0x808 and refuses to start
while either bit is set ('already in use'), but the stop cleared only
0x8. After the first stop, e.g. a DPMS off of a Studio Display, the
tunnel clock could not start again:

  DP tunnel: AUSPLL already in use (master 0x81d54, cmd 0x10000018)
  DP tunnel pixel clock (rate 0x14) failed: -16

and the display stayed dark after DPMS on. Clear both outputs.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@petrskuta
petrskuta force-pushed the pr/j614s-studio-display-usb branch from 82219c7 to 35a6e91 Compare November 16, 2026 09:39
@petrskuta petrskuta changed the title J614s: PCIe-C on the left Thunderbolt port (Studio Display USB, audio, camera) J614s: PCIe-C on the Thunderbolt ports (Studio Display USB, audio, camera) Nov 16, 2026
fbalazsy and others added 4 commits November 16, 2026 13:58
The host test extracts dcp_route_clock_rate() from the display fabric and
builds it on its own. The fabric now calls the T6040 PHY's own tunnel clock
symbol on T6040 and T6041, so the test needs that helper and a model of the
symbol.

Extract dcp_fabric_t6040_tunnel_clock() with the other fabric functions, stub
apple_t6040_dp_tunnel_rate() and add a case that runs both machines through
DP IN 0 and 1: the rate reaches the T6040 symbol with the right adapter,
neither the ATC nor the T6050 provider is called, and a clock that fails to
start leaves the route's rate alone.

Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
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, aurora-silicon#1589.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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,
aurora-silicon#1589.

Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 <20834920+petrskuta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@petrskuta
petrskuta force-pushed the pr/j614s-studio-display-usb branch from 5d0f77c to b19f247 Compare November 16, 2026 12:59
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for getting tunneled PCIe working on the M4 Pro. Moving T6040 onto the Intr2AXI match data, with the comment explaining why, is the approach we prefer.

Since this is stacked on #2068, the diff also carries that PR's per-SoC pixel-clock selection (drivers/gpu/drm/apple/dcp-fabric.c:459-463), the per-chip apple_t6040_dp_tunnel_rate() symbol, and the T6040-only tmu_hifi_bi (drivers/thunderbolt/apple.c:255). We select behaviour by a hardware property rather than by the list of machines it was tested on, so those are best sorted out in #2068 (see the note there). The three commits new in this PR look fine on that front.

We can run Thunderbolt and PCIe no-regression rows on our M1 Pro, M2, M4 Pro and A18 Pro once #2068 settles.

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.

3 participants