* [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
* Re: [PATCH v2] thunderbolt: Always generate the USB4 host router UUID
2026-12-04 21:01 [PATCH v2] thunderbolt: Always generate the USB4 host router UUID Mario Limonciello
@ 2026-12-04 21:26 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 21:26 UTC (permalink / raw)
To: Mario Limonciello; +Cc: linux-usb
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] thunderbolt: tb_switch_set_uuid() randomizes ICM USB4 host
router UUIDs
- [Medium] thunderbolt: random host sw->uuid breaks unique_id ABI and
tbnet MACs
- [Low] thunderbolt: missing Fixes trailer for commit b04079837b20
--
commit 09c89cff7b2498cf0c5bd0ab40a343cf56fb1578
Author: Mario Limonciello <mario.limonciello@amd.com>
> thunderbolt: Always generate the USB4 host router UUID
>
> 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>
[Severity: Low]
This looks like a bug fix for USB4 host-to-host inter-domain links when
host router UIDs are not unique. Should this include:
Fixes: b04079837b20 ("thunderbolt: Add initial support for USB4")
> 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.
[Severity: Medium]
Can the sysfs unique_id ABI break be avoided by storing a separate
Domain UUID on struct tb instead of overwriting tb->root_switch->uuid?
unique_id_show() exposes sw->uuid as unique_id, so randomizing it breaks
stability across boots for tools like boltd, fwupd, and udev. In the
software connection manager, only tb_scan_xdomain() and
tb_xdp_handle_request() use it for inter-domain traffic.
Also, tbnet_generate_mac() hashes xd->local_uuid and calls
eth_hw_addr_set() without setting NET_ADDR_RANDOM, so thunderbolt-net
MACs now change on every probe while still reporting a permanent
address.
This ABI text is also inaccurate for ICM-managed Intel USB4 hosts (Tiger
Lake, Alder Lake, Raptor Lake, Meteor Lake), where icm_icl_set_uuid()
populates sw->uuid from PCI config registers.
[ ... ]
> 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);
[Severity: High]
Does this break XDomain discovery and Thunderbolt-IP networking on
ICM-managed USB4 host routers such as Intel Maple Ridge?
Contrary to the commit message, icm_probe() manages several Intel USB4
host controllers, and Maple Ridge 2C/4C leaves icm->set_uuid NULL. In
icm_start(), sw->uuid is still NULL when tb_switch_add() reaches
tb_switch_set_uuid(), so it now assigns a random UUID on every probe.
Under ICM, icm_tr_xdomain_connected() sets xd->local_uuid from firmware,
while tb_xdp_handle_request() replies to UUID_REQUEST with the random
tb->root_switch->uuid. Peer PROPERTIES_REQUEST packets then fail with
ERROR_UNKNOWN_DOMAIN and tbnet_handle_packet() drops Thunderbolt-IP.
Checking !tb_switch_is_icm(sw) here and scoping the commit message and
ABI doc to software connection manager USB4 hosts would avoid this
regression.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-thunderbolt-v2-1-fc467b34c03c@amd.com?part=1
^ permalink raw reply [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