Linux USB
 help / color / mirror / Atom feed
* [PATCH v2] thunderbolt: Always generate the USB4 host router UUID
@ 2026-12-04 21:01 Mario Limonciello
  2026-12-04 21:26 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2026-12-04 21:01 UTC (permalink / raw)
  To: Andreas Noever, Mika Westerberg, Yehezkel Bernat
  Cc: Sanath S, linux-usb, linux-kernel, Mario Limonciello

The software connection manager derives the UUID of a USB4 host router
from its UID 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 USB4 host routers instead. ICM never
manages USB4 host routers so the ICM compatibility argument does not
apply to them. Device routers and non-USB4 host routers (including
those managed by ICM) keep their existing UUID so their unique_id stays
stable across boots and matches what ICM reports.

As a side effect the host router unique_id in sysfs and the MAC address
generated by thunderbolt-net (derived from the local Domain UUID) now
change every time a USB4 domain is probed. Update the ABI documentation
accordingly.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Changes in v2:
- Only randomize the UUID of USB4 host routers. ICM-managed and other
  non-USB4 host routers keep their existing UUID (Sashiko)
- Document in the sysfs ABI that the USB4 host router unique_id is
  random and changes every time the domain is probed (Sashiko)
- Note in the commit message that the thunderbolt-net MAC address of
  USB4 hosts now changes on every probe
- Link to v1: https://patch.msgid.link/20261203-thunderbolt-v1-1-347b359ad963@amd.com
---
 Documentation/ABI/testing/sysfs-bus-thunderbolt |  4 ++++
 drivers/thunderbolt/switch.c                    | 21 +++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-thunderbolt b/Documentation/ABI/testing/sysfs-bus-thunderbolt
index 4c954cb6b5e41..f0f7302613267 100644
--- a/Documentation/ABI/testing/sysfs-bus-thunderbolt
+++ b/Documentation/ABI/testing/sysfs-bus-thunderbolt
@@ -192,6 +192,10 @@ Description:	This attribute contains unique_id string of this device.
 		newer hardware) or based on UID from the device DROM.
 		Can be used to uniquely identify particular device.
 
+		For USB4 host routers this is a randomly generated
+		Domain UUID as required by the USB4 specification and
+		it changes every time the domain is probed.
+
 What:		/sys/bus/thunderbolt/devices/.../nvm_version
 Date:		Sep 2017
 KernelVersion:	4.13
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 8899fea713ac2..a693cf123e71b 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2873,10 +2873,23 @@ static int tb_switch_set_uuid(struct tb_switch *sw)
 		return 0;
 
 	if (tb_switch_is_usb4(sw)) {
-		ret = usb4_switch_read_uid(sw, &sw->uid);
-		if (ret)
-			return ret;
-		uid = true;
+		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 {
+			ret = usb4_switch_read_uid(sw, &sw->uid);
+			if (ret)
+				return ret;
+			uid = true;
+		}
 	} else {
 		/*
 		 * The newer controllers include fused UUID as part of

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

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 21:01 [PATCH v2] thunderbolt: Always generate the USB4 host router UUID Mario Limonciello
2026-12-04 21:26 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox