Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Geramy Loveless <gloveless@jqluv.com>, bhelgaas@google.com
Cc: ilpo.jarvinen@linux.intel.com, christian.koenig@amd.com,
	cristi@ieee.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: mark Thunderbolt-attached devices as removable
Date: Tue, 5 May 2026 11:00:03 -0500	[thread overview]
Message-ID: <26e1e270-c6ae-4389-9956-3b4554db7735@amd.com> (raw)
In-Reply-To: <20260428223147.3092087-1-gloveless@jqluv.com>



On 4/28/26 17:31, Geramy Loveless wrote:
> pci_set_removable() only marks devices as removable if their upstream
> bridge has the ACPI ExternalFacingPort property set.  Some firmware
> (e.g. MSI MS-S1 MAX with AMD Strix Halo) does not set this property on
> Thunderbolt root ports, so devices behind them are never marked
> removable.  This causes all drivers that use dev_is_removable() to miss
> eGPU-specific code paths.

Just to be clear on the topology here - this machine actually has both 
USB4 and USB4v2 routers.

There are 2 USB4 routers that are part of the APU.
Therea are 2 USB4v2 routers that are from a discrete chip.

Looking at the port I/O connectivity on their website [1], I suppose the 
"front" connectivity ones are the USB4 routers and the "rear" ones are 
USB4v2?  This issue you're hitting where devices are missing 
ExternalFacingPort - is it an issue with the rear ones, front ones, or both?

Link: https://www.minisforum.com/products/ms-s1-max [1]
> 
> Fall back to pci_is_thunderbolt_attached() when the parent is not
> already marked removable.  set_pcie_thunderbolt() runs before
> pci_set_removable() during device add, so the is_thunderbolt flag is
> already available.
> 
> This fixes the problem at the PCI core level so all drivers benefit
> from correct removable detection, not just individual drivers that add
> their own Thunderbolt checks.
> 
> Signed-off-by: Geramy Loveless <gloveless@jqluv.com>
> ---
>   drivers/pci/probe.c | 22 ++++++++++++++--------
>   1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index bccc7a4bdd7..2387edc5b89 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1761,17 +1761,23 @@ static void pci_set_removable(struct pci_dev *dev)
>   	if (!parent)
>   		return;
>   	/*
> -	 * We (only) consider everything tunneled below an external_facing
> -	 * device to be removable by the user. We're mainly concerned with
> -	 * consumer platforms with user accessible thunderbolt ports that are
> -	 * vulnerable to DMA attacks, and we expect those ports to be marked by
> -	 * the firmware as external_facing. Devices in traditional hotplug
> -	 * slots can technically be removed, but the expectation is that unless
> -	 * the port is marked with external_facing, such devices are less
> +	 * We consider everything tunneled below an external_facing device to
> +	 * be removable by the user. We're mainly concerned with consumer
> +	 * platforms with user accessible thunderbolt ports that are vulnerable
> +	 * to DMA attacks, and we expect those ports to be marked by the
> +	 * firmware as external_facing. Devices in traditional hotplug slots
> +	 * can technically be removed, but the expectation is that unless the
> +	 * port is marked with external_facing, such devices are less
>   	 * accessible to user / may not be removed by end user, and thus not
>   	 * exposed as "removable" to userspace.
> +	 *
> +	 * Some firmware does not set the ExternalFacingPort property on
> +	 * Thunderbolt root ports.  In that case, fall back to checking
> +	 * whether the device sits below a Thunderbolt controller, which
> +	 * is itself inherently user-removable.
>   	 */
> -	if (dev_is_removable(&parent->dev)) {
> +	if (dev_is_removable(&parent->dev) ||
> +	    pci_is_thunderbolt_attached(dev)) {
>   		dev_set_removable(&dev->dev, DEVICE_REMOVABLE);
>   		return;
>   	}


      reply	other threads:[~2026-05-05 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 22:31 [PATCH] PCI: mark Thunderbolt-attached devices as removable Geramy Loveless
2026-05-05 16:00 ` Mario Limonciello [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=26e1e270-c6ae-4389-9956-3b4554db7735@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=cristi@ieee.org \
    --cc=gloveless@jqluv.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.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