Skip to content

Enable native rear-port USB4 and PCIe storage on J813 - #2142

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

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

Conversation

@sithglan

@sithglan sithglan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

The J813 rear USB-C port can enumerate a USB4 storage enclosure, but the existing T8142 match data follows the wrong router startup sequence and has no native PCIe-C MSI setup. This enables the rear port with the MxWrap/RTKit/LSTX sequence verified on hardware, native PCIe-C match data and validated 32-vector MSI slices, and the corresponding device tree and bindings.

Deep sleep releases idle NVMe tunnels before the shared USB PHY shuts down, then requests fresh cable state after wake. An open disk or an unsupported endpoint driver refuses sleep. The notifier runs before DWC3: the initial default-priority version exposed a link-loss race during refusal, reproduced and covered by a production-registration test and negative control.

Hardware: J813 / T8142, rear port, UGREEN enclosure (vendor 0x00b8, device 0x2463), Samsung 980 PRO 2 TB, firmware 5B2QGXA7. The clean series is based on integration/aurora at f44bf7a. Runtime qualification used the same changes on the full J813 stack from #2135, retaining its display, GPU, radio, audio, media and sleep work.

Validation:

  • Full arm64 LLVM 22 kernel/modules/DTB build; no configuration features removed.
  • PCIe admission tests, including native T8142 and missing-DART/compatibility negative controls; PM notifier-order test and reversed-order negative control; five CIO host suites.
  • Changed binding schemas and examples pass. Board DT validation adds no new warning: the PCIe-C tunable alias is usb4-1-pcie (as in t6040-usb4.dtsi), which aura looks up since kboot: accept the hyphenated usb4-N-pcie alias for PCIe-C tunables aura#302.
  • The device tree carries no tunable values (since a42e7dc). aura fills the router's, the AP firmware one included, through usb4-1-acio, the PCIe-C ones through usb4-1-pcie, and the router DART's through its generic DART copy (devicetree, kboot: translate DT addresses through every ranges; copy the USB4 router AP firmware tunable aura#435). With a loader older than mux: apple-display-crossbar: T6041 (M4 Pro/Max) per-ATC crossbar #435 the router probe refuses ("Missing bootloader router AP firmware tuning") instead of running the port untuned. The boot rows below predate this and used the in-tree values; the row on this head is pending.
  • The T8132/T8142 MSI slice is checked against the device tree alone (msi-ranges minus apple,msi-vector-base gives the window base; 32 vectors, 32-aligned, above vector 31, inside the 8-bit map): no AIC constant and no ECAM table in the driver. The T8132 trees give 1506 and every J813 PCIe node 1741, as before.
  • Boot of this exact DTB with aura 8b9c92ea + aura#302 (chainloaded, 19 Nov): the PCIe-C tunables are present under both pcie-tunnel-N/pcie@... nodes, the rear link comes up at 20 Gb/s x 2, NVMe gets its MSI-X queues, and a 4 GiB direct read runs at 2.9 GB/s. With the enrolled aura (no drm/apple: dcp: let a Type-C port with HPD take over a pipeline held without it #302) the same DTB gives "PCIe-C tunnel disabled: not initialized by m1n1 or the kernel" and the enclosure falls back to USB.
  • Boot with the enclosure attached: authorized USB4 link at 20 Gb/s x 2 lanes, IOMMU protection enabled, NVMe MSI-X queues working.
  • Open-disk suspend refusal preserves the link and read checksums.
  • Actual 8- and 20-second deep sleeps with the idle enclosure attached: automatic reconnection, repeated 64 MiB direct-read checksums at 0, 1 GiB and 1 TiB; 4 GiB direct read after resume at about 2.9 GB/s.
  • SMART media/error-log counts stay zero, unsafe shutdown count and host-write-command count unchanged across those two sleeps/read tests.
  • Normal default reboot with the trial marker spent: matching kernel/DTB, automatic deep-sleep service, enclosure enumeration and the health checks pass.
  • After each wake: all ten CPUs, internal display, GPU clear/readback, factory Bluetooth identity and LE discovery, Wi-Fi traffic and internal-storage checksum pass.

Scope: rear port only. USB4 DisplayPort tunnels stay disabled; the existing DP alternate-mode graph remains separate on connector port 3. Other enclosures, front-port USB4, write workloads, mounted-storage suspend, external-display combinations and long-duration sleep remain unqualified. The final clean build's physical replug matrix is still pending; the preceding bring-up build was tested through physical unplug/replug. Existing firmware/property and IRQ-affinity messages remain, so this is a functional qualification rather than a clean-dmesg claim. Raw logs, per-unit identities and firmware remain private.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora 0abc2f3. It is now 963d155 (was 9736db6); the old branch no longer merged.

  • The only conflict was in t8142-j813.dts. Integration added J813 nodes at the end of the board file (arm64: dts: apple: t8142: lid angle sensor on J815 and J813 (on #1532) #1805 and the J813 alignment). They are kept, and the USB4 include stays last.
  • The binding commit lost its apple,pinctrl.yaml hunk. Integration already has the T8142 pinctrl compatible, so git dropped it as already applied. The other commits are unchanged (git range-diff).
  • The dt-checks failure is fixed. The PCIe-C tunable alias is now usb4-1-pcie, as in t6040-usb4.dtsi, so the board adds no new warning. aura only looked up the underscored usb4_N_pcie for these tunables; kboot: accept the hyphenated usb4-N-pcie alias for PCIe-C tunables aura#302 adds the hyphenated fallback that its other USB4 lookups already have. Until that is in, an older aura copies no PCIe-C tunables for this port.
  • Re-checked locally:
    • scripts/dtc/apple-dt-check.sh against 0abc2f3: 137 DTBs, 0 new and 0 removed warnings, both changed bindings OK;
    • run-host-tests.py: 427/427;
    • full build of Image, modules and DTBs (LLVM 22).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the J813 rear-port USB4 work. The sleep handling, and the hardware-reason comments on it, are good to have.

One small thing: drivers/pci/controller/pcie-apple.c:3441-3443 picks the AIC MSI base with of_machine_is_compatible("apple,t8142") ? 1741 : 1506, right after the PR adds t8142_pciec_hw match data for this controller. We select by the IP block's compatible or match data, or by the DT, rather than by the SoC name. Could the AIC base become a field in hw_info (1506 for T8132, 1741 for T8142), or be checked against the node's msi-ranges? Then the branch can test pcie->hw as the line above it does.

Happy to run a no-regression row on our other Macs once it's updated.

@sithglan

Copy link
Copy Markdown
Contributor Author

Done. It is now 4ed06b3 (was 963d155). Only "PCI: apple: support T8142 PCIe-C MSI slices" changed (now adee45b); the other three commits are identical (git range-diff).

  • struct hw_info has a new msi_aic_base field: 1506 in t8132_pciec_hw, 1741 in t8142_pciec_hw.
  • The slice check selects that branch by pcie->hw == &t8132_pciec_hw || pcie->hw == &t8142_pciec_hw, like the line above it, and takes aic_base from the match data. No machine check is left in that branch.
  • apple,t8132-pciec appears only in t8132-usb4.dtsi, so the T8132 boards reach the same branch with the same base as before.

Checked: pcie-apple.o builds with LLVM 22 and W=1 with no warnings, and checkpatch is clean. This is compile-tested only; the running path on the J813 is unchanged (same branch, same 1741).

#2238 is restacked on this head (6113f94, content unchanged). #2178 (T8152, 1879) has the same pattern and gets the same treatment in its rework.

@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.

Thanks for the quick rework. At 4ed06b3 the machine check is gone (pcie-apple.c:3446-3447). I'd still like the AIC base out of the driver, because the DT already says it. msi-ranges names the AIC input of global vector apple,msi-vector-base, and the window is linear, so args[1] - apple,msi-vector-base is the base. On J813 every node gives 1741 (internal 1741 at 0, front 1837 at 96, rear 1869 at 128). msi_aic_base and the ECAM-keyed expected_base switch only re-derive that from a table, and #2178 is about to add a third constant.

Concretely, for the T8132/T8142 branch:

  1. Read apple,msi-vector-base first.
  2. Check the slice structurally: 32 vectors, 32-aligned, above the internal port's vectors, within FIELD_MAX(PORT_MSIMAP_TARGET) + 1, edge-rising SPI, args[1] >= base.
  3. Drop msi_aic_base and the ECAM table.

No binding change is needed: both properties are already required for t8142 PCIe-C. If you want the cross-node check, "all PCIe nodes agree on msi-ranges[1] - apple,msi-vector-base and the slices are disjoint" fits apple-dt-check better than the driver. T6030/T6040/T6050 can follow in a separate PR.

Two merge gates besides that:

  • Rerun CI: both runs on 4ed06b3 were cancelled by the runner, not failed.
  • The usb4-1-pcie alias needs aura#302, which is still open, and the qualified boot used the underscored alias with an older aura. Please post one boot of this exact DTB with an aura that has #302: link up, and the PCIe-C tunables present under the apciec1 node.

Minor, non-blocking: thunderbolt/apple.c keys three behaviours on acio->hw == &apple_cio_t8142_hw (4011, 4257, 4742). Named flags in apple_cio_t8142_hw would carry to the next SoC more easily.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for adee45b. Taking the AIC base from the match data and selecting the branch by pcie->hw covers the point we raised.

@sithglan
sithglan force-pushed the thomas/j813-usb4-native branch from 4ed06b3 to 13483df Compare November 19, 2026 19:48
@sithglan

Copy link
Copy Markdown
Contributor Author

Thanks. All three points are done. The head is now 13483df0aa7f.

AIC base from the DT (56cecd6de922). T8132 and T8142 now have their own branch in apple_msi_init():

  1. It reads apple,msi-vector-base first.
  2. It checks the slice by shape alone: a three-cell edge-rising SPI, args[1] >= base, then apple_t6030_msi_slice_valid() with args[1] - base as the window base. That means 32 vectors, 32-aligned, at or above 0x20, and base + count <= 256.

msi_aic_base and the ECAM table are gone. That also removes T8132's old of_machine_is_compatible("apple,t8132") table and its 1506. Its two trees still pass: 1602 − 0x60 = 1634 − 0x80 = 1506. T6030/T6040 keep their branch, for a separate PR. #2178 now uses the same branch for T8152 instead of adding a third constant.

Named flags (caf9ba025e07). apple_cio_t8142_hw now sets sleep_removes_domains, restart_on_wake and phy_shared_with_dwc3, and the three acio->hw == &apple_cio_t8142_hw comparisons test those instead. The PM-order host test models the flag, and its reversed-priority negative control still fails as it should.

CI and the aura#302 boot.

  • The push re-triggered CI. Locally, run-host-tests.py passes 427/427, and apple-dt-check.sh against the base gives 0 new warnings with both changed bindings OK.
  • Boot of this DTB on the J813 with aura 8b9c92ea (the enrolled build) + aura#302 a38b80cbd6, chainloaded in place (1.0.0b12-g2074ae7e in /chosen). The kernel is the arm64: dts: apple: enable the J813 front USB4 port #2238 head, whose rear-port DT is this PR's. Enclosure on the rear port:
    • apple,tunable-rc, apple,tunable-fabric and apple,tunable-debug are present under /pcie-tunnel-1/pcie@1c60000000, and under /pcie-tunnel-0/... too.
    • The router links at 20 Gb/s × 2, then pcie-apple 1c60000000.pcie: Link up. nvme1n1 (Samsung 980 PRO) comes up with 10 MSI-X queues through the new slice check.
    • A 4 GiB O_DIRECT read runs at 2.9 GB/s, and the 64 MiB checksum at offset 0 matches the qualified one (b12e3997…).
  • Control with the enrolled aura (no drm/apple: dcp: let a Type-C port with HPD take over a pipeline held without it #302), same kernel and DTB: PCIe-C tunnel disabled: not initialized by m1n1 or the kernel on both routers, and the enclosure enumerates as a 10G USB disk. So the hyphenated alias really does need drm/apple: dcp: let a Type-C port with HPD take over a pipeline held without it #302.

@sithglan

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr could you take another look when you have a moment? Your remaining point, taking the AIC base from the DT, is in 56cecd6de922 (head 13483df0aa7f): apple_msi_init() reads apple,msi-vector-base and checks the slice by shape, with no driver-side base. CI is green, and the J813 boot with aura#302 is posted above. If that covers it, the CHANGES_REQUESTED review can be resolved.

@RyanTheTide

Copy link
Copy Markdown
Contributor

For the aura side this PR depends on: our J616s (T6040) row with aura#302 is at aurora-silicon/aura#302 (comment). With #302 the production aura's three Unable to find alias usb4_N_pcie lines are gone and the DT carries 25 PCIe apple,tunable* properties instead of 13. The same boot was Enforcing, 0 kernel errors, 14/14 CPUs, s2idle 3/3, encodes identical, 0 DART faults. Together with your J813 boot above, that covers #302 on both a T8142 and a T6040.

At 13483df, T6040 keeps its own apple_msi_init() branch (the ECAM-keyed one, unchanged), and the new CIO behaviour only applies through the flags set in apple_cio_t8142_hw. So our M4 Pro is not on the changed path.

@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.

Thanks, Thomas. All three points from my 11-19 review are done at 13483df:

  • The AIC base comes from the DT. The T8132/T8142 branch of apple_msi_init() checks the slice by its shape alone: three-cell edge SPI, args[1] >= apple,msi-vector-base, then apple_t6030_msi_slice_valid(). msi_aic_base and the ECAM table are gone, and so is T8132's of_machine_is_compatible(). Both T8132 trees carry apple,msi-vector-base (0x60 and 0x80), so they pass the new check with the same 1506 window base.
  • Named flags in apple_cio_t8142_hw replace the three acio->hw == comparisons.
  • The aura#302 boot and the control without it are posted, and CI is green.

No T8142 board other than the J813 enables an ACIO node, so the new router start and sleep handling reach only this rear port.

One problem shows up only when the PR is merged with the current tip. 4c72367 ("thunderbolt: apple: T6050: keep a port up for a freeze while deep is the default") landed on integration/aurora after your base. It adds if (pm_suspend_no_platform()) return false; to apple_cio_sleep_tears_down(). A three-way merge puts your new early return ahead of it:

if (READ_ONCE(s2idle_teardown) || apple_cio_sleep_removes_domains(acio))
	return true;
/* A "freeze" is a suspend-to-idle with deep as the default too: the port stays up. */
if (pm_suspend_no_platform())
	return false;

apple_cio_sleep_removes_domains() only checks !pm_suspend_default_s2idle(). So on a J813 with deep as the default, a freeze would still tear down the rear port. Because mode is forced to 1, it would also refuse the freeze when a disk is open, although a freeze removes no CIO domain. The t6050 || apple_cio_sleep_removes_domains(acio) wait in apple_cio_sleep_teardown() gets the same answer.

The fix is one line once rebased:

return acio->hw->sleep_removes_domains && !pm_suspend_default_s2idle() &&
       !pm_suspend_no_platform();

Please rebase onto the tip with that, and it merges as soon as CI is green.

Non-blocking: in apple_cio_sleep_teardown() the local is still called t8142. Something like removes would match the flag.

These rows come after the merge, with a revert ready:

  • your clean-build replug matrix;
  • one freeze (echo freeze > /sys/power/state) with the enclosure attached and a disk open, to show the port stays up;
  • an M4 mini (T8132) boot with a USB4 NVMe enclosure, since T8132 moved to the new slice check.

@sithglan
sithglan force-pushed the thomas/j813-usb4-native branch from 13483df to a5c9b6e Compare November 20, 2026 12:41
@sithglan

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr thanks, done. The head is now a5c9b6e14273, rebased onto integration/aurora f44bf7af65ea, which has 4c72367.

The freeze fix, in "thunderbolt: apple: support T8142 router startup and deep sleep":

return acio->hw->sleep_removes_domains && !pm_suspend_default_s2idle() &&
       !pm_suspend_no_platform();

A freeze therefore removes no CIO domain on the J813 either. apple_cio_sleep_tears_down() now reaches the freeze check and answers no, so the rear port stays up and an open disk isn't refused. The forced mode and the wait in apple_cio_sleep_teardown() follow the same helper. On this tree enter_state() sets the no-platform flag before suspend_prepare(), so the PM_SUSPEND_PREPARE notifier already sees it. The function's comment and the commit message now say that a freeze keeps the port up.

Non-blocking: the local in apple_cio_sleep_teardown() is now removes.

git range-diff against 13483df0aa7f:

  • the three other commits are =;
  • the thunderbolt commit differs only in the four lines above, the comment and the commit message.

Checks on this head:

  • drivers/thunderbolt/ and drivers/pci/controller/ build with W=1 and no warnings, and the full arm64 kernel and DTBs build.
  • checkpatch --strict: no errors or warnings in the code. The only note is the usual MAINTAINERS reminder on the binding.
  • tools/asahi/run-host-tests.py: 449 of 450. The one failure is pmp-floor-tests --mutant class-twice: that mutant doesn't compile with the host's GCC 16 (-Wunused-but-set-variable), and this series doesn't touch the PMP code.

#2238 is restacked on this head; its front-port commit is unchanged (range-diff =).

For the rows after the merge: the USB4 enclosure is on the M6 at the moment. I'll post the replug matrix and the freeze with a disk open once it's back on the J813.

@sithglan

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr the enclosure is back on the J813. I ran your after-merge rows now, on this exact head a5c9b6e14273.

Setup:

  • aura: main 3efa4a81, which includes drm/apple: dcp: let a Type-C port with HPD take over a pipeline held without it #302, chainloaded in place. The same boot gives the aura#302 post-merge row.
  • Kernel and DTB: this PR's, with the J813's default config.
  • Enclosure: UGREEN ASM2464PD with a Samsung 980 PRO, on the rear port.
  • Tunnel: usb4-1-pcie carries the three PCIe tunables, the router links at 20 Gb/s × 2, and nvme1n1 has 10 I/O queues.

Freeze with a disk open:

  • Setup: deep is the default (mem_sleep = s2idle [deep]), and /dev/nvme1n1 is held open.
  • Result: echo freeze > /sys/power/state returns 0, and suspend_stats goes from success 0 to 1 with no failures. A key press woke it after about 2.5 min.
  • Between PM: suspend entry (s2idle) and PM: suspend exit: no refusal, no domain removal and no port power-off. Only the NVMe driver's own resume re-initialises its queues.
  • After the wake: the disk is the same device (.../409ac0000.acio/1c60000000.pcie/.../nvme1/nvme1n1), with no re-enumeration. The checksum matches, and the 4 GiB read runs at 3.0 GB/s.

Physical replug matrix (rear port, same boot):

Step Back as Link 64 MiB checksum 4 GiB O_DIRECT
Idle unplug and replug nvme1n1, 10 queues 20 Gb/s × 2 b12e3997… 3.2 GB/s
Unplug during an O_DIRECT read nvme1n1, 10 queues 20 Gb/s × 2 b12e3997… 3.3 GB/s
Unplug with /dev/nvme1n1 held open nvme2n2, 10 queues 20 Gb/s × 2 b12e3997… 3.2 GB/s
Plug flipped nvme1n1, 10 queues 20 Gb/s × 2 b12e3997… 3.1 GB/s
  • Under a read: the read ends with dd: error reading '/dev/nvme1n1': Input/output error and nothing else.
  • Held open: the open handle keeps the old nvme1n1 as a deleted node, so the replugged disk comes up as nvme2n2. Closing the old handle afterwards logs nothing.
  • Kernel log: no Oops, WARNING, BUG or hung-task lines on the whole boot.

T8132: I don't have an M4 mini for the T8132 row. @RyanTheTide, could your team run one with a USB4 NVMe enclosure when this merges?

The front port, with an aura that has #302, is on #2238.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for running the freeze and replug rows on a5c9b6e.

On the T8132 row: we don't have an M4 mini, but we do have an M4 MacBook Air (J713), which is the same T8132 and goes through the same apple,msi-vector-base slice check. We'll boot it on this head after the merge with a USB4 NVMe enclosure on a USB-C port, check that the tunnel and the MSI window come up as before, and post the result here.

@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora d1b022dc34fb (Ryan's tidy-up on #1799). The new head is b28768e3debc. The only conflict was the J813 DTS include, which now follows integration's Touch ID and tipd nodes. 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 b28768e: a rebase only. The three driver commits are unchanged, and the DTS commit differs only in where the t8142-j813-usb4.dtsi include sits, now after integration's &hpm1 node (t8142-j813.dts:297). Our view stands. We will post the J713 (T8132) row for the apple,msi-vector-base path after the merge, as planned.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide on the AP firmware tuning point from #2238: this PR now ends with 79afc9215ab4 "thunderbolt: apple: require the router AP firmware tuning with its window". A node that describes the router-ap-fw window but lacks apple,tunable-router-ap-fw now fails the probe, as a missing apple,tunable-rc does. All trees that describe the window today provide the property, in the tree or from aura. The four earlier commits are unchanged. W=1 build, checkpatch --strict and host tests (461/461) are clean. Details: #2238

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 79afc92. A node that describes the router-ap-fw window but has no apple,tunable-router-ap-fw now fails the probe, the same way a missing RC tuning does. That fits "no machine value, no feature": nothing runs untuned silently anymore. I checked the commit message's claim by preprocessing the trees at this head. The J714s and K114c routers carry the property (t6050-max-atc2-router.dtsi). The J716s, J775c and J873s outputs have no router-ap-fw window at all. The J813 front port gets the property from aura#435. So nothing that probes today hits the new error. The four earlier commits are unchanged (range-diff). Approving from my side. The J713 MSI-slice row is still ours.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j813-usb4-native branch from 79afc92 to f3415a2 Compare November 22, 2026 20:30
@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora 95a13cf. The head is f3415a2, and only the two conflicts below changed.

  • tools/asahi/pciec-policy-tests.py: integration moved the case loop into run_cases() and added the s2idle cases. This PR's test_pm_order() and its t8142-admission control now run through that helper.
  • t8142-j813.dts: integration appended the J813 thermal zones where this PR appends #include "t8142-j813-usb4.dtsi". The include now follows the zones.

Commits 1 and 5 are identical. 2-4 differ only by these resolutions and their context (range-diff checked).

Checks at this head:

  • W=1 arm64 build of drivers/thunderbolt/, pcie-apple.o and the J813 DTB: clean.
  • pciec-policy-tests.py: pass, including the T8142 PM-order check and all negative controls.
  • run-host-tests.py router/usb4/pciec: pass.
  • apple-dt-check.sh against the base: 0 new warnings, both changed bindings OK.
  • DART power-domain lint: 0 new.
  • checkpatch: unchanged from the previous head.

No new J813 row, because the M5 is not available right now. The code is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of f3415a2: a rebase only. Commits 1 and 5 are the same patches, and 2-4 differ only by the run_cases() and thermal-zone resolutions (range-diff checked). The rebase also brought in the new s2idle_hold_domain/prepare refusal for PCIe-C, but that only applies to hosts with a CIO DART bound, which T8142 is not, so J813 sleeps as before. The approval stands, and the J713 MSI-slice row is still ours after the merge.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr could you take another look and clear your change request? It is from 11-20, and everything in it was done the same day:

  • The freeze fix is in "thunderbolt: apple: support T8142 router startup and deep sleep": apple_cio_sleep_removes_domains() returns acio->hw->sleep_removes_domains && !pm_suspend_default_s2idle() && !pm_suspend_no_platform(), so a freeze removes no CIO domain on the J813 with deep as the default.
  • Your after-merge rows on the J813 with the enclosure are posted (2026-11-20 20:02).
  • The non-blocking rename: the local is removes, matching the flag.

The head is f3415a2, a rebase only since then (Ryan range-diffed it; his approval stands). All three checks pass (dt-checks, host-tests, kunit), and it merges cleanly on integration/aurora b10280c. #2238 merges right after it.

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Formal §1–§6 pre-PR review on f3415a28a01985f4945939f0ecf09bf609387875:

The driver changes (7538f745faa0, f9b070b6b012, b0e95f9647f2, f3415a28a019) read cleanly — DT-derived MSI slice validation for T8132/T8142, named apple_cio_hw flags, the pm_suspend_no_platform() freeze fix, and fail-closed apple,tunable-router-ap-fw validation are solid, and all 5 commits have clean human Signed-off-by: trailers (§4) with green CI (dt-checks, host-tests, kunit).

Two concrete blockers remain before merge:

  1. §3 / §4 — Remove hardcoded Apple ADT tuning tables from arch/arm64/boot/dts/apple/t8142-j813-usb4.dtsi (53395d36661a):

    • t8142-j813-usb4.dtsi still hardcodes apple,tunable-router-ap-fw = <0x8 0xff2 0x482> on acio1 (line 220) and 22 rows of apple,tunable on acio1_dart (lines 251–272) with the stale comment /* ACIO DART tunables are not supplied by the bootloader. */.
    • Both aurora-silicon/aura#302 and aurora-silicon/aura#435 are now merged, so aura supplies both properties from the machine's ADT (just as #2238 already relies on for acio0 / acio0_dart).
    • Keeping these Apple ADT values in-tree violates §4/§3 and defeats commit 5 (f3415a28a019) on the rear port itself (an older loader without aura#435 will probe acio1 using the hardcoded table instead of failing closed). Please drop both in-tree tables from acio1 and acio1_dart.
  2. §5 — Live-hardware verification on the exact final head with full regression tuple:

    • Commit 5 (f3415a28a019) and the rebase onto 95a13cf618b1 have not been booted on J813 yet ("The new check hasn't run on hardware", "No new J813 row").
    • The earlier a5c9b6e14273 run predates commit 5 and omits the required §5 regression checks (SELinux mode + 0 AVC denials, 0 failed units, and explicit kernel error check / kernel build version).
    • After removing the hardcoded acio1 / acio1_dart tunables (and rebasing onto current integration/aurora), please post a J813 boot row on the exact live head with aura carrying #302 + #435 confirming: acio1 and acio1_dart receive their tunables from aura, rear USB4 NVMe + open-disk freeze + sleep/replug pass, and the full §5 regression tuple (exact head SHA, hardware, kernel/build, SELinux mode, 0 AVC denials, 0 failed units, 0 new kernel errors).

Note (§1 cross-SoC): T8132 shares the reworked apple_msi_init() branch; please also keep the planned J713 / T8132 regression check tracked.

Assisted-by: LLM (Gemini 4 Neon)

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.

The DT carries no tunable values. The bootloader fills the router's, the
AP firmware one included, through usb4-1-acio, the PCIe-C ones through
usb4-1-pcie, and the router DART's through its generic DART copy, which
finds the DART by its translated address (aurora-silicon/aura#435).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…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>
@sithglan
sithglan force-pushed the thomas/j813-usb4-native branch from f3415a2 to a42e7dc Compare November 23, 2026 21:14
@sithglan

sithglan commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr thanks. Blocker 1 is done. Blocker 2, the J813 row, needs a boot with the enclosure and follows.

1. No tunables in the tree. Head a42e7dccf46c, rebased onto integration/aurora 70a00e583b03.

  • The DTS commit (26f3957815d2) no longer carries apple,tunable-router-ap-fw on acio1, or the 22 apple,tunable rows on acio1_dart.
  • The rear port now gets them the way arm64: dts: apple: enable the J813 front USB4 port #2238's front port does:
    • the router's, the AP firmware one included, through usb4-1-acio;
    • the DART's through aura's generic DART copy, which finds the DART by its translated address (aura#435).
  • The commit message says so. With a loader older than mux: apple-display-crossbar: T6041 (M4 Pro/Max) per-ATC crossbar #435, commit 5 now refuses the acio1 probe ("Missing bootloader router AP firmware tuning") instead of running the port untuned.
  • git range-diff: commits 1, 2, 3 and 5 are =; only the DTS commit changed.
  • Local apple-dt-check.sh against the new base: 0 new and 0 removed warnings on 138 DTBs. Both changed bindings pass.

2. J813 row on this exact head. Its kernel (integration/aurora 70a00e583b03 + a42e7dccf46c) is being built. The row needs:

It will cover the tunables reaching acio1 and acio1_dart from aura, the rear USB4 NVMe tunnel with checksums, the open-disk freeze refusal, and sleep plus replug. It will also give the full tuple: head, kernel build, SELinux mode, AVC denials, failed units and new kernel errors.

The J713 / T8132 MSI-slice check stays tracked; Ryan's team runs it.

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Formal §1–§6 pre-PR re-review on a42e7dccf46cb5f24b8b886dcfaa0f78ed58ef28:

Wave 89E Blocker Verification

  1. §3 / §4 — Hardcoded Apple ADT tuning tables in arch/arm64/boot/dts/apple/t8142-j813-usb4.dtsi: Resolved. Commit 26f3957815d2 removes both apple,tunable-router-ap-fw on acio1 and the 22 apple,tunable rows on acio1_dart; zero in-tree tunable values remain, aurora-silicon/aura#302 (18a4797f) and aurora-silicon/aura#435 (f1daef3e) are both merged, and commit a42e7dccf46c fails closed (-EINVAL, "Missing bootloader router AP firmware tuning") if an older loader omits the property.
  2. §5 — Live-hardware verification on the exact final head with full regression tuple: Still open (blocker).
    • Exact head a42e7dccf46c (with the in-tree acio1/acio1_dart tunables removed, commit 5's fail-closed apple,tunable-router-ap-fw check, and the rebase onto 70a00e583b03) has not yet been booted on J813 ("The boot rows below predate this and used the in-tree values; the row on this head is pending").
    • Once your in-progress J813 build + UGREEN rear-port run with aura carrying #302 + #435 completes, please post the row confirming: acio1 and acio1_dart receive their tunables from aura, rear USB4 NVMe tunnel + checksums + open-disk freeze + sleep/replug pass, and the full §5 regression tuple (exact head SHA, hardware, kernel/build, SELinux mode, 0 AVC denials, 0 failed units, 0 new kernel errors).

Checklist Summary (§1–§6)

  • §1 (No model gating): Pass — DT-derived MSI slice check for T8132/T8142 and named apple_cio_hw flags (T8132 J713 regression check remains tracked).
  • §2 (Production-ready / default cmdline): Pass.
  • §3 (Safety): Pass — tunables come from the machine via aura#302/#435, and missing apple,tunable-router-ap-fw fails closed.
  • §4 (Clean-room & attribution): Pass — all 5 commits carry human author/committer and human Signed-off-by: only (zero AI trailers in commits), no Apple ADT tuning values remain in-tree, and the PR body discloses Assisted-by:.
  • §5 (Evidence): Blocked on the pending J813 live-hardware row on a42e7dccf46c (and dt-checks CI finishing green; host-tests and kunit have already passed).
  • §6 (Naming): Pass.

Non-blocking Nit

  • Commit 5 (a42e7dccf46c) message still says "the T6050 host routers and the J813 rear port in the tree"; if you touch the branch again, update it to reflect that the J813 rear port now gets the property from aura as well.

Assisted-by: LLM (Gemini 4 Neon)

@sithglan

sithglan commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

J813 row on the exact head a42e7dccf46c (integration/aurora 70a00e583b03 + this PR), Ugreen enclosure (Samsung 980 PRO 2 TB) on the rear port.

Setup

result
acio1 tunables from aura apple,tunable-router-ap-fw = <0x8 0xff2 0x482>; tunable-rc 30 rows, tunable-pcie-adapter 1, tunable-nhi 99
acio1_dart tunables from aura 22 rows, the same 66 words as the in-tree table this PR removed; the DART reports "22 tunables" at probe
Tunnel 20 Gb/s x2, NVMe with 11 queues, 64 MiB O_DIRECT checksum 2fde66fde2fbe490, 4 GiB direct read at 3.3 GB/s
Open-disk freeze (s2idle, disk held open) returns OK; same device path, same checksum, 3.3 GB/s after (on this kernel with aura main 29739131, earlier the same evening)
Deep sleep 8 s (PMU alarm wake) woke after 8.6 s; enclosure reconnected, same checksum, 3.2 GB/s
Deep sleep 20 s woke after 20.5 s; same checksum, 3.3 GB/s
Software replug (unbind and rebind of the rear PD controller, sn201202x 1-0a) link down, back after 8 s; router restarted with the PCIe adapter tunable; same checksum, 3.3 GB/s

Fail-closed check (negative control): the same kernel booted by the J813's enrolled aura, which has neither #302 nor #435:

  • thunderbolt-apple-acio 409ac0000.acio: error -22: Missing bootloader router AP firmware tuning, then PCIe-C tunnel disabled;
  • the enclosure isn't tunnelled.

Counts on the row boot: 0 failed units, 0 AVC denials (SELinux not enabled), 0 new kernel error lines against the default boot, 0 DART faults.

Not in this row: a physical replug; nobody was at the Mac. The physical replug matrix (idle, under read, disk open, flipped) ran on 11-20 on that day's head a5c9b6e14273, before commit 5 and before the tunables moved to aura. The software replug above restarts the same port path on this head, but a physical one on this head is still owed.

The front port (#2238) follows once the enclosure is moved there.

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