Merge branch 'pci/iov'

* pci/iov:
  PCI/IOV: Fix race between SR-IOV enable/disable and hotplug
  Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV"
This commit is contained in:
Bjorn Helgaas 2026-02-06 17:09:17 -06:00
commit 1cb15d2054

View File

@ -495,7 +495,9 @@ static ssize_t sriov_numvfs_store(struct device *dev,
if (num_vfs == 0) {
/* disable VFs */
pci_lock_rescan_remove();
ret = pdev->driver->sriov_configure(pdev, 0);
pci_unlock_rescan_remove();
goto exit;
}
@ -507,7 +509,9 @@ static ssize_t sriov_numvfs_store(struct device *dev,
goto exit;
}
pci_lock_rescan_remove();
ret = pdev->driver->sriov_configure(pdev, num_vfs);
pci_unlock_rescan_remove();
if (ret < 0)
goto exit;
@ -629,18 +633,15 @@ static int sriov_add_vfs(struct pci_dev *dev, u16 num_vfs)
if (dev->no_vf_scan)
return 0;
pci_lock_rescan_remove();
for (i = 0; i < num_vfs; i++) {
rc = pci_iov_add_virtfn(dev, i);
if (rc)
goto failed;
}
pci_unlock_rescan_remove();
return 0;
failed:
while (i--)
pci_iov_remove_virtfn(dev, i);
pci_unlock_rescan_remove();
return rc;
}
@ -765,10 +766,8 @@ static void sriov_del_vfs(struct pci_dev *dev)
struct pci_sriov *iov = dev->sriov;
int i;
pci_lock_rescan_remove();
for (i = 0; i < iov->num_VFs; i++)
pci_iov_remove_virtfn(dev, i);
pci_unlock_rescan_remove();
}
static void sriov_disable(struct pci_dev *dev)