Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Amaan Lalani <zlzzm2014@outlook.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Reset downstream port after failed link restore
Date: Mon, 31 Aug 2026 15:42:39 +0200	[thread overview]
Message-ID: <20260831134239.GM124825@black.igk.intel.com> (raw)
In-Reply-To: <DM6PR02MB63772452BC9DE8C5C79BE421A0AB2@DM6PR02MB6377.namprd02.prod.outlook.com>

Hi,

On Sat, Aug 29, 2026 at 04:57:05PM -0700, Amaan Lalani wrote:
> A directly connected Thunderbolt device may fail to restore
> its link after a runtime suspend, therefore leaving the connection
> unusable.

How does it show up? Can you share more details, like full dmesg with
thunderbolt.dyndbg=+p in the command line?

> Reset the downstream port when the link restoration fails. This drives
> SBTX low, causing the partner to observe a USB4 disconnect and allowing
> the Type-C/PD firmware to renegotiate the connection. For dual-mode
> devices, this may allow the connection to fall back to native USB3.x.
> 
> Tested on a Microsoft Surface Pro 11 with a UGreen Thunderbolt
> 4 external NVMe enclosure, where the device successfully reconnects as a
> USB3 device when the Thunderbolt 4 link fails to recover.
> 
> Signed-off-by: Amaan Lalani <zlzzm2014@outlook.com>
> ---
>  drivers/thunderbolt/switch.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index 404c0693df50..7b88aa75a07a 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -3600,7 +3600,27 @@ int tb_switch_resume(struct tb_switch *sw, bool runtime)
>  
>  		if (tb_wait_for_port(port, true) <= 0) {
>  			tb_port_warn(port,
> -				     "lost during suspend, disconnecting\n");
> +				    "lost during suspend, disconnecting\n");
> +			/*
> +			 * If a directly connected USB4/thunderbolt device did not restore
> +			 * its link after a runtime suspend, assert a downstream
> +			 * port reset. This drives SBTX low and makes the partner
> +			 * observe a real USB4 disconnect. A dual-mode device and
> +			 * the Type-C/PD firmware will then try to renegotiate
> +			 * the connection in a native USB 3.x mode.
> +			 *
> +			 * Restrict this to the host router's downstream port.
> +			 * Resetting an intermediate router would not cause the Type-C
> +			 * to be renegotiated.
> +			 */
> +			if (runtime && !tb_route(sw) &&
> +			    tb_switch_is_usb4(sw) && port->cap_usb4) {

Yea I'm not entirely sure we want to add hacks like this to the driver to
be honest.

The link should re-negotiate as USB4 so something is wrong there. Have you
checked if you have the latest firmwares on both sides?

> +				err = tb_port_reset(port);
> +				if (err)
> +					tb_port_warn(port,
> +						     "failed to reset port for USB3 fallback: %d\n",
> +						     err);
> +			}
>  			if (tb_port_has_remote(port))
>  				tb_sw_set_unplugged(port->remote->sw);
>  			else if (port->xdomain)
> -- 
> 2.55.0

  reply	other threads:[~2026-08-31 13:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 23:57 [PATCH] thunderbolt: Reset downstream port after failed link restore Amaan Lalani
2026-08-31 13:42 ` Mika Westerberg [this message]
2026-08-31 13:46   ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831134239.GM124825@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=westeri@kernel.org \
    --cc=zlzzm2014@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox