This series makes Thunderbolt / USB4 docks behave across s2idle on Linux the way they already do on Windows Modern Standby, and in doing so exposes (and fixes) a pre-existing kernel deadlock in the atlantic driver that surfaces whenever a dock is physically disconnected during any sleep window. The two patches are independent in scope but were discovered together while investigating why unplugging the dock during s2idle reliably panicked the kernel: Patch 1 (thunderbolt) adds an opt-in module parameter, thunderbolt.s2idle_preserve, which skips tb_switch_suspend() / tb_switch_resume() when the sleep target is PM_SUSPEND_TO_IDLE. On AMD USB4 host controllers that reliably preserve router state in D3hot (verified on Ryzen AI 9 HX 370), this eliminates the per-wake re-enumeration cascade: downstream USB devices keep their device numbers, open file descriptors survive, audio streams and filesystem mounts are not torn down, and resume_devices drops from ~2.6 s to ~0.2 s. S3 and hibernate are unaffected; the gate is off by default so hardware that does not preserve state is not surprised. Patch 2 (atlantic) fixes a deadlock that is NOT caused by patch 1 but is reliably exposed by patch 1: under the existing driver, disconnecting a Thunderbolt dock that carries an atlantic NIC during any sleep transition causes pciehp_ist to block in aq_pci_remove -> aq_nic_stop -> napi_disable_locked, spinning on NAPI_STATE_SCHED that cannot clear because the poll function is reading config space from a disconnected PCIe parent. DPM watchdog trips at T+120 s and panics the kernel. aq_nic_deinit() in the same file already consults pci_device_is_present() for an analogous reason; aq_nic_stop() simply did not. Adding pci_dev_is_disconnected() at the top of aq_nic_stop() eliminates the hang. The Windows AQtion driver (aqnic650.sys 3.1.10) handles the same case with a surprise_removed flag set from NdisDevicePnPEventSurpriseRemoved; this patch is the Linux-side equivalent using the signal pciehp already sets. Patch 2 stands on its own: the deadlock pre-dates patch 1 and is reachable on any laptop that can lose a PCIe parent bridge during sleep (TB docks, hot-pluggable M.2 cages, …). Patch 1 depends on patch 2 in practice, because enabling preserve on a machine with the atlantic deadlock turns "quiet dock unplug during preserved s2idle" into a 120 s panic. Testing ======= Both patches have been running on the author's GPD Win Max 2 (AMD Ryzen AI 9 HX 370 + CalDigit TS5 Plus dock) against 7.3.6-gentoo for the past several days across: * Plain suspend / resume with dock plugged (no change expected under default off; clean behaviour with preserve=1). * Plain suspend / resume with dock unplugged (no change expected). * Suspend with dock plugged -> unplug during s2idle -> resume (without patch 2: panic at T+120 s; with patch 2: clean resume with pciehp removal; with patch 1 preserve=1: same clean resume, userspace never sees the dock as "gone and returned"). * Suspend -> dock replugged during s2idle -> resume (clean resume, same addresses retained with preserve=1). * suspend-then-hibernate across the above sequences. The one known caveat is documented in the patch 1 changelog: a wake from a USB input device on the host's own xHCI, while a TB dock is connected and preserve is active, can produce a quiet resume hang on some hardware. We were not able to capture a panic or stack trace for that case. Workaround for affected users is to route input devices through the dock. Likely root cause is noted in the patch body and a possible refinement (split wake-arming from teardown) is sketched. Evidence ======== The full DPM-watchdog panic traces that motivated patch 2 are attached to the body of this e-mail. The relevant pstore extracts show pciehp_ist blocked in aq_pci_remove -> aq_nic_stop -> aq_vec_stop -> napi_disable_locked and every other device_resume thread blocked downstream on the parent bridge mutex. Not tested on Intel Thunderbolt hardware ======================================== The tb preserve path in patch 1 assumes AMD USB4-style D3hot state retention. Intel generations may or may not preserve state in the same way under the same firmware configurations; the default-off gate exists precisely so maintainers and users on non-AMD hardware can experiment without the setting leaking into unsuspecting configurations. If anyone on Intel USB4 can test with thunderbolt.s2idle_preserve=1 and report back, that data would be very welcome. Tool-use disclosure =================== This series was developed with substantial assistance from Anthropic's Claude (Claude Code, Opus 4.7). Both patches were debugged, drafted and verified in sessions where Claude read kernel source, pstore traces and lsmod output supplied by the submitter, suggested locations and conditions for each change, and drafted commit-message prose. The submitter reviewed every hunk, ran the patches on the hardware described above for several days, read every line of the diff against the surrounding code paths, and takes full responsibility for the contribution per the DCO. In accordance with Documentation/process/coding-assistants.rst, no Signed-off-by tag has been added on behalf of the assistant. The Marvell AQtion Windows driver cross-reference cited in patch 2 was produced by a separate research subagent run and is on file as WINDOWS-DRIVER-RE.md in the submission bundle; details available on request. Signed-off-by: Tobias Heath