From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jason Wang <jasowang@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org,
kvm@vger.kernel.org
Subject: [PATCH v2 1/2] vfio: report group noiommu status
Date: Tue, 30 Aug 2016 05:27:14 +0300 [thread overview]
Message-ID: <1472523968-9540-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1472523968-9540-1-git-send-email-mst@redhat.com>
When using vfio, callers might want to know whether device is added
to a regular group or an non-iommu group.
Report this status from vfio_is_noiommu_group_dev.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/linux/vfio.h | 2 ++
drivers/vfio/vfio.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 0ecae0b..584757b 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -51,6 +51,8 @@ extern int vfio_add_group_dev(struct device *dev,
const struct vfio_device_ops *ops,
void *device_data);
+extern bool vfio_is_noiommu_group_dev(struct device *dev);
+
extern void *vfio_del_group_dev(struct device *dev);
extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
extern void vfio_device_put(struct vfio_device *device);
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index d1d70e0..22f279f 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -872,6 +872,18 @@ static bool vfio_dev_present(struct vfio_group *group, struct device *dev)
}
/*
+ * Is device part of a noiommu group?
+ * Note: must call vfio_add_group_dev first.
+ */
+bool vfio_is_noiommu_group_dev(struct device *dev)
+{
+ struct vfio_device *device = dev_get_drvdata(dev);
+ struct vfio_group *group = device->group;
+
+ return group->noiommu;
+}
+
+/*
* Decrement the device reference count and wait for the device to be
* removed. Open file descriptors for the device... */
void *vfio_del_group_dev(struct device *dev)
--
MST
next prev parent reply other threads:[~2016-08-30 2:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 2:27 [PATCH v2 0/2] vfio: blacklist legacy virtio devices Michael S. Tsirkin
2016-08-30 2:27 ` Michael S. Tsirkin [this message]
2016-08-30 2:27 ` [PATCH v2 2/2] vfio: add virtio pci quirk Michael S. Tsirkin
2016-08-30 3:23 ` Alex Williamson
2016-08-30 3:48 ` Michael S. Tsirkin
2016-08-30 3:52 ` Alex Williamson
2016-08-30 3:57 ` Michael S. Tsirkin
2016-08-30 4:53 ` Alex Williamson
2016-08-30 5:20 ` Michael S. Tsirkin
2016-08-30 12:46 ` Alex Williamson
2016-08-30 9:59 ` kbuild test robot
2016-08-30 3:16 ` [Qemu-devel] [PATCH v2 0/2] vfio: blacklist legacy virtio devices Jason Wang
2016-08-30 3:49 ` Michael S. Tsirkin
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=1472523968-9540-2-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=virtualization@lists.linux-foundation.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).