Skip to content

arm64: dts: apple: t8122-j615: describe the USB4 PCIe-C tunnels (stacked on #1490) - #2812

Closed
satchlj wants to merge 29 commits into
aurora-silicon:mainfrom
satchlj:upstream/j615-usb4-pciec-tunnels-20261122
Closed

satchlj wants to merge 29 commits into
aurora-silicon:mainfrom
satchlj:upstream/j615-usb4-pciec-tunnels-20261122

Conversation

@satchlj

@satchlj satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

Split out of #1490 at Ryan's request: the J615 (MacBook Air 15-inch, M3) DTS for the USB4 PCIe-C tunnels, with the J615 /delete-node/ &usb_otg0. The commit is Ryan's, carried unchanged (author, committer, dates, message).

Stacked on #1490. The DTS uses #1490's t8122-usb4.dtsi, so this branch is #1490's head (ca0bc8d) plus this one commit. Review and merge #1490 first.

Not run on hardware. There is no J615 row behind it; the J613 rows on #1490 don't cover J615.

Open from #1490's review: the /delete-node/ &usb_otg0 here has no loader version on record that needs it (#1490 dropped the J613 copy for that reason). Ryan's call to keep or drop it.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

satchlj and others added 20 commits November 10, 2026 16:21
Describe the existing four-range format used by the T8122 router.

Signed-off-by: Satya Benson <[email protected]>
Read target, actual, busy and automatic state after release. Do not
override shared votes; let the caller quarantine restart when power-off
is unproven.

Signed-off-by: Satya Benson <[email protected]>
Keep the two J613 ECAM windows in disjoint 32-vector slices of the ADT
AIC window.

Signed-off-by: Satya Benson <[email protected]>
Use RUN with explicit pre-RTKit LSTX and strict firmware readiness;
disable DP tunnelling. Own power references and require a witnessed off
boundary before restart. Order PD, NHI and role/PHY shutdown. Keep the
T8122 session coordinator scoped to J613. The sequence was inferred from
the T6030 generation, not a J613 macOS restart trace, then exercised on
J613 hardware. Suspend coordination is carried from the trial but is not
hardware qualified; sleep remains outside admission.

Signed-off-by: Satya Benson <[email protected]>
Use saved J613 ADT windows, interrupts and tuning. Populate the root
tunnel containers dynamically and include them only on J613. Own all
four ACIO domains. Drop the disabled unused OTG node whose shared
PHY/DARTs older Stage 2 loaders otherwise prune. Both J613 firmware
profiles inherit the repair.

Signed-off-by: Satya Benson <[email protected]>
Compile the production function with missing and foreign domains, regmap
errors and each status bit independently injected. Extract provider
masks rather than duplicating register constants.

Signed-off-by: Satya Benson <[email protected]>
Use one aperture selector for PCIe-C admission and its negative tests.
Reject unknown apertures rather than borrowing another bridge slice.

Signed-off-by: Satya Benson <[email protected]>
The Apple NHI driver calls tb_apple_sleep_quiesce() from the Thunderbolt
core. With CONFIG_USB4=m and CONFIG_USB4_APPLE_SOC=m, these are separate
modules and modpost rejects thunderbolt_apple.ko with an undefined symbol.

Export the existing helper to GPL modules so the modular configuration
links. No quiesce behavior or hardware register access changes.

Validated with the J613 production configuration, LLVM 18 Image/modules/
DTBs build and modpost, plus strict checkpatch.

Signed-off-by: Satya Benson <[email protected]>
Describe the T8122 PCIe-C compatible and its eight named resources,
and the ACIO post-init power-domain providers. Use valid hyphenated
names for the six new J613 USB4 aliases, retaining their node targets
and the inherited legacy aliases.

The renamed PCIe-C aliases require the legacy-first lookup fallback
in aurora-silicon/aura#273, built and adopted with the new DTBs.
Do not roll these DTBs out with an older incompatible Stage 2.

Signed-off-by: Diljit Singh <[email protected]>
Signed-off-by: Satya Benson <[email protected]>
Some USB4 routers must be stopped by the Type-C port driver, in a fixed
order ahead of the USB role and the PHY, before tasks freeze and at
shutdown. Others stop on their own. Let the provider say which it is in
its switch description, and give port drivers
typec_thunderbolt_switch_pd_ordered_stop() to ask, so they no longer have
to guess from the machine they run on.

Signed-off-by: Ryan Murray <[email protected]>
The T8122 router policy (MxWrap RUN, explicit LSTX, strict firmware-ready
admission, witnessed power-off) was only taken on apple,j613. Every other
T8122 Mac with the same router - the 15-inch MacBook Air (J615), the
iMacs (J433/J434) and the MacBook Pro (J504) - fell back to the T8103
policy, which cannot start it.

What the policy needs is the router's MxWrap CPU block, which the device
tree names as the "cpu" resource. Take the T8122 policy whenever that
resource is described and keep the T8103 fallback otherwise (for example
an older loader's handoff tree without it).

The strict power cycle has to be stopped by the PD driver ahead of the
USB role and the PHY, so advertise that through the switch description
instead of letting the PD driver infer it from the machine.

Signed-off-by: Ryan Murray <[email protected]>
The CD321x session stop before tasks freeze and at shutdown (ACIO, then
the USB role, then the PHY in safe mode) only ran on apple,j613. Run it
for whichever port's USB4/Thunderbolt switch asks for a port-driver stop
instead, and leave every other switch alone as before. The notifier is
registered for every CD321x and asks the switch on each suspend, because
the router may bind after the port.

Signed-off-by: Ryan Murray <[email protected]>
The J615 (MacBook Air 15-inch, M3) has the J613's two ATC ports on the
same T8122 routers. Give it the PCIe-C tunnel description and aliases
the J613 already has, and drop its unused, disabled USB2 OTG node so
older loaders do not prune the shared ATC0 suppliers.

Signed-off-by: Ryan Murray <[email protected]>
Cover the suspend notifier with a router that stops on its own (nothing
is sent to it) and with one that asks the port to stop it (SLEEP before
the freeze, WAKE after it).

Signed-off-by: Ryan Murray <[email protected]>
pd_ordered_stop asks the Type-C port driver to stop the USB4 session
before tasks freeze and at shutdown. Only the SPMI SN201202x driver had a
.shutdown, so on the T8122 Macs whose CD321x sits on I2C (J433, J434,
J504) the router took the strict power cycle at device_shutdown with the
USB role and PHY still owned by the port.

Give the I2C driver the same .shutdown. The I2C driver also binds plain
TPS6598x parts, which have no struct cd321x around them, so
tipd_shutdown() now returns early for a port whose variant does not
embed one, and a KUnit case covers that.

On a PREPARE that fails, the PM core skips our POST_SUSPEND: clear
session_pm_armed on that path too so the state stays obvious.

Macs that take the T8122 router policy (ACIO node names "cpu", shared
t8122.dtsi): J433, J434, J504, J613, J615; their ports get the
PD-ordered sleep and shutdown stop.

Signed-off-by: Ryan Murray <[email protected]>
The PCIe-C tunnel DARTs probe as devices of their own and sit inside the
ATC's CIO-PCIe block, which their tunnel's root port already names. Give
each DART the same power state so it is never probed or read while that
block is off. apple-dart-pd-check.py reported both as new findings on
the J613 and J615 DTBs; it reports none now.

Signed-off-by: Ryan Murray <[email protected]>
The T8122 branch of the PCIe-C MSI check matched the machine and looked
each bridge's slice up in a table of ECAM apertures. Each PCIe-C node
already names its slice: apple,msi-vector-base gives the first vector it
owns in the shared window and msi-ranges that vector's AIC line. Check the
slice's shape from those (a 32-vector slice after the internal host's
vectors 0..31) and derive the window's AIC base from them, and select the
branch by the controller's match data instead of the machine.

The host test now reads the slices from the J613 DT and checks them, and
the shapes that must be refused, with the same helper.

Signed-off-by: Satya Benson <[email protected]>
The node was deleted for older Stage 2 loaders that were said to prune
ATC0's shared suppliers through it, but no loader version doing that is
on record. Keep it, as the other T8122 boards do; it stays disabled.

Signed-off-by: Satya Benson <[email protected]>
Two PCIe-C nodes naming the same apple,msi-vector-base would both pass
the slice check and program the same vectors of the shared window. Claim
each 32-vector slice when a bridge's MSI is set up and release it with the
device, so the second bridge fails with an error naming the slice. Also
refuse a vector base past 224, the window's last slice.

The host test checks that the J613 DT's PCIe-C bases are distinct.

Signed-off-by: Satya Benson <[email protected]>
The T8122 PCIe-C driver takes each bridge's MSI slice from
apple,msi-vector-base. Require it for apple,t8122-pciec bridges, as a
multiple of 32 from 32 to 224 (the shared window after the internal host's
vectors 0..31).

Signed-off-by: Satya Benson <[email protected]>
The apple,pcie binding now requires apple,msi-vector-base on
apple,t8122-pciec bridges, which T6030's USB4 PCIe-C also is. Give it the
slice the driver already assigns to this ECAM aperture (0x730000000:
vectors 32..63), so the node validates; the T6030 path does not read it.

Signed-off-by: Satya Benson <[email protected]>
The apple,pcie binding now requires apple,msi-vector-base on
apple,t8122-pciec bridges, which T6030's USB4 PCIe-C also is. Give it the
slice the driver already assigns to this ECAM aperture (0x730000000:
vectors 32..63), so the node validates; the T6030 path does not read it.

Signed-off-by: Satya Benson <[email protected]>
… slice shapes

The previous commit ("name the PCIe-C bridge's MSI vector base") was wrong
to say the T6030 path does not read apple,msi-vector-base. apple_msi_init()
corrects the old global window (AIC 1342, 512 vectors) only when the
property is absent. With the property added and msi-ranges still describing
the global window, the slice check refuses and the J514s/J516s PCIe-C bridge
fails to probe ("invalid or missing MSI slice"). Found by Ryan Murray.

Describe the bridge as T6040's are: its own 32-vector slice,
msi-ranges = <&aic AIC_IRQ 1374 IRQ_TYPE_EDGE_RISING 32> with
apple,msi-vector-base = <32>. The legacy correction stays for the shared
bootloader DTs that still carry the global window and no base.

Move the slice decision into apple_pciec_msi_slice() in pcie-apple-t8122.h,
unchanged in behaviour, so a host test can cover the three T6030 shapes:
legacy without the property (corrected), per-slice (accepted), and the
global window with a base (refused), plus a misplaced line, a foreign base
and T6040's shape.

Signed-off-by: Satya Benson <[email protected]>
… slice shapes

The previous commit ("name the PCIe-C bridge's MSI vector base") was wrong
to say the T6030 path does not read apple,msi-vector-base. apple_msi_init()
corrects the old global window (AIC 1342, 512 vectors) only when the
property is absent. With the property added and msi-ranges still describing
the global window, the slice check refuses and the J514s/J516s PCIe-C bridge
fails to probe ("invalid or missing MSI slice"). Found by Ryan Murray.

Describe the bridge as T6040's are: its own 32-vector slice,
msi-ranges = <&aic AIC_IRQ 1374 IRQ_TYPE_EDGE_RISING 32> with
apple,msi-vector-base = <32>. The legacy correction stays for the shared
bootloader DTs that still carry the global window and no base.

Move the slice decision into apple_pciec_msi_slice() in pcie-apple-t8122.h,
unchanged in behaviour, so a host test can cover the three T6030 shapes:
legacy without the property (corrected), per-slice (accepted), and the
global window with a base (refused), plus a misplaced line, a foreign base
and T6040's shape.

Signed-off-by: Satya Benson <[email protected]>
A slice another bridge already owns failed the probe through
invalid_slice, as -EINVAL with "invalid or missing MSI slice". The claim
has said which vectors are taken; return its -EBUSY instead (Ryan Murray's
review).

Signed-off-by: Satya Benson <[email protected]>
A slice another bridge already owns failed the probe through
invalid_slice, as -EINVAL with "invalid or missing MSI slice". The claim
has said which vectors are taken; return its -EBUSY instead (Ryan Murray's
review).

Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: Ryan, you're right about 42d2e45, thank you. I checked it against apple_msi_init(): the legacy correction runs only when apple,msi-vector-base is absent. With <32> added and msi-ranges still on the global window (AIC 1342 x 512), apple_t6030_msi_slice_valid() refuses, and the J514s/J516s PCIe-C bridge would fail probe. That commit's message claimed T6030 doesn't read the property, which was wrong.

New commits (no history rewrite):

Checked locally: the host test passes, and j514s/j516s built with the tree's dtc validate against apple,pcie.yaml with no pcie@730000000 complaint. Not checked: an actual T6030 PCIe-C probe. I have no T6030 rig, so that probe row is owed by someone who has one.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at 599992a (non-author, draft). The only commit of its own over #1490's current head is e75274d (the J615 DTS); the other three are #1490's latest commits under new SHAs. No blocker in the DT; one consistency point.

  • With the PR's tree, t8122-j613.dts and t8122-j615.dts both compile, and every usb4/ACIO/PCIe-C node and alias in the two DTBs is identical, so the J615 gets exactly the J613's description on the same routers.

Points to consider:

  • J613 and J615 now differ only in the /delete-node/ &usb_otg0: thunderbolt: apple: enable the J613 USB4 host-to-host path #1490 keeps the J613's node ("keep the USB2 OTG node", c44f39a) because no loader version on record needs it removed, and this commit removes the J615's for the same stated reason it was dropped on the J613. The two boards share t8122-j613-j615.dtsi and the same Stage 2; they should get the same answer. Unless a J615 boot shows a current loader pruning the ATC0 suppliers, dropping the /delete-node/ keeps them aligned.
  • The six usb4-* aliases are now written out identically in both board files; moving them into t8122-j613-j615.dtsi would keep them from drifting.
  • A J615 row is still missing (tunnel enumeration on both ports), as the body says.

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: CI on 599992a is green. host-tests (job 137381222178) ran the new test through the full runner, its first real run: ok pcie-apple-msi-slice-tests (0.1s). dt-checks passes too. A T6030 PCIe-C probe on hardware is still owed.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@satchlj checking open drafts today. To come out of draft, this still needs:

  • It conflicts with main. Merge main in or rebase (no force push needed: a merge commit is fine).
  • Then a test run at the final head on a Mac with the hardware it touches, and mark it ready for review.

If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done.

Resolve conflicts in ACIO DT binding descriptions, T8122/T8132 PCIe-C
MSI slice dispatch, ACIO power-down/PSD domain release, and tipd KUnit
header declarations.

Signed-off-by: Satya Benson <[email protected]>
apple_pciec_msi_slice() uses bool, which fails under -std=gnu17 host
builds (such as tools/testing/j613-usb4/run.py on gcc-13) when included
without <stdbool.h>. Guard the include with #ifndef __KERNEL__.

Signed-off-by: Satya Benson <[email protected]>
…-pciec-tunnels-20261122

Resolve conflicts in arch/arm64/boot/dts/apple/t8122-j615.dts (keeping
main's board additions and dropping /delete-node/ &usb_otg0 to match J613)
and drivers/pci/controller/pcie-apple.c (taking the updated T8122/T8132
MSI slice dispatch from aurora-silicon#1490/main).

Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Merged updated #1490 (including main) into the branch (c4033de0f07c), keeping main's J615 board additions and dropping /delete-node/ &usb_otg0; to match J613.

Verified locally on c4033de0f07c:

  • tools/testing/j613-usb4/run.py passes.
  • tools/asahi/pcie-apple-msi-slice-tests.c passes under -std=gnu17.

Keeping as draft pending #1490 and a J615 hardware row at this head.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 (M3 Air 15") row: DT at c4033de0 merged with main 844781f → pass (boot + bind). Enumeration is still owed.

The J615 DTB built from this PR's DT on current main (sha256 38453e6b…) was booted as a DT-only aura-try trial on the J615. It ran on the Mac's saved kernel (7.3.0-aurora-fleet90-airs2, built from main on 11-26, which already has main's T8122 PCIe-C MSI-slice path), with the live Stage 2 otherwise byte-identical. No #1490 driver code was involved.

  • Both USB4 routers (cio@701ac0000, cio@b01ac0000) bound to thunderbolt-apple-acio with their apple,pcie-tunnel links. Both tunnels (pcie@730000000, pcie@b30000000) and their DARTs are okay. As designed, nothing is populated until a PCIe tunnel is requested.
  • The fleet smoke row (display, input, net, audio sink, GPU render) passed before, during and after the trial. The DT-parity node check passed too. There were no new kernel errors: the router firmware's Gen2/3 link error lines on port 1 appear the same way on the production boots (cable on that port).
  • Restored and verified: saved kernel, empty next_entry, Enforcing, 0 failed units, Stage 2 unchanged.

Still to run: enumeration with a TB5 PCIe enclosure on a J615 port (our lab's RX 7900 XTX enclosure is moving across the fleet). That row will show whether main's T8122 router policy is enough for PCIe-C or whether #1490's MxWrap/teardown changes are needed.

Separately: c4033de0 itself doesn't build. drivers/thunderbolt/apple.c defines apple_cio_t8122_hw twice (main's deep-sleep version at line 224, and this series' MxWrap version at 243), and two apple_cio_stop(acio) calls lack main's new awake argument. The apple_t6030_msi_slice_valid() removal is noted on #1490. The two T8122 definitions make conflicting hardware claims (T8103 layout vs. T6030 MxWrap generation), so the next main merge needs a decision there. main's version is the one the J615 fleet runs today.

Evidence

Lab paths (internal): trial log, fdt of the trial boot, tunnel check output: traces/usb/20261128-dt-complete-tunnels/j615-pr2812-dtonly/. The tunnel check script is a read-only sysfs/journal walk (work/dt-complete/tools/tuncheck.sh).

acio /soc/cio@b01ac0000 status=okay pcie-tunnel=Y driver=thunderbolt-apple-acio
acio /soc/cio@701ac0000 status=okay pcie-tunnel=Y driver=thunderbolt-apple-acio
tunnel /usb4-pcie-tunnel-1/pcie@b30000000 status=okay
tunnel /usb4-pcie-tunnel-0/pcie@730000000 status=okay
TUNCHECK PASS acio_okay=2 tunnels_okay=2

@RyanTheTide

Copy link
Copy Markdown
Contributor

@satchlj @DjDeveloperr: Ryan has ordered PCIe tunnels on in every Mac's DT today, so the T8122 DT half of this PR and #1490 is now split out on top of main as #3516. It's two commits under Satya's authorship with both your sign-offs and a [ryan: ...] split note. The tunnel dtsi is included from t8122.dtsi, so all five M3 boards get it, and the J615 tree is identical to the one that passed above. #1490 keeps the J613 handoff and driver changes. If the enclosure row shows main's router policy can't bring a T8122 tunnel up, #1490's MxWrap work is the follow-up. Shout if you'd rather carry the split yourselves and we'll close #3516 in favour of yours.

@satchlj

satchlj commented Nov 28, 2026

Copy link
Copy Markdown
Member Author

Superseded by #3516, which carries the T8122 USB4 PCIe-C tunnel DT for all M3 boards (including J615) directly on top of main.

@satchlj satchlj closed this Nov 28, 2026
RyanTheTide pushed a commit to AxxzyWasTaken/linux that referenced this pull request Nov 28, 2026
Every T8122 ADT lists two PCIe-C controllers behind the USB4 routers
(apciec0-1) with their DARTs (dart-apciec0-1), and every T8122 board
enables both routers, but none of them described the tunnels, so a
Thunderbolt PCIe device (an eGPU enclosure, a dock's xHCI or NIC) never
enumerated on an M3.

Describe both tunnels in t8122-usb4.dtsi and include it from t8122.dtsi:
each tunnel's DART with the tunables no boot loader fills, the
controller with its oe-fabric and intr2axi windows, its 32-vector slice
of the shared MSI window (apple,msi-vector-base) and the oe-fabric
tunables, and the router's apple,pcie-tunnel link. The router driver
populates a tunnel only when it asks for one. The routers also gain
their PCIe adapter and CPU register windows, and the usb4-N-pcie
aliases through which the boot loader fills the rc, fabric and debug
tunables.

The bindings for the T8122 controller and the routers' power-domain
suppliers come in the previous commit.

[ryan: split the T8122 description out of aurora-silicon#1490/aurora-silicon#2812 (the J613 handoff
 and driver changes stay there), include it from t8122.dtsi for every
 T8122 board instead of from the J613/J615 board files, move the
 aliases into it]

Signed-off-by: Satya Benson <[email protected]>
Co-developed-by: Diljit Singh <[email protected]>
Signed-off-by: Diljit Singh <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
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