Skip to content

usb: typec: tipd: take a USB4 router that binds after the port - #855

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/cd321x-late-tbt-router
Nov 2, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/cd321x-late-tbt-router

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

A Thunderbolt dock on an Aurora Fedora install with an encrypted root comes up as USB 2.0 hubs only, whether it is attached at boot or plugged in later. There is no NHI, no PCIe tunnel, no USB 3 and no DP tunnel. The same dock works on the same Mac's Arch install. This PR makes the CD321x/SN201202x port take its USB4 router when the router driver binds after the port has given up on it.

Root cause

Measured on a J414s (M2 Pro, t6020) with kernel-aurora 7.3.0-11 (journalctl -b -1, the dock plugged in at runtime) and 7.3.0-12 (-b 0, the dock attached at boot).

  1. Fedora's dracut-asahi puts tps6598x in the initramfs (91kernel-modules-asahi, "For USB") so USB keyboards work at the LUKS prompt. lsinitrd of both images lists tps6598x.ko, tps6598x-core.ko and sn201202x.ko, and nothing under kernel/drivers/thunderbolt/.
  2. While the passphrase prompt waits, nothing binds. The deferred probe timeout fires ten seconds after the last bind, and cd321x_tbt_switch_get() gives up on the router for the rest of the boot:
    -b -1 [ 14.325] tps6598x 0-003b: USB4/Thunderbolt router unavailable, continuing without it
    -b -1 [ 14.326] apple-pmgr-pwrstate ...power-controller@298: sync_state() pending due to f01ac0000.cio
    -b -1 [ 31.156] systemd[1]: Switching root.
    
    The sync_state() pending lines come from fw_devlink at the same timeout. They show that all three *.cio devices still had no driver at that point.
  3. thunderbolt_apple loads from the root filesystem after switch-root and registers 701ac0000.cio-thunderbolt-switch, b01ac0000.cio-thunderbolt-switch and f01ac0000.cio-thunderbolt-switch. ACIO's probe logs nothing, so the bind time is bounded rather than logged. On -12 it falls between switch-root at 32.66 s and udev's first lookup of /sys/module/thunderbolt_apple at 33.77 s.
  4. No port ever takes a router after that. Each successful fwnode_typec_thunderbolt_switch_get() holds a reference on the router's module (mux.c:839), and on the running -12 boot /sys/module/thunderbolt_apple/refcnt is 0.
  5. A Thunderbolt or USB4 cable then never reaches ACIO, at boot or at any later plug. cd321x_typec_update_mode() sets the mux to TBT and calls typec_thunderbolt_switch_set(NULL, ...), which returns 0 without calling anything (mux.c:881). apple_cio_start() is the only code that creates the NHI child (of_platform_populate(acio->np), apple.c:2687), and its only caller is the router switch's set callback (apple.c:2977). So no NHI platform device ever exists: /sys/bus/platform/devices has no *.nhi, and f01ac0000.cio has no child device even though the DT has cio@f01ac0000/nhi@f00000. With no NHI there is no domain, so /sys/bus/thunderbolt/devices stays empty. ACIO's M3 never boots, so its RTKit firmware logs nothing. The TBT altmode is active (port3.1 svid 8087), so the SuperSpeed lanes are given to TBT and only the USB 2.0 pair works.
  6. In the -11 boot the dock went in at 242.6 s, long after switch-root. It enumerated as USB2.0 Hub, Parade Tech Billboard and so on on the 480M bus, and ACIO logged nothing. Plugging in at runtime fails for the same reason as at boot: the port has had no router since 14.3 s.

