aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/pci/pci.c
diff options
context:
space:
mode:
authorNiklas Schnelle <schnelle@linux.ibm.com>2020-08-03 17:58:10 +0200
committerHeiko Carstens <hca@linux.ibm.com>2020-08-17 13:17:34 +0200
commitb97bf44f99155e57088e16974afb1f2d7b5287aa (patch)
tree81530056c680c8a179b64a5c466afed9d9897bd5 /arch/s390/pci/pci.c
parents390/pci: re-introduce zpci_remove_device() (diff)
downloadlinux-dev-b97bf44f99155e57088e16974afb1f2d7b5287aa.tar.xz
linux-dev-b97bf44f99155e57088e16974afb1f2d7b5287aa.zip
s390/pci: fix PF/VF linking on hot plug
Currently there are four places in which a PCI function is scanned and made available to drivers: 1. In pci_scan_root_bus() as part of the initial zbus creation. 2. In zpci_bus_add_devices() when registering a device in configured state on a zbus that has already been scanned. 3. When a function is already known to zPCI (in reserved/standby state) and configuration is triggered through firmware by PEC 0x301. 4. When a device is already known to zPCI (in standby/reserved state) and configuration is triggered from within Linux using enable_slot(). The PF/VF linking step and setting of pdev->is_virtfn introduced with commit e5794cf1a270 ("s390/pci: create links between PFs and VFs") was only triggered for the second case, which is where VFs created through sriov_numvfs usually land. However unlike some other platforms but like POWER VFs can be individually enabled/disabled through /sys/bus/pci/slots. Fix this by doing VF setup as part of pcibios_bus_add_device() which is called in all of the above cases. Finally to remove the PF/VF links call the common code pci_iov_remove_virtfn() function to remove linked VFs. This takes care of the necessary sysfs cleanup. Fixes: e5794cf1a270 ("s390/pci: create links between PFs and VFs") Cc: <stable@vger.kernel.org> # 5.8: 2f0230b2f2d5: s390/pci: re-introduce zpci_remove_device() Cc: <stable@vger.kernel.org> # 5.8 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>
Diffstat (limited to 'arch/s390/pci/pci.c')
-rw-r--r--arch/s390/pci/pci.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 6e57ff885f8a..4b62d6b55024 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -678,8 +678,11 @@ void zpci_remove_device(struct zpci_dev *zdev)
struct pci_dev *pdev;
pdev = pci_get_slot(zbus->bus, zdev->devfn);
- if (pdev)
+ if (pdev) {
+ if (pdev->is_virtfn)
+ return zpci_remove_virtfn(pdev, zdev->vfn);
pci_stop_and_remove_bus_device_locked(pdev);
+ }
}
int zpci_create_device(struct zpci_dev *zdev)