From: Bjorn Helgaas <helgaas@kernel.org>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: alex.williamson@redhat.com,
Liang-Min Wang <liang-min.wang@intel.com>,
kvm@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, bhelgaas@google.com,
alexander.h.duyck@intel.com
Subject: Re: [PATCH] Enable SR-IOV instantiation through /sys file
Date: Mon, 6 Nov 2017 13:55:05 -0600 [thread overview]
Message-ID: <20171106195505.GH31930@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20171024200426.62811-1-jeffrey.t.kirsher@intel.com>
On Tue, Oct 24, 2017 at 01:04:26PM -0700, Jeff Kirsher wrote:
> From: Liang-Min Wang <liang-min.wang@intel.com>
>
> When a SR-IOV supported device is bound with vfio-pci, the driver
> could not create SR-IOV instance through /sys/bus/pci/devices/...
> /sriov_numvfs. This patch re-activates this capability for a PCIe
> device that supports SR-IOV and is bound with vfio-pci.ko.
>
> Signed-off-by: Liang-Min Wang <liang-min.wang@intel.com>
Dropping this for now, given Alex W's issues. Please address his
concerns and repost as needed.
> ---
> drivers/vfio/pci/vfio_pci.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> index f041b1a6cf66..8fbd362607e1 100644
> --- a/drivers/vfio/pci/vfio_pci.c
> +++ b/drivers/vfio/pci/vfio_pci.c
> @@ -1256,6 +1256,7 @@ static void vfio_pci_remove(struct pci_dev *pdev)
> if (!vdev)
> return;
>
> + pci_disable_sriov(pdev);
> vfio_iommu_group_put(pdev->dev.iommu_group, &pdev->dev);
> kfree(vdev->region);
> kfree(vdev);
> @@ -1303,12 +1304,23 @@ static const struct pci_error_handlers vfio_err_handlers = {
> .error_detected = vfio_pci_aer_err_detected,
> };
>
> +static int vfio_sriov_configure(struct pci_dev *pdev, int num_vfs)
> +{
> + if (!num_vfs) {
> + pci_disable_sriov(pdev);
> + return 0;
> + }
> +
> + return pci_enable_sriov(pdev, num_vfs);
> +}
> +
> static struct pci_driver vfio_pci_driver = {
> .name = "vfio-pci",
> .id_table = NULL, /* only dynamic ids */
> .probe = vfio_pci_probe,
> .remove = vfio_pci_remove,
> .err_handler = &vfio_err_handlers,
> + .sriov_configure = vfio_sriov_configure,
> };
>
> struct vfio_devices {
> --
> 2.14.2
>
prev parent reply other threads:[~2017-11-06 19:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 20:04 [PATCH] Enable SR-IOV instantiation through /sys file Jeff Kirsher
2017-10-24 21:43 ` Alex Williamson
2017-10-24 21:49 ` Wang, Liang-min
2017-10-24 22:06 ` Alex Williamson
2017-10-24 22:29 ` Wang, Liang-min
2017-10-25 8:39 ` Alex Williamson
2017-10-27 21:50 ` Wang, Liang-min
2017-10-27 22:19 ` Alex Williamson
2017-10-27 22:30 ` Wang, Liang-min
2017-10-27 23:20 ` Duyck, Alexander H
2017-10-29 6:16 ` Christoph Hellwig
2017-10-29 21:12 ` Alexander Duyck
2017-10-30 12:39 ` David Woodhouse
2017-10-31 12:55 ` Wang, Liang-min
2017-11-06 23:27 ` Alex Williamson
2017-11-06 23:47 ` Alexander Duyck
2017-11-07 16:59 ` Alex Williamson
2017-11-06 19:55 ` Bjorn Helgaas [this message]
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=20171106195505.GH31930@bhelgaas-glaptop.roam.corp.google.com \
--to=helgaas@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=alexander.h.duyck@intel.com \
--cc=bhelgaas@google.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=kvm@vger.kernel.org \
--cc=liang-min.wang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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).