Linux USB
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Sanath S <sanath.s@amd.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH] thunderbolt: Always generate the host router UUID
Date: Thu, 3 Dec 2026 11:18:02 -0600	[thread overview]
Message-ID: <20261203-thunderbolt-v1-1-347b359ad963@amd.com> (raw)

The software connection manager derives the UUID of the host router
from its UID (or the fused link controller UUID on older Thunderbolt
hardware) with the upper two words filled with ones to match what ICM
does. The USB4 spec however requires the Domain UUID used in
inter-domain communication to be generated according to ISO/IEC 9834-8,
and the host router UID is not guaranteed to be unique either.

If the IDs are not unique then when two of these hosts are connected
together each side sees its own UUID in the inter-domain UUID response,
treats the link as a loop and never bonds the lanes, which caps the
host-to-host link at a single lane.

Always generate a random UUID for the host router instead. Device
routers keep the UID-derived UUID so that their unique_id stays stable
across boots and matches what ICM reports.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/thunderbolt/switch.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 8899fea713ac2..6cedaf5351bd9 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2872,7 +2872,17 @@ static int tb_switch_set_uuid(struct tb_switch *sw)
 	if (sw->uuid)
 		return 0;
 
-	if (tb_switch_is_usb4(sw)) {
+	if (!tb_route(sw)) {
+		/*
+		 * USB4 spec requires the Domain UUID to be generated
+		 * according to ISO/IEC 9834-8 so never derive it from the
+		 * host router UID. The UID is not guaranteed to be unique
+		 * either (it can be left unprogrammed) and if two hosts end
+		 * up with the same UUID the inter-domain link is mistaken
+		 * for a loop and lanes are never bonded.
+		 */
+		generate_random_uuid((u8 *)uuid);
+	} else if (tb_switch_is_usb4(sw)) {
 		ret = usb4_switch_read_uid(sw, &sw->uid);
 		if (ret)
 			return ret;

---
base-commit: b8a56745a38d34f9db9723f7d0ef8ab10c0eabc5
change-id: 20261203-thunderbolt-fb97fb283a60

Best regards,
--  
Mario Limonciello <mario.limonciello@amd.com>


                 reply	other threads:[~2026-12-03 17:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261203-thunderbolt-v1-1-347b359ad963@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sanath.s@amd.com \
    --cc=westeri@kernel.org \
    /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