Mario Limonciello
2022-Feb-10 22:43 UTC
[Nouveau] [PATCH v2 4/9] PCI: mark USB4 devices as removable
USB4 class devices are also removable like Intel Thunderbolt devices. Drivers of downstream devices use this information to declare functional differences in how the drivers perform by knowing that they are connected to an upstream TBT/USB4 port. Signed-off-by: Mario Limonciello <mario.limonciello at amd.com> --- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e41656cdd8f0..73673a83eb5e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1610,6 +1610,7 @@ static void pci_set_removable(struct pci_dev *dev) * exposed as "removable" to userspace. */ if (vsec || + dev->class == PCI_CLASS_SERIAL_USB_USB4 || (parent && (parent->external_facing || dev_is_removable(&parent->dev)))) dev_set_removable(&dev->dev, DEVICE_REMOVABLE); -- 2.34.1
Macpaul Lin
2022-Feb-11 01:28 UTC
[Nouveau] [PATCH v2 4/9] PCI: mark USB4 devices as removable
An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20220211/ee9d4355/attachment-0001.htm> -------------- next part -------------- On 2/11/22 6:43 AM, Mario Limonciello wrote:> USB4 class devices are also removable like Intel Thunderbolt devices. > > Drivers of downstream devices use this information to declare functional > differences in how the drivers perform by knowing that they are connected > to an upstream TBT/USB4 port. > > Signed-off-by: Mario Limonciello <mario.limonciello at amd.com> > --- > drivers/pci/probe.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index e41656cdd8f0..73673a83eb5e 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1610,6 +1610,7 @@ static void pci_set_removable(struct pci_dev *dev) > * exposed as "removable" to userspace. > */ > if (vsec || > + dev->class == PCI_CLASS_SERIAL_USB_USB4 || > (parent && > (parent->external_facing || dev_is_removable(&parent->dev)))) > dev_set_removable(&dev->dev, DEVICE_REMOVABLE); >Reviewed-by: Macpaul Lin <macpaul.lin at mediatek.com> Thanks! Regards, Macpaul Lin
Mika Westerberg
2022-Feb-11 10:35 UTC
[Nouveau] [PATCH v2 4/9] PCI: mark USB4 devices as removable
Hi Mario, On Thu, Feb 10, 2022 at 04:43:24PM -0600, Mario Limonciello wrote:> USB4 class devices are also removable like Intel Thunderbolt devices. > > Drivers of downstream devices use this information to declare functional > differences in how the drivers perform by knowing that they are connected > to an upstream TBT/USB4 port.This may not be covering the integrated controllers. For discrete, yes but if it is the PCIe root ports that start the PCIe topology (over the PCIe tunnels) this does not work. For integrated we have the "usb4-host-interface" ACPI property that tells this for each port: https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#mapping-native-protocols-pcie-displayport-tunneled-through-usb4-to-usb4-host-routers and for discrete there is the PCIe DVSEC that can be used (see the USB4 spec archive it includes the "USB4 DVSEC Version 1.0.pdf" that has more information). I would expect AMD controller (assuming it is discrete) implements this too. So I'm proposing that we mark the devices that are below PCIe ports (root, downstream) that fall in the above categories as "removable". This is then not dependent on checking the USB4 controller and how it is setup in a particular system.