From: Alex Williamson <alex.williamson@redhat.com>
To: Ilya Lesokhin <ilyal@mellanox.com>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org,
bhelgaas@google.com, noaos@mellanox.com, haggaie@mellanox.com,
ogerlitz@mellanox.com, liranl@mellanox.com
Subject: Re: [PATCH 1/4] VFIO: Probe new devices in a live VFIO group with the VFIO driver
Date: Thu, 9 Jun 2016 16:21:39 -0600 [thread overview]
Message-ID: <20160609162139.13eb22b4@ul30vt.home> (raw)
In-Reply-To: <1465474173-53960-2-git-send-email-ilyal@mellanox.com>
On Thu, 9 Jun 2016 15:09:29 +0300
Ilya Lesokhin <ilyal@mellanox.com> wrote:
> When a new device is added to a live VFIO group,
> use driver_override to force the device to be probed by
> the VFIO driver.
>
> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
> ---
> drivers/vfio/vfio.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 6fd6fa5..32bc1b4 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -646,6 +646,7 @@ static int vfio_dev_viable(struct device *dev, void *data)
> static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev)
> {
> struct vfio_device *device;
> + struct pci_dev *pdev;
>
> /* Do we already know about it? We shouldn't */
> device = vfio_group_get_device(group, dev);
> @@ -658,10 +659,19 @@ static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev)
> if (!atomic_read(&group->container_users))
> return 0;
>
> - /* TODO Prevent device auto probing */
> - WARN(1, "Device %s added to live group %d!\n", dev_name(dev),
> - iommu_group_id(group->iommu_group));
> -
> + if (dev_is_pci(dev)) {
declare pdev here.
> + /* a device that shares a group with another VFIO
> + * device should also be probed by VFIO
> + */
Use existing comment style:
/*
* comment
*/
> + pdev = to_pci_dev(dev);
> + if (pdev->driver_override)
> + kfree(pdev->driver_override);
> + pdev->driver_override = kstrdup("vfio-pci", GFP_KERNEL);
kstrdup can fail. Probably want to issue a dev_info message about
capturing the device as well. Thanks,
Alex
> + } else {
> + /* TODO Prevent device auto probing */
> + WARN(1, "Device %s added to live group %d!\n", dev_name(dev),
> + iommu_group_id(group->iommu_group));
> + }
> return 0;
> }
>
next prev parent reply other threads:[~2016-06-09 22:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 12:09 [PATCH 0/4] VFIO SR-IOV support Ilya Lesokhin
2016-06-09 12:09 ` [PATCH 1/4] VFIO: Probe new devices in a live VFIO group with the VFIO driver Ilya Lesokhin
2016-06-09 22:21 ` Alex Williamson [this message]
2016-06-13 6:33 ` Ilya Lesokhin
2016-06-13 16:02 ` Alex Williamson
2016-06-09 12:09 ` [PATCH 2/4] IOMMU: Force the VFs of an untrusted PF device to be in the PFs IOMMU group Ilya Lesokhin
2016-06-09 12:56 ` kbuild test robot
2016-06-09 15:21 ` kbuild test robot
2016-06-09 22:21 ` Alex Williamson
2016-06-13 7:08 ` Ilya Lesokhin
2016-06-13 16:00 ` Alex Williamson
2016-06-16 12:46 ` Ilya Lesokhin
2016-06-09 12:09 ` [PATCH 3/4] PCI: Expose iov_set_numvfs and iov_resource_size for modules Ilya Lesokhin
2016-06-09 12:27 ` kbuild test robot
2016-06-09 12:09 ` [PATCH 4/4] VFIO: Add support for SR-IOV extended capablity Ilya Lesokhin
2016-06-09 12:09 ` [PATCH 4/4] VFIO: Add support for SRIOV " Ilya Lesokhin
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=20160609162139.13eb22b4@ul30vt.home \
--to=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=haggaie@mellanox.com \
--cc=ilyal@mellanox.com \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liranl@mellanox.com \
--cc=noaos@mellanox.com \
--cc=ogerlitz@mellanox.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).