Skip to content

arm64: dts: apple: enable the J813 front USB4 port - #2238

Open
sithglan wants to merge 6 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j813-usb4-front
Open

sithglan wants to merge 6 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j813-usb4-front

Conversation

@sithglan

@sithglan sithglan commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The J813 front USB-C port does not work with a USB4 device: a USB4 NVMe enclosure that works on the rear port enumerates neither as USB4 nor as USB on the front port. The front connector's PD controller enters USB4 by itself (DATA_STATUS bit 23, USB4 connection), but only the rear port's ACIO1 router and PCIe-C tunnel are described, so nothing takes the link over.

This describes ACIO0 like ACIO1, with the values of the ADT acio0, acio-cpu0, dart-acio0, apciec0 and dart-apciec0 nodes: router 0x401ac0000, mailbox 0x401108000, NHI, DARTs, PCIe-C 0x404000000 with ECAM 0x1c50000000 and its MSI slice at vector 96 (AIC 1837, which gives the window base 1741 like every other J813 PCIe node), CIO reset line 0, LSTX AOP pin 19 and the ATC0 power states. Device tree only: the T8142 router, PCIe-C and CIO reset support from #2142 handles the second port unchanged, and aura fills the tunables and the DROM for every /arm-io/acioN through the usb4-0-* aliases.

Depends on #2142 and aura#435.

Hardware: J813 / T8142, UGREEN USB4 enclosure (vendor 0x00b8, device 0x2463), Samsung 980 PRO 2 TB.

Validation:

  • checkpatch --strict clean. apple-dt-check.sh against Enable native rear-port USB4 and PCIe storage on J813 #2142's head: no new or removed warnings (137 DTBs).
  • Tested on the full J813 stack that carries Enable native rear-port USB4 and PCIe storage on J813 #2142 (7.3.0 kernel with T8142: suspend-to-RAM with J813 device and USB-C display recovery #2135 + Enable native rear-port USB4 and PCIe storage on J813 #2142): unchanged kernel and modules, only the DTB rebuilt with this commit on top. There the commit spells the PCIe-C alias usb4_0_pcie, because the enrolled aura predates aura#302; this PR uses usb4-0-pcie like Enable native rear-port USB4 and PCIe storage on J813 #2142's usb4-1-pcie and needs aura#302 in the same way. Apart from that alias name, the tested commit and this one are identical.
  • Front port at boot: authorized USB4 link at 20 Gb/s x 2 lanes, IOMMU protection, NVMe on PCIe domain 1 with MSI-X; 4 GiB direct read 2.2-3.3 GB/s; 64 MiB direct-read checksums at 0, 1 GiB and 1 TiB identical to the rear-port reference.
  • Hot-plug into the front port after boot, unplug from the front port, and moving the enclosure between front and rear in both directions.
  • Both ports at once, both ways round: enclosure on one port (USB4), a USB 3 hub with an Ethernet adapter on the other.
  • Deep sleep with the enclosure on the front port: an open disk refuses the sleep before the port changes (link and checksums kept); actual 8 s and 20 s sleeps with the idle enclosure reconnect it automatically, with the checksums and the J813 health checks (all CPUs, internal display, GPU clear/readback, Bluetooth, Wi-Fi, internal storage) passing after each wake.
  • SMART media and error-log counts stay zero, no host writes.

Scope: USB4 DisplayPort tunnels stay disabled, as on the rear port. The unplug and sleep-entry messages "tunnel reset acknowledgment timed out" / "Failed to lock pipehandler" and the IRQ-affinity messages appear on the front port exactly as they already do on the rear port.

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

Restacked on the updated #2142 (4ed06b3). It is now 6113f94 (was 300baa0); this commit is unchanged (git range-diff).

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed only the front-port commit. ACIO0 mirrors ACIO1 exactly: I diffed the two blocks, and only addresses, AIC numbers, the reset index, LSTX pin 19, the ATC0 domains, the PCI domain and the BAR windows differ. The MSI slice (1837 at vector 96) gives the same 1741 base as the rear and internal ports, so it holds under the current driver check and under the DT-derived one I asked for on #2142. The gpio-reserved-ranges update frees exactly pins 19 and 21. Approve once #2142 is in. Please add one front-port boot of this exact DTB with an aura that has aura#302: the tested build used usb4_0_pcie with an older aura.

@sithglan
sithglan force-pushed the thomas/j813-usb4-front branch from 6113f94 to f6ed2df Compare November 19, 2026 19:48
@sithglan

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Rebased onto #2142's new head 13483df0aa7f (now f6ed2df61ae9). The front-port commit is unchanged. #2142 no longer has a driver-side expected slice, and 1837 − 96 = 1741 passes the shape check.

