Messages in this thread Patch in this message | | | From | Jim Harris <> | Subject | [PATCH v3 2/2] PCI/IOV: set iov->num_VFs before VFs are probed | Date | Wed, 14 Feb 2024 22:59:48 +0000 |
| |
Ensure userspace can see the updated number of VFs via sysfs sriov_numvfs before those VFs are probed.
Suggested-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jim Harris <jim.harris@samsung.com> --- drivers/pci/iov.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 0ca20cd518d5..ebb7c6892ad6 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -673,12 +673,14 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) msleep(100); pci_cfg_access_unlock(dev); + iov->num_VFs = nr_virtfn; rc = sriov_add_vfs(dev, initial); - if (rc) + if (rc) { + iov->num_VFs = 0; goto err_pcibios; + } kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); - iov->num_VFs = nr_virtfn; return 0;
| |