s390/pci: separate zbus creation from scanning
authorNiklas Schnelle <schnelle@linux.ibm.com>
Fri, 12 Feb 2021 13:19:31 +0000 (14:19 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 12 Apr 2021 10:46:42 +0000 (12:46 +0200)
commita50297cf8235b062bcdeaa8b1dad58e69d3e1b43
tree12be5624238a016ed1c88f1ad6b3a571a7694f5d
parent7dc697d6b2b5299ab7e09c592d727671a3859be2
s390/pci: separate zbus creation from scanning

In the existing code the creation of the PCI bus and the scanning of
function zero all happens in zpci_scan_bus(). This in turn requires
functions to be enabled and their resources to be available before the
PCI bus is even created.

This not only means that functions are enabled long before they are
actually made available to the common PCI subsystem. In case of
functions with non-zero devfn which appeared before the function with
devfn zero they can wait arbitrarily long in this enabled but not
scanned state.

Fix this by separating the creation of the PCI bus from scanning it and
only prepare, that is enable and setup MMIO bus resources, functions
just before they are scanned. As they may be scanned multiple times
track if we already created resources in the zdev.

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c
arch/s390/pci/pci_bus.c
arch/s390/pci/pci_bus.h