On Fri, Jul 16, 2021 at 10:04:51PM +0800, Wenchao Hao wrote: > On 2021/7/15 1:26, Keith Busch wrote: > > On Wed, Jul 14, 2021 at 11:54:27AM -0500, Bjorn Helgaas wrote: > > > On Wed, Jul 14, 2021 at 02:33:37PM +0800, Wenchao Hao wrote: > > > > > > > If they are not fixed, then is there anyway I can get a fixed ID > > > > which can indicate physical connection. > > > You can look at the "lspci -P" option. I'm not really familiar with > > > this, but I think Matthew (cc'd) implemented it. > > That option shows the parent devices for each listed device, but that > > may not produce the same output if BDf doesn't always enumerate the > > same. > > > > I think Wenchao was seeking some invariant device identification that > > can be used to look up its BDf. There's no PCI level requirement for > > uniquely identifying a specific device across changing topologies, so I > > don't think this is generically possible. > > Yes, I want a way to access device which can keep unchanged, a > direction is according to hardware. If we have anyway which makes > it possible for software can describe hardware connection would > satisfy our demand. I don't know whether this would be useful, but PCI does define an optional "Device Serial Number" extended capability. It has issues like the fact that many devices don't support it at all, and even on devices that do support it, the serial number may not actually be unique. There is minimal support for this in Linux (pci_get_dsn()), but it is currently not exposed to userspace via sysfs. Bjorn