Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] thunderbolt: Always generate the USB4 host router UUID
Date: Fri, 04 Dec 2026 21:26:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-250691@kernel.org> (raw)
In-Reply-To: <20261204-thunderbolt-v2-1-fc467b34c03c@amd.com>

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

      reply	other threads:[~2026-12-04 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=sashiko-outbox-250691@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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