s390/pci: Ignore RID for isolated VFs
authorNiklas Schnelle <schnelle@linux.ibm.com>
Thu, 26 Sep 2024 14:08:31 +0000 (16:08 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 10 Oct 2024 13:32:43 +0000 (15:32 +0200)
commit25f39d3dcb48bbc824a77d16b3d977f0f3713cfe
treef7c3f280757f5174e9eb078d01a276ba0b7e70d7
parent126034faaac5f356822c4a9bebfa75664da11056
s390/pci: Ignore RID for isolated VFs

Ensure that VFs used in isolation, that is with their parent PF not
visible to the configuration but with their RID exposed, are treated
compatibly with existing isolated VF use cases without exposed RID
including RoCE Express VFs. This allows creating configurations where
one LPAR manages PFs while their child VFs are used by other LPARs. This
gives the LPAR managing the PFs a role analogous to that of the
hypervisor in a typical use case of passing child VFs to guests.

Instead of creating a multifunction struct zpci_bus whenever a PCI
function with RID exposed is discovered only create such a bus for
configured physical functions and only consider multifunction busses
when searching for an existing bus. Additionally only set zdev->devfn to
the devfn part of the RID once the function is added to a multifunction
bus.

This also fixes probing of more than 7 such isolated VFs from the same
physical bus. This is because common PCI code in pci_scan_slot() only
looks for more functions when pdev->multifunction is set which somewhat
counter intutively is not the case for VFs.

Note that PFs are looked at before their child VFs is guaranteed because
we sort the zpci_list by RID ascending.

Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/pci/pci_bus.c
arch/s390/pci/pci_clp.c