s390/pci: expose a PCI device's UID as its index
authorNiklas Schnelle <schnelle@linux.ibm.com>
Wed, 24 Feb 2021 10:29:36 +0000 (11:29 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 20 Apr 2021 12:48:27 +0000 (14:48 +0200)
commit81bbf03905aae47a80fd05604cc9b0d1ca20e30a
tree3043a193866a502486c5fd3353ce2abdbc4e708a
parenta637b3bfa43aead7221b79cd92e092ef911c8253
s390/pci: expose a PCI device's UID as its index

On s390 each PCI device has a user-defined ID (UID) exposed under
/sys/bus/pci/devices/<dev>/uid. This ID was designed to serve as the PCI
device's primary index and to match the device within Linux to the
device configured in the hypervisor. To serve as a primary identifier
the UID must be unique within the Linux instance, this is guaranteed by
the platform if and only if the UID Uniqueness Checking flag is set
within the CLP List PCI Functions response.

In this sense the UID serves an analogous function as the SMBIOS
instance number or ACPI index exposed as the "index" respectively
"acpi_index" device attributes and used by e.g. systemd to set interface
names. As s390 does not use and will likely never use ACPI nor SMBIOS
there is no conflict and we can just expose the UID under the "index"
attribute whenever UID Uniqueness Checking is active and get systemd's
interface naming support for free.

Link: https://lore.kernel.org/lkml/20210412135905.1434249-1-schnelle@linux.ibm.com/
Acked-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Narendra K <narendra_k@dell.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Documentation/ABI/testing/sysfs-bus-pci
arch/s390/pci/pci_sysfs.c