The Arch install on the same Mac has no LUKS and switches root at about 2 s. Its journal shows f01ac0000.cio booting the ACIO firmware (#ACIO FW IS READY#) and f01f00000.nhi binding on each attach, with the same driver code.

Fix

  • typec: typec_thunderbolt_switch_watch() and _unwatch() add a blocking notifier that fires with TYPEC_THUNDERBOLT_SWITCH_ADDED after a USB4/Thunderbolt switch registers.
  • tipd: when the probe-time lookup gives up, cd321x_tbt_switch_get() now reports it through *late, and the port starts watching. On each registration the port queues a lookup from a work item, because the notifier runs under ACIO's probe lock. If the lookup finds this port's router, the work takes the switch, registers the existing health notifier and raises the existing RESTORE event. That event clears state_valid, rereads the controller and reapplies TBT/USB4 mode through the router, the same path system resume uses. A dock attached since boot comes up without a replug, and every later plug goes to ACIO through the switch the port now holds.
  • The watch starts after the probe lookup, and one more lookup is queued right after it, so a router that registers in between is not missed. cd321x_stop_work() unwatches and drains the lookup before it unregisters the notifier, and cd321x_unregister_port() drops the fwnode reference.

Power delivery, USB and DisplayPort alt mode still start without waiting for the router, so the initramfs keyboard keeps working.

The initramfs side keeps the router from being late in the first place: aurora-silicon/fedora-aurora#128, aurora-silicon/alarm-aurora#100, aurora-silicon/nixos-aurora#104. Omarchy already loads thunderbolt_apple early.

Testing

  • KUnit, arm64 under QEMU (virt, -cpu max): all 111 tipd tests pass, 8 of them in cd321x-tbt. Four are new: late bind, router registered before the watch, another port's router, and removal before the router binds. I ran them a second time with PROVE_LOCKING, KASAN, DEBUG_OBJECTS_WORK and DEBUG_ATOMIC_SLEEP: 111/111 and no warnings.
  • W=1 build of drivers/usb/typec/ and drivers/thunderbolt/ with the kernel-aurora config plus KUnit: no new warnings.
  • Hardware: not run yet. The J414s is shared, and installs and reboots need scheduling. The device test uses this commit cherry-picked onto aurora-wip e1524e6 (branch fix/cd321x-late-tbt-router-wip, one prototype-list conflict in tps6598x.h), built as replacement typec/tipd modules for the installed 7.3.0-12.

Hardware test plan (J414s, LUKS root)

  1. Before installing anything, on stock -12, rebind only the dock port's controller now that the router exists (0-003b). With ACIO idle this tears down no tunnel, and cd321x_reset() does not reset the PD controller. A rebind should take the router, raise the module refcount to 1 and start ACIO for the attached dock. This confirms the root cause and that ACIO, NHI and PCIe work on Fedora without any change.
  2. Install the patched modules, boot, and leave the passphrase prompt waiting more than 15 s. Expect the give-up at about 14 s, then USB4/Thunderbolt router bound, reapplying the cable state after switch-root. The attached dock should then show ACIO firmware boot, a bound *.nhi, boltctl devices, its hubs on the 10000M bus, PCIe devices behind the tunnel and its display.
  3. Unplug the dock and plug it back in at runtime. The same checks apply.
  4. Suspend and resume with the dock attached.
  5. With the initramfs change (Mac Studio · M3 family #128) on top, the boot never logs the give-up.

Macs covered

The installer catalog allows the M1, M2 and M3 families and the J700 (apple,j614s is refused). Every M1, M2 and M3 SoC DT here (t8103, t600x, t8112, t602x, t8122, t6030, t6031) links its connectors to an ACIO router, and both CD321x and SN201202x go through cd321x_register_port(). All of them hit this bug whenever the initramfs carries tipd but not the router and the boot waits more than 10 s, and all of them get the fix. Only the J414s has been measured.

The J700 DTs (t8140.dtsi, t8140-j700.dts) have no ACIO, USB4 or thunderbolt-switch node. Its two SN201202x ports never wait for a router, and a Thunderbolt dock gets only what it offers over plain USB-C. This patch does not change that. It should be documented as a J700 limitation until a USB4 router exists there.

Follow-ups outside this PR

  • kernel-aurora 7.3.0-12 pins aurora-wip e1524e6, so the Fedora package needs this merged into aurora-wip, then a release bump.
  • The shared linux-build VM's rustc cannot start (libLLVM.so.23.1 missing next to llvm-libs 22.1.8), so CONFIG_RUST=y kernels do not build there. I built the test artifacts with Rust off.

🤖 Generated with Claude Code

A CD321x port waits for its USB4/Thunderbolt router only until the
driver core stops waiting for missing dependencies, ten seconds after
the last driver bound. After that it continues without the router for
good: a Thunderbolt or USB4 dock still enters TBT mode on the Type-C
side, but ACIO is never started, the NHI is never populated and only
the dock's USB 2.0 hubs appear.

Fedora's initramfs carries tps6598x for USB keyboards at an encrypted
root's passphrase prompt, but not thunderbolt_apple. While the prompt
waits, the deferred probe timeout fires and the ports give up; the
router module loads from the root filesystem twenty seconds later and
registers its switches with nobody to take them. On a J414s with LUKS:

  [14.308] tps6598x 0-003b: deferred probe timeout, ignoring dependency
  [14.308] tps6598x 0-003b: USB4/Thunderbolt router unavailable, continuing without it
  [31.156] systemd[1]: Switching root.

The same machine's Arch install, without LUKS, switches root at 2 s and
its docks work.

Keep a port that gave up on its router watching for it. The typec core
now notifies watchers when a USB4/Thunderbolt switch registers; the port
looks its router up again, takes the switch and reapplies the current
cable through it with the restore event used after system sleep, so a
dock attached since boot gets its tunnels too. The watch starts after
the probe-time lookup and is followed by one lookup of its own, so a
router that registers in between is not missed. Removal stops the
watch and drains a pending lookup before it releases the switch.

Assisted-by: Claude Opus 5.5
Signed-off-by: DjDeveloperr <[email protected]>
@DjDeveloperr
DjDeveloperr force-pushed the fix/cd321x-late-tbt-router branch from 4504900 to 6c3055b Compare November 2, 2026 12:10
@DjDeveloperr
DjDeveloperr merged commit 86cb1c3 into integration/aurora Nov 2, 2026
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
Bring integration/aurora up to aurora-wip 437edfa, the source of the
7.3.0-aurora-fleet14b kernel that was promoted on the M1 Pro, M2, Neo
and J616s on 2026-11-01. This takes the aurora-wip work since the
two branches diverged, including the 2026-11-01 sync of
integration/aurora into aurora-wip (aurora-silicon#761), up to and including aurora-silicon#764.

integration/aurora had two changes aurora-wip lacked at this point:
the tipd late USB4 router fix (aurora-silicon#855) and SEP keybag creation in the
shared xART window (aurora-silicon#856). aurora-wip carries the same patches as aurora-silicon#858
and aurora-silicon#860, which come in with a later batch. Two conflicts, both where
the two sides added lines next to each other: the KUnit prototype list
in tps6598x.h (both kept, in aurora-silicon#858's order) and the aurora-sep PKGBUILD
checksums (recomputed from the merged files; they match aurora-silicon#860's). The
merged tree is identical to aurora-wip 437edfa with the aurora-silicon#858 and aurora-silicon#860
patches applied.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
…nto integration/aurora

Bring integration/aurora up to the aurora-wip tip 9ff2b9a. After this
merge the two branches have the same tree.

The range contains the fleet14o source c243830 (aurora-silicon#857, aurora-silicon#858, aurora-silicon#795,
aurora-silicon#859), which was promoted on all four machines on 2026-11-02 and 03, and
the merges after it: aurora-silicon#861 (apple-dcp selftest stubs for aurora-silicon#858), aurora-silicon#860
(SEP keybag in the shared xART window, the aurora-wip copy of aurora-silicon#856),
aurora-silicon#724 (J616s boot NOR, both parts), aurora-silicon#779 (ALS colour temperature ABI),
aurora-silicon#862 (J700 GD25UF16E boot NOR, the Neo bless fix), aurora-silicon#863 (J616s ANE H16
start stall), aurora-silicon#797 (T6000 DCS whole-word writes) and aurora-silicon#803 (G17 keeps
innocent clients alive across another client's recovery).

aurora-silicon#858 and aurora-silicon#860 make the same changes integration/aurora already had as
aurora-silicon#855 and aurora-silicon#856, so they merge without conflicts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the fix/cd321x-late-tbt-router branch November 7, 2026 12:06
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.

1 participant