Boot of this exact DTB on the J813 with aura 8b9c92ea + aura#302, chainloaded (details on #2142):

apple-dt-check.sh against #2142's head: 0 new and 0 removed warnings over 137 DTBs.

@sithglan

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr here is the front-port boot of this exact DTB with an aura that has aura#302.

Setup:

  • aura: main 3efa4a81, chainloaded in place.
  • Kernel and DTB: the head 32d868b5b119, with the J813's default config.

Device tree:

  • usb4-0-pcie points to /pcie-tunnel-0/pcie@1c50000000, and usb4-1-pcie to /pcie-tunnel-1/pcie@1c60000000.
  • apple,tunable-rc, apple,tunable-fabric and apple,tunable-debug are present under both.

At boot:

  • The front port held the DebugUSB tether, which the chainload needs. It links to the Linux host as a USB4 XDomain peer.
  • The enclosure was on the rear port: 20 Gb/s × 2, checksum b12e3997…, 3.2 GB/s.

Front port: I then moved the enclosure from the rear port to the front port, in place of the tether:

  • ACIO0 starts its router, and the PCIe-C cold init on /pcie-tunnel-0/pcie@1c50000000 applies the "debug and fabric tunables", then the "root tunables".
  • The router links at 20 Gb/s × 2, then pcie-apple 1c50000000.pcie: Link up.
  • nvme1n1 comes up with 10 I/O queues. The 64 MiB checksum matches (b12e3997…), and a 4 GiB O_DIRECT read runs at 3.2 GB/s.

Kernel log: no Oops, WARNING, BUG or hung-task lines on that boot.

The front link came up by hotplug, not with the enclosure attached at power-on. The front port is the tether's port, so it can't hold the enclosure while I chainload.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Looks good; approve once #2142 lands.

  1. arch/arm64/boot/dts/apple/t8142-j813-usb4.dtsi:210-232 (and :180): the ACIO0 DART apple,tunable list and apple,tunable-router-ap-fw are register values copied from the ADT into the source. The bootloader already fills the router, NHI, PCIe-adapter and PCIe-C tunables for each /arm-io/acioN through the usb4-N-* aliases. The other USB4 trees (t6040-usb4.dtsi, t6030-usb4.dtsi) carry no DART tunables. Please have the loader copy the dart-acio0 tunables through a usb4-0-dart alias as well, so these values come from the machine and stay out of the tree. The rear-port block from Enable native rear-port USB4 and PCIe storage on J813 #2142 (:348-370, :318) has the same issue and should be fixed the same way; that can be a follow-up, since it affects both ports equally.

What I checked: only the front-port commit 32d868b. The gpio-reserved-ranges change frees exactly pins 19 and 21. ACIO0 uses its own power states (0x3c8/0x3d0/0x4d8/0x4e0) with the same parent chain as ACIO1. Both new DARTs are deleted from the base and repopulated under their powered parents. The front-port boot with aura#302 that the earlier review asked for is posted.

HW row: the posted hotplug row covers the link. A regression line for the same boot is missing: 0 AVC denials, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j813-usb4-front branch from 32d868b to 7e31792 Compare November 21, 2026 12:51
@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide done. Head 7e31792fc986, with the loader side in aurora-silicon/aura#435.

  1. DART and router AP firmware tunables from the machine. The front router's apple,tunable list and apple,tunable-router-ap-fw are out of the tree, and aura#435 copies them from the ADT:

    • pcie_router_ap_fw of /arm-io/acio0 goes to the router through usb4-0-acio;
    • dart-tunables-instance-0 of /arm-io/dart-acio0 goes to the DART through a new usb4-0-dart alias.

    The alias is needed because aura's generic DART copy (dt_copy_dart_tunables()) never reached this DART. It matches DARTs by address, but dt_get_address() doesn't translate through the router's one-cell ranges. That is presumably why the list was in the tree. Without the alias, the same boot probes the DART with 0 tunables.

    The rear router's block from Enable native rear-port USB4 and PCIe storage on J813 #2142 stays as it is. Once Enable native rear-port USB4 and PCIe storage on J813 #2142 lands I'll move it the same way (usb4-1-dart); with aura#435 that is a tree-only change.

  2. HW row (J813, 27.2).

    • Setup: aura#435's head 68f760cd chainloaded in place with the J813 default config; this head's kernel and DTB (7.3.0-aurora-j813-pr2238+) booted through aura-try.
    • Front DART: apple-dart 401a80000.iommu: ... 22 tunables. apple,tunable and apple,tunable-router-ap-fw = <0x8 0xff2 0x482> are entry for entry the tables the tree carried before.
    • Rear router: keeps its tree's tables.
    • Front port: links to the DebugUSB host as a USB4 XDomain peer at 10 Gb/s × 2.
    • Regression line: 0 AVC denials, 0 failed units. Against the earlier arm64: dts: apple: enable the J813 front USB4 port #2238 boot's log, the only new kernel error lines are two reserved-memory overlap reports (fw-data and gfx-data/gfx1-data). They come from aura main since 3efa4a81, not from this change.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j813-usb4-front branch from 7e31792 to de2f95d Compare November 21, 2026 13:35
