Re: [PATCH v4] PCI: Relabel JHL6540 on Lenovo X1 Carbon 7,8

Lukas Wunner
2024-08-25T14:29:42Z

On Mon, Jul 29, 2024 at 11:04:41AM +0300, Mika Westerberg wrote:
> On Sun, Jul 28, 2024 at 05:41:09PM +0200, Lukas Wunner wrote:
> > Do the DROMs on ICM root switches generally lack PCIe Upstream and
> > Downstream Adapter Entries?
>
> My guess is that they are not populated for ICM host router DROM
> entries. These are pretty much Apple stuff and USB4 dropped them
> completely in favour of the router operations.

I note that Microsoft specifies a "usb4-port-number" for PCIe Downstream
Adapters as well as DP and USB ports:

https://learn.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

Presumably the "usb4-port-number" allows for associating a
pci_dev with a tb_port. So that's a third way to do that,
on top of DROM entries and the USB4 router operation.

What I don't quite understand is whether the "usb4-port-number"
is only present on PCIe Adapters of the Host Router or whether
it can also exist on PCIe Adapters of Device Routers?

I would also like to know whether "usb4-port-number" is set on
the machines that Esther's quirk seeks to fix?

I found this DSDT of an unknown Lenovo model which does not have
"usb4-port-number" set on any PCIe Adapters, only on USB ports:

https://gist.github.com/64kramsystem/ab2410f081a4f47d4a205699828ab2f9

I assumed that my solution to this problem would not be viable as
we seem to be lacking port numbers for Host Router PCIe Adapters.
Those are needed to associate a pci_dev with a tb_port on the
Host Router and adjust its "untrusted" and "external_facing"
properties.

However if we do have the "usb4-port-number" on Host Router
PCIe Adapters, then my solution would still be viable and
I could look into adding support for the "usb4-port-number"
property to it.

Thanks,

Lukas