linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
To: helgaas@kernel.org, bhelgaas@google.com,
	benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au
Cc: seroyer@linux.vnet.ibm.com, jjalvare@linux.vnet.ibm.com,
	alex.williamson@redhat.com, linux-pci@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, bodong@mellanox.com,
	eli@mellanox.com, saeedm@mellanox.com,
	"Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
Subject: [PATCH v5 3/3] PCI/IOV: Add pci_vf_drivers_autoprobe() interface
Date: Thu,  9 Nov 2017 08:00:35 -0600	[thread overview]
Message-ID: <20171109140035.64975-4-bryantly@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171109140035.64975-1-bryantly@linux.vnet.ibm.com>

Add a pci_vf_drivers_autoprobe() interface.  Setting autoprobe to false
on the PF prevents drivers from binding to VFs when they are enabled.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Juan J. Alvarez <jjalvare@linux.vnet.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/powerpc/platforms/pseries/pci.c |  2 ++
 drivers/pci/iov.c                    | 11 +++++++++++
 include/linux/pci.h                  |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 14a90cf471cc..48d3af026f90 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -63,6 +63,7 @@ int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
 {
 	/* Allocate PCI data */
 	add_dev_pci_data(pdev);
+	pci_vf_drivers_autoprobe(pdev, false);
 	return 0;
 }
 
@@ -70,6 +71,7 @@ int pseries_pcibios_sriov_disable(struct pci_dev *pdev)
 {
 	/* Release PCI data */
 	remove_dev_pci_data(pdev);
+	pci_vf_drivers_autoprobe(pdev, true);
 	return 0;
 }
 #endif
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index ac41c8be9200..1440e48094f4 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -634,6 +634,17 @@ void pci_restore_iov_state(struct pci_dev *dev)
 }
 
 /**
+ * pci_vf_drivers_autoprobe - set PF property drivers_autoprobe for VFs
+ * @dev: the PCI device
+ * @auto_probe: set VF drivers auto probe flag
+ */
+void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool auto_probe)
+{
+	if (dev->is_physfn)
+		dev->sriov->drivers_autoprobe = auto_probe;
+}
+
+/**
  * pci_iov_bus_range - find bus range used by Virtual Function
  * @bus: the PCI bus
  *
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f4f8ee5a7362..17a08554baa2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1965,6 +1965,7 @@ int pci_vfs_assigned(struct pci_dev *dev);
 int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
 int pci_sriov_get_totalvfs(struct pci_dev *dev);
 resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
+void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);
 #else
 static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
 {
@@ -1992,6 +1993,7 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
 { return 0; }
 static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
 { return 0; }
+static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
 #endif
 
 #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
-- 
2.13.6 (Apple Git-96)

  parent reply	other threads:[~2017-11-09 14:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 14:00 [PATCH v5 0/3] Prepartion for SR-IOV PowerVM Enablement Bryant G. Ly
2017-11-09 14:00 ` [PATCH v5 1/3] powerpc/kernel: Separate SR-IOV Calls Bryant G. Ly
2017-12-12 11:39   ` [v5,1/3] " Michael Ellerman
2017-11-09 14:00 ` [PATCH v5 2/3] pseries: Add PSeries SR-IOV Machine dependent calls Bryant G. Ly
2017-11-09 14:00 ` Bryant G. Ly [this message]
2017-11-29 16:13 ` [PATCH v5 0/3] Prepartion for SR-IOV PowerVM Enablement Bryant G. Ly
2017-12-01 11:48   ` Michael Ellerman
2017-12-03  1:45 ` Alexey Kardashevskiy
2017-12-04 15:08   ` Bryant G. Ly
2017-12-05  1:24     ` Alexey Kardashevskiy
2017-12-05 15:13       ` Bryant G. Ly
2017-12-08  6:03         ` Alexey Kardashevskiy
2017-12-08 14:52           ` Bryant G. Ly
2017-12-04  4:48 ` Russell Currey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171109140035.64975-4-bryantly@linux.vnet.ibm.com \
    --to=bryantly@linux.vnet.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=bodong@mellanox.com \
    --cc=eli@mellanox.com \
    --cc=helgaas@kernel.org \
    --cc=jjalvare@linux.vnet.ibm.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=saeedm@mellanox.com \
    --cc=seroyer@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).