thunderbolt: Enable runtime PM for the Ice Lake router with the software CM
Subsystems (2)
PATCH 1/1 thunderbolt: Enable runtime PM for the Ice Lake router with the software CM
The firmware connection manager reports RTD3 for the Ice Lake router. On Apple systems the software connection manager takes over and enables runtime PM only for USB4 routers, so the Ice Lake NHI stays in D0 for as long as the driver is bound and the package does not reach deep C-states.
Enable runtime PM for the Ice Lake router as well. The Ice Lake NHI already has runtime suspend and resume callbacks.
Tested on a MacBookAir9,1.
--- drivers/thunderbolt/tb.c | 5 +++-- drivers/thunderbolt/tb.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/thunderbolt/tb.c +3 -2
@@ -3044,8 +3044,9 @@ static int tb_start(struct tb *tb, bool reset)* implement the necessary router operations. */ tb->root_switch->no_nvm_upgrade = !tb_switch_is_usb4 (tb->root_switch); -/* All USB4 routers support runtime PM */ - tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch); +/* All USB4 routers support runtime PM. Ice Lake also supports RTD3 */ + tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch) || +tb_switch_is_ice_lake (tb->root_switch); ret =tb_switch_configure (tb->root_switch);if (ret) {
drivers/thunderbolt/tb.h +12 -0
@@ -1011,6 +1011,18 @@ static inline bool tb_switch_is_tiger_lake(const struct tb_switch *sw)return false; } +static inline bool tb_switch_is_ice_lake (const struct tb_switch *sw) +{ +if (sw->config.vendor_id ==PCI_VENDOR_ID_INTEL ) { +switch (sw->config.device_id) { +case PCI_DEVICE_ID_INTEL_ICL_NHI0 : +case PCI_DEVICE_ID_INTEL_ICL_NHI1 : +return true; + } + } +return false; +} +/** * tb_switch_is_icm() - Is the switch handled by ICM firmware * @sw: Switch to check
base-commit: 13527afe5f15c60b82920fe9915f3cabf1315302
Hi,
Quoted 9 lines · Andre Eikmeyer
The firmware connection manager reports RTD3 for the Ice Lake router. On Apple systems the software connection manager takes over and enables runtime PM only for USB4 routers, so the Ice Lake NHI stays in D0 for as long as the driver is bound and the package does not reach deep C-states.
Enable runtime PM for the Ice Lake router as well. The Ice Lake NHI already has runtime suspend and resume callbacks.
Tested on a MacBookAir9,1.
Cool, does it also wake up if you plug something to the TB ports?
Quoted 48 lines
Signed-off-by Andre Eikmeyer <[email protected]>--- drivers/thunderbolt/tb.c | 5 +++-- drivers/thunderbolt/tb.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-)drivers/thunderbolt/tb.c +3
-2@@ -3044,8 +3044,9 @@ static int tb_start(struct tb *tb, bool reset)* implement the necessary router operations. */ tb->root_switch->no_nvm_upgrade = !tb_switch_is_usb4 (tb->root_switch); -/* All USB4 routers support runtime PM */ - tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch); +/* All USB4 routers support runtime PM. Ice Lake also supports RTD3 */ + tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch) || +tb_switch_is_ice_lake (tb->root_switch); ret =tb_switch_configure (tb->root_switch);if (ret) {drivers/thunderbolt/tb.h +12
-0@@ -1011,6 +1011,18 @@ static inline bool tb_switch_is_tiger_lake(const struct tb_switch *sw)return false; } +static inline bool tb_switch_is_ice_lake (const struct tb_switch *sw) +{ +if (sw->config.vendor_id ==PCI_VENDOR_ID_INTEL ) { +switch (sw->config.device_id) { +case PCI_DEVICE_ID_INTEL_ICL_NHI0 : +case PCI_DEVICE_ID_INTEL_ICL_NHI1 : +return true; + } + } +return false; +} +/** * tb_switch_is_icm() - Is the switch handled by ICM firmware * @sw: Switch to check base-commit:
13527afe5f15c60b82920fe9915f3cabf1315302
Quoted 1 line · On Wed, 11 Nov 2026 14:21:12 +0100 Mika Westerberg…
Cool, does it also wake up if you plug something to the TB ports?
Hi Mika,
yup. working perfectly here. There is also a bunch of other patches for hotplug and such. I even get pkg-c10 on all T2 macbooks. But that is for another day.
Hi,
Quoted 10 lines · André Eikmeyer
Quoted 1 line · On Wed, 11 Nov 2026 14:21:12 +0100 Mika Westerberg…
Cool, does it also wake up if you plug something to the TB ports?
Hi Mika,
yup. working perfectly here. There is also a bunch of other patches for hotplug and such. I even get pkg-c10 on all T2 macbooks. But that is for another day.
I was about to apply this but noticed the Sashiko report. Only thing that matters there is the device links thing, so that we don't go to runtime suspend with PCIe tunneled. I wonder if you can check that and possibly update it to use the DL_FLAG_RPM_ACTIVE and pm_runtime_get() to make sure they are in sync?
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] thunderbolt: root switch skipped in tb_lc_set_wake() and lane init on ICL - [High] thunderbolt…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] thunderbolt: root switch skipped in tb_lc_set_wake() and lane init on ICL
- [High] thunderbolt: missing DL_FLAG_RPM_ACTIVE in add_link() suspends active PCIe
--
commit 7b8fe879e2da1e2a2041c441ee239114a6aec29b
Author: Andre Eikmeyer <[email protected]>
thunderbolt: Enable runtime PM for the Ice Lake router with the software CM
This commit adds tb_switch_is_ice_lake() and enables software connection manager runtime PM on the Ice Lake host router.
drivers/thunderbolt/tb.c static int tb_start(struct tb *tb, bool reset) · line 3049
Quoted 13 lines
drivers/thunderbolt/tb.c +3
-2@@ -3044,8 +3044,9 @@ static int tb_start(struct tb *tb, bool reset)* implement the necessary router operations. */ tb->root_switch->no_nvm_upgrade = !tb_switch_is_usb4 (tb->root_switch); -/* All USB4 routers support runtime PM */ - tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch); +/* All USB4 routers support runtime PM. Ice Lake also supports RTD3 */ + tb->root_switch->rpm =tb_switch_is_usb4 (tb->root_switch) || +tb_switch_is_ice_lake (tb->root_switch);
[Severity: High]
Does enabling runtime PM on the Ice Lake root switch put its link controllers to sleep without configuring wakeups or restarting lane initialization on resume?
Ice Lake is a generation 3 (non-USB4) router, so tb_switch_suspend() uses the link controller path: it disables plug events, calls tb_switch_set_wake() -> tb_lc_set_wake(), and then calls tb_lc_set_sleep() to set TB_LC_SX_CTRL_SLP on each link controller. However, tb_lc_set_wake() bails out on the root switch:
drivers/thunderbolt/lc.c:tb_lc_set_wake() {
if (sw->generation < 2)
return 0;
if (!tb_route(sw))
return 0;
...
}When a connected device is runtime-suspended, icl_nhi_suspend() keeps force power on and leaves the root switch in link controller sleep with no wake bits (WOC, WOD, WOU4, WOP, WODPC, WODPD) programmed. On runtime resume, tb_runtime_resume() -> tb_switch_resume() -> tb_port_resume() -> tb_lc_start_lane_initialization() also returns early on !tb_route(sw) instead of asserting TB_LC_SX_CTRL_SLI on disconnected downstream lane adapters.
[Severity: High]
Can enabling runtime PM on Ice Lake allow nhi->dev and the root switch to runtime-suspend while a tunneled PCIe root port is still active?
On Apple Ice Lake systems, nhi_select_cm() creates the runtime PM device links to the tunneled PCIe root ports through icl_nhi_add_links() -> add_link() rather than tb_acpi_add_links():
drivers/thunderbolt/pci.c:add_link() {
link = device_link_add(&pdev->dev, nhi->dev,
DL_FLAG_AUTOREMOVE_SUPPLIER |
DL_FLAG_PM_RUNTIME);
...
}Unlike tb_acpi_add_link(), which was updated in f3380cac0c0b ("thunderbolt:
Runtime PM activate both ends of the device link") to wrap device_link_add() with pm_runtime_get_sync(&pdev->dev), DL_FLAG_RPM_ACTIVE, and pm_runtime_put(&pdev->dev), add_link() does not pass DL_FLAG_RPM_ACTIVE. When a PCIe tunnel is already up at boot and the consumer PCIe root port is already runtime-active when add_link() runs, nhi->dev's runtime PM usage count is not incremented, allowing the Thunderbolt domain and root switch to autosuspend underneath the active PCIe tunnel.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1