lkml.org 
[lkml]   [2024]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/2] PCI/IOV: set iov->num_VFs before VFs are probed
Date
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;

\
 
 \ /
  Last update: 2024-05-27 15:04    [W:0.035 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site