linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned
@ 2016-05-17 21:39 Keith Busch
  2016-05-17 21:39 ` [PATCH 2/2] nvme/pci: Enable SR-IOV capabilities Keith Busch
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Keith Busch @ 2016-05-17 21:39 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas, linux-nvme, Jens Axboe,
	Christoph Hellwig
  Cc: Keith Busch

Every sriov capable driver has to check if any guest is using a virtual
function prior to disabling, so let's make it common code.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/pci/pci-sysfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 342b691..5011fa9 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -487,6 +487,11 @@ static ssize_t sriov_numvfs_store(struct device *dev,
 
 	if (num_vfs == 0) {
 		/* disable VFs */
+		if (pci_vfs_assigned(pdev)) {
+			dev_warn(&pdev->dev,
+				"Cannot disable SR-IOV VFs while assigned\n");
+			return -EPERM;
+		}
 		ret = pdev->driver->sriov_configure(pdev, 0);
 		if (ret < 0)
 			return ret;
-- 
2.7.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-06-15 15:38 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 21:39 [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned Keith Busch
2016-05-17 21:39 ` [PATCH 2/2] nvme/pci: Enable SR-IOV capabilities Keith Busch
2016-05-23 10:52   ` Christoph Hellwig
2016-05-23 17:06   ` Bjorn Helgaas
2016-05-23 17:09     ` Christoph Hellwig
2016-05-23 17:21     ` Keith Busch
2016-05-23 21:51       ` Bjorn Helgaas
2016-05-17 22:08 ` [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned Alex Williamson
2016-05-23 10:55   ` Christoph Hellwig
2016-05-23 15:07     ` Alex Williamson
2016-05-23 15:10       ` Christoph Hellwig
2016-06-13 21:14 ` Bjorn Helgaas
2016-06-13 21:28   ` Keith Busch
2016-06-13 21:57     ` Keith Busch
2016-06-13 22:26       ` Bjorn Helgaas
2016-06-13 22:35         ` Keith Busch
2016-06-15 10:26           ` Christoph Hellwig
2016-06-15 15:38             ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).