s390/pci: Do not disable PF when VFs exist
authorPierre Morel <pmorel@linux.ibm.com>
Thu, 26 Mar 2020 16:07:03 +0000 (12:07 -0400)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 28 Apr 2020 11:49:47 +0000 (13:49 +0200)
The Physical function should not be disabled until no virtual
functions depends on it.
Let's force the user to first use echo 0 > sriov_numfs before
allowing to disable the PF with echo 0 > power.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/pci/hotplug/s390_pci_hpc.c

index 1579ba895edf22f1581e8938ed155aecdd86c56e..b59f84918fe060058d0f74c0e89fa39491b4f8d6 100644 (file)
@@ -91,6 +91,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
 
        pdev = pci_get_slot(zbus->bus, zdev->devfn);
        if (pdev) {
+               if (pci_num_vf(pdev))
+                       return -EBUSY;
+
                pci_stop_and_remove_bus_device_locked(pdev);
                pci_dev_put(pdev);
        }