On Tue, Apr 23, 2024 at 10:31:30AM +0200, Lukas Wunner wrote: > On Tue, Apr 23, 2024 at 08:33:12AM +0300, Mika Westerberg wrote: > > I think what you are looking for is that anything behind a PCIe tunnel > > should not have this applied. IIRC the AMD GPU or some code there were > > going to add identification of "virtual" links to the bandwidth > > calculation functionality. > > I guess I could resurrect my correlation patch: > > https://lore.kernel.org/all/f53ea40a7487e145aa1a62c347cef1814072e140.1536517047.git.lukas@xxxxxxxxx/ > > The last time I forward-ported it was for v5.13. I still have that code > running on my development machine. > > The problem is that it only allows lookup from tb_port to pci_dev. > I'd have to add a pointer to struct pci_dev to allow lookups in the > inverse direction. Though I think we have such PCI companion devices > for CXL as well, so such a pointer could be useful in general. > > I'm knee-deep in PCI device authentication code but could probably > dedicate a weekend to the correlation patch if there's interest? > > Once we have correlation, we can expose more precise bandwidth > for virtual PCI links in sysfs. Sounds good to me :) There are also some additions in USB4 spec that allows discovery of mapping between PCIe adapters and the corresponding PCIe downstream/root port. Perhaps these can be added there too?