Repository navigation
usb: typec: tipd: take a USB4 router that binds after the port - #855
Merged
Merged
Conversation
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
force-pushed
the
fix/cd321x-late-tbt-router
branch
from
November 2, 2026 12:10
4504900 to
6c3055b
Compare
This was referenced Nov 2, 2026
This was referenced 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).dracut-asahiputstps6598xin the initramfs (91kernel-modules-asahi, "For USB") so USB keyboards work at the LUKS prompt.lsinitrdof both images liststps6598x.ko,tps6598x-core.koandsn201202x.ko, and nothing underkernel/drivers/thunderbolt/.cd321x_tbt_switch_get()gives up on the router for the rest of the boot:sync_state() pendinglines come from fw_devlink at the same timeout. They show that all three*.ciodevices still had no driver at that point.thunderbolt_appleloads from the root filesystem after switch-root and registers701ac0000.cio-thunderbolt-switch,b01ac0000.cio-thunderbolt-switchandf01ac0000.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_appleat 33.77 s.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/refcntis 0.cd321x_typec_update_mode()sets the mux to TBT and callstypec_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'ssetcallback (apple.c:2977). So no NHI platform device ever exists:/sys/bus/platform/deviceshas no*.nhi, andf01ac0000.ciohas no child device even though the DT hascio@f01ac0000/nhi@f00000. With no NHI there is no domain, so/sys/bus/thunderbolt/devicesstays empty. ACIO's M3 never boots, so its RTKit firmware logs nothing. The TBT altmode is active (port3.1svid 8087), so the SuperSpeed lanes are given to TBT and only the USB 2.0 pair works.USB2.0 Hub,Parade Tech Billboardand 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.ciobooting the ACIO firmware (#ACIO FW IS READY#) andf01f00000.nhibinding on each attach, with the same driver code.Fix
typec_thunderbolt_switch_watch()and_unwatch()add a blocking notifier that fires withTYPEC_THUNDERBOLT_SWITCH_ADDEDafter a USB4/Thunderbolt switch registers.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 clearsstate_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.cd321x_stop_work()unwatches and drains the lookup before it unregisters the notifier, andcd321x_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_appleearly.Testing
virt,-cpu max): all 111 tipd tests pass, 8 of them incd321x-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 withPROVE_LOCKING,KASAN,DEBUG_OBJECTS_WORKandDEBUG_ATOMIC_SLEEP: 111/111 and no warnings.W=1build ofdrivers/usb/typec/anddrivers/thunderbolt/with the kernel-aurora config plus KUnit: no new warnings.fix/cd321x-late-tbt-router-wip, one prototype-list conflict intps6598x.h), built as replacementtypec/tipdmodules for the installed 7.3.0-12.Hardware test plan (J414s, LUKS root)
0-003b). With ACIO idle this tears down no tunnel, andcd321x_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.USB4/Thunderbolt router bound, reapplying the cable stateafter switch-root. The attached dock should then show ACIO firmware boot, a bound*.nhi,boltctldevices, its hubs on the 10000M bus, PCIe devices behind the tunnel and its display.Macs covered
The installer catalog allows the M1, M2 and M3 families and the J700 (
apple,j614sis 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 throughcd321x_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 orthunderbolt-switchnode. 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
rustccannot start (libLLVM.so.23.1missing next to llvm-libs 22.1.8), soCONFIG_RUST=ykernels do not build there. I built the test artifacts with Rust off.🤖 Generated with Claude Code