@sithglan

Copy link
Copy Markdown
Contributor Author

Follow-up from aura#435's review: aura now finds the router DART by its fully translated address through the generic DART copy, so the usb4-0-dart alias is gone. Head de2f95d9fb0f changes only that alias and the commit message.

On the J813, with aura#435's new head, the front DART still gets the same 22 rows and the router its AP firmware table, and the XDomain link to the Mac mini comes up at 10 Gb/s × 2.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of de2f95d: No blockers. Approve once #2142 and aura#435 land.

From the last review:

  • Front DART tunables and apple,tunable-router-ap-fw in the tree: resolved. Both are gone from the ACIO0 block (arch/arm64/boot/dts/apple/t8142-j813-usb4.dtsi:178-206), and aura#435 now copies them from the machine. The rear port's copies are still in the tree (:292 and :323 onward, from Enable native rear-port USB4 and PCIe storage on J813 #2142). You plan a tree-only follow-up for those once Enable native rear-port USB4 and PCIe storage on J813 #2142 lands; that is fine.
  • Regression line: resolved. The boot of 7e31792 gave 0 AVC denials and 0 failed units, and the two new reserved-memory overlap lines trace back to aura main. The de2f95d boot repeats the 22 DART rows and the XDomain link.

New since then:

  1. With the in-tree copies gone, the front port now needs aura#435. An enrolled aura that has drm/apple: dcp: let a Type-C port with HPD take over a pipeline held without it #302 but not mux: apple-display-crossbar: T6041 (M4 Pro/Max) per-ATC crossbar #435 still passes the apple,tunable-rc check (drivers/thunderbolt/apple.c:4544). The router then runs with router_ap_fw_tunable = NULL (apple.c:4652-4657), and the DART probes with no tunables (apple-dart.c:5271). No message says the tables are missing. Please name aura#435 as a dependency in the PR description next to Enable native rear-port USB4 and PCIe storage on J813 #2142. In Enable native rear-port USB4 and PCIe storage on J813 #2142, also make apple,tunable-router-ap-fw required whenever the router-ap-fw window is described, failing the probe as apple,tunable-rc does at apple.c:4544, so a too-old loader fails closed instead of giving an untuned port.

Checked: the only change from 32d868b is in t8142-j813-usb4.dtsi (the two tables are removed and the alias gets a comment), and the usb4-0-dart alias from 7e31792 is gone again. The commit has a human Signed-off-by and no trailers.

Assisted-by: LLM (Claude:Opus 5.5)

Allow the five ACIO register windows, LSTX GPIO and router firmware
tunables used by T8142. Describe its native PCIe-C compatible and
require the shared MSI vector base. Include the T8142 pinctrl fallback
chain used by the AOP LSTX pin.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8142 uses the Intr2AXI controller layout but its three-cell AIC
interrupt specifier and MSI window differ from T6050. Match it natively.
This allows a tunnelled NVMe controller to allocate working MSI-X
interrupts.

For T8132 and T8142 the slice is checked against the device tree alone.
msi-ranges names the AIC input of global vector apple,msi-vector-base in
a linear window, so the window's AIC base is msi-ranges minus
apple,msi-vector-base, and the slice is checked by its shape: an
edge-rising SPI, 32 vectors, 32-aligned, above the internal port's
vectors and inside the 8-bit map target. This replaces T8132's table of
ECAM apertures and its AIC base 1506 behind a machine check. The T8132
trees give 1602 - 0x60 = 1634 - 0x80 = 1506, and every J813 PCIe node
gives 1741.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Use the qualified MxWrap startup sequence: CIO reset leaves the CPU
running, then RTKit readiness precedes the LSTX handoff. Admit native
T8142 PCIe-C hosts without a T6050 fallback. Keep DP IN disabled.

