summary refs log tree commit diff stats
path: root/hw/vfio/common.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2016-10-17 10:58:00 -0600
committerAlex Williamson <alex.williamson@redhat.com>2016-10-17 10:58:00 -0600
commit59f7d6743ccbe17587e491dc5d79cad8bf31f76a (patch)
tree3604c71c03d57f9db444221bfa530756912fbeb1 /hw/vfio/common.c
parent1b808d5be070e9d07e5d0e5b825a31a0cf87001d (diff)
downloadfocaccia-qemu-59f7d6743ccbe17587e491dc5d79cad8bf31f76a.tar.gz
focaccia-qemu-59f7d6743ccbe17587e491dc5d79cad8bf31f76a.zip
vfio: Pass an error object to vfio_get_device
Pass an error object to prepare for migration to VFIO-PCI realize.

In vfio platform vfio_base_device_init we currently just report the
error. Subsequent patches will propagate the error up to the realize
function.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/common.c')
-rw-r--r--hw/vfio/common.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 90b1ebba2c..9505fb3040 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -1211,23 +1211,24 @@ void vfio_put_group(VFIOGroup *group)
 }
 
 int vfio_get_device(VFIOGroup *group, const char *name,
-                       VFIODevice *vbasedev)
+                    VFIODevice *vbasedev, Error **errp)
 {
     struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) };
     int ret, fd;
 
     fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name);
     if (fd < 0) {
-        error_report("vfio: error getting device %s from group %d: %m",
-                     name, group->groupid);
-        error_printf("Verify all devices in group %d are bound to vfio-<bus> "
-                     "or pci-stub and not already in use\n", group->groupid);
+        error_setg_errno(errp, errno, "error getting device from group %d",
+                         group->groupid);
+        error_append_hint(errp,
+                      "Verify all devices in group %d are bound to vfio-<bus> "
+                      "or pci-stub and not already in use\n", group->groupid);
         return fd;
     }
 
     ret = ioctl(fd, VFIO_DEVICE_GET_INFO, &dev_info);
     if (ret) {
-        error_report("vfio: error getting device info: %m");
+        error_setg_errno(errp, errno, "error getting device info");
         close(fd);
         return ret;
     }