summaryrefslogtreecommitdiff
path: root/hw/vfio/common.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2016-03-10 09:39:07 -0700
committerAlex Williamson <alex.williamson@redhat.com>2016-03-10 09:39:07 -0700
commit469002263a295ec471c1498c3b456ccd9f85a841 (patch)
tree71ee90f35f8dc2d6887047e5cb07e4009301e01e /hw/vfio/common.c
parent7df9381b7aa56c897e344f3bfe43bf5848bbd3e0 (diff)
downloadqemu-469002263a295ec471c1498c3b456ccd9f85a841.zip
vfio: Wrap VFIO_DEVICE_GET_REGION_INFO
In preparation for supporting capability chains on regions, wrap ioctl(VFIO_DEVICE_GET_REGION_INFO) so we don't duplicate the code for each caller. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/common.c')
-rw-r--r--hw/vfio/common.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 607ec70be3..e20fc4f794 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -959,6 +959,24 @@ void vfio_put_base_device(VFIODevice *vbasedev)
close(vbasedev->fd);
}
+int vfio_get_region_info(VFIODevice *vbasedev, int index,
+ struct vfio_region_info **info)
+{
+ size_t argsz = sizeof(struct vfio_region_info);
+
+ *info = g_malloc0(argsz);
+
+ (*info)->index = index;
+ (*info)->argsz = argsz;
+
+ if (ioctl(vbasedev->fd, VFIO_DEVICE_GET_REGION_INFO, *info)) {
+ g_free(*info);
+ return -errno;
+ }
+
+ return 0;
+}
+
static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid,
int req, void *param)
{