Deep sleep removes CIO power. Remove idle NVMe hierarchies before
stopping the router and request fresh cable state on resume. Refuse
sleep when a disk is open or another endpoint driver cannot be removed
safely. A freeze removes no CIO domain, also with deep as the default,
so it keeps the port up and refuses nothing. Extend the production-C
admission tests with native T8142 and a negative control.

The T8142 behaviours are named flags of its match data
(sleep_removes_domains, restart_on_wake, phy_shared_with_dwc3), so a later
SoC that behaves the same sets them instead of extending a comparison.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe ACIO1, its mailbox and LSTX pin, and the PCIe-C tunnel.
Populate both DARTs under their powered parents. Use connector port 4 so
the existing DisplayPort alternate-mode route can retain port 3. Name the
PCIe-C tunable alias usb4-1-pcie, as t6040-usb4.dtsi does; aura looks it
up under that spelling since aurora-silicon/aura#302.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/j813-usb4-front branch from de2f95d to bada74c Compare November 22, 2026 10:56
@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora d1b022dc34fb (Ryan's tidy-up on #1799). The new head is bada74cc817b. It's on #2142's new head. The conflicts, the two host-test fixtures that needed the new fields, and the checks (461/461 host tests, W=1 builds) are listed there: #1799 (comment)

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of bada74c: a rebase only. The front-port commit is identical to de2f95d (same patch), and the #2142 commits under it differ only in where the t8142-j813-usb4.dtsi include sits. Our view of the patch stands.

Still open from the last review:

Assisted-by: LLM (Claude:Opus 5.5)

…ndow

A host router whose node describes the router-ap-fw window gets its
AP firmware tuning from the bootloader, which copies it from the machine
into apple,tunable-router-ap-fw. A loader that leaves it out used to give
a router that runs untuned, with nothing logged. Fail the probe instead,
as a missing apple,tunable-rc does, so a too-old loader is seen.

Every tree that describes the window today either carries the property
or has it filled in by the loader: the T6050 host routers and the J813
rear port in the tree, the J813 front port through aura.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Only the rear port's ACIO1 router and PCIe-C tunnel are described. The
front connector's PD controller enters USB4 by itself when a USB4 device
is attached (DATA_STATUS bit 23), and nothing in the kernel takes the link
over: a USB4 NVMe enclosure that works on the rear port shows up neither
as USB4 nor as USB on the front port.

Describe ACIO0 like ACIO1, with the values of the ADT acio0, acio-cpu0,
dart-acio0, apciec0 and dart-apciec0 nodes: router 0x401ac0000, mailbox
0x401108000, PCIe-C 0x404000000 with ECAM 0x1c50000000 and its MSI slice
at vector 96 (AIC 1837), CIO reset 0, LSTX AOP pin 19 and the ATC0 power
states 0x3c8, 0x3d0, 0x4d8 and 0x4e0. The bootloader fills the tunables
and the DROM through the usb4-0-* aliases, as for the rear port. The
router AP firmware tunable also comes from the bootloader, through
usb4-0-acio, and the router DART's tunables through its generic DART
copy, which finds the DART by its translated address (aura#435).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/j813-usb4-front branch from bada74c to 4cf511a Compare November 22, 2026 11:14
@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide both points from the last review.

  1. Description: it now names aura#435 next to Enable native rear-port USB4 and PCIe storage on J813 #2142 as a dependency. It also says what a loader without mux: apple-display-crossbar: T6041 (M4 Pro/Max) per-ATC crossbar #435 does with these heads: the router probe fails.
  2. Router AP firmware tuning: Enable native rear-port USB4 and PCIe storage on J813 #2142 has a new last commit, 79afc9215ab4 "thunderbolt: apple: require the router AP firmware tuning with its window".
    • When a node describes the router-ap-fw window and apple,tunable-router-ap-fw is missing, the probe now fails with -EINVAL and "Missing bootloader router AP firmware tuning", the way a missing apple,tunable-rc does.
    • A tuning that is present but can't be parsed fails as before.
    • Nothing that boots today changes: every tree that describes the window has the property, either in the tree (the T6050 host routers, the J813 rear port) or from the loader (the J813 front port, through aura#435).

New heads:

Checks:

  • The thunderbolt driver builds with W=1 and LLVM 22, and checkpatch --strict is clean.
  • tools/asahi/run-host-tests.py passes 461/461 on both heads.
  • The new check hasn't run on hardware.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks. Both points are covered at 4cf511a. The description names aura#435 as a dependency and says what an older loader does. The silent untuned case is gone with #2142's 79afc92, which I checked over there. The front-port commit itself is unchanged, so my view on the code stands. It should merge after #2142 and aura#435.

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.

3 participants