From: Pierre Morel Date: Thu, 26 Mar 2020 16:07:03 +0000 (-0400) Subject: s390/pci: Do not disable PF when VFs exist X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=53dd462ac4dc3fc61ee90ad03d96202e17589156;p=linux.git s390/pci: Do not disable PF when VFs exist 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 Reviewed-by: Niklas Schnelle Signed-off-by: Vasily Gorbik --- diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c index 1579ba895edf2..b59f84918fe06 100644 --- a/drivers/pci/hotplug/s390_pci_hpc.c +++ b/drivers/pci/hotplug/s390_pci_hpc.c @@ -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); }