* [PATCH] PCI: mark Thunderbolt-attached devices as removable
@ 2026-04-28 22:31 Geramy Loveless
2026-05-05 16:00 ` Mario Limonciello
0 siblings, 1 reply; 2+ messages in thread
From: Geramy Loveless @ 2026-04-28 22:31 UTC (permalink / raw)
To: bhelgaas
Cc: mario.limonciello, ilpo.jarvinen, christian.koenig, cristi,
linux-pci, linux-kernel, Geramy Loveless
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.
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;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: mark Thunderbolt-attached devices as removable
2026-04-28 22:31 [PATCH] PCI: mark Thunderbolt-attached devices as removable Geramy Loveless
@ 2026-05-05 16:00 ` Mario Limonciello
0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2026-05-05 16:00 UTC (permalink / raw)
To: Geramy Loveless, bhelgaas
Cc: ilpo.jarvinen, christian.koenig, cristi, linux-pci, linux-kernel
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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-05 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 22:31 [PATCH] PCI: mark Thunderbolt-attached devices as removable Geramy Loveless
2026-05-05 16:00 ` Mario Limonciello
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox