[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/19] vfio/platform: Pass an error object to vfio_po
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PULL 11/19] vfio/platform: Pass an error object to vfio_populate_device |
Date: |
Mon, 17 Oct 2016 13:53:20 -0600 |
User-agent: |
StGit/0.17.1-dirty |
From: Eric Auger <address@hidden>
Propagate the vfio_populate_device errors up to vfio_base_device_init.
The error object also is passed to vfio_init_intp. At the moment we
only report the error. Subsequent patches will propagate the error
up to the realize function.
Signed-off-by: Eric Auger <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>
---
hw/vfio/platform.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index 9014ea7..1a35da0 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -44,9 +44,10 @@ static inline bool vfio_irq_is_automasked(VFIOINTp *intp)
* and add it into the list of IRQs
* @vbasedev: the VFIO device handle
* @info: irq info struct retrieved from VFIO driver
+ * @errp: error object
*/
static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
- struct vfio_irq_info info)
+ struct vfio_irq_info info, Error **errp)
{
int ret;
VFIOPlatformDevice *vdev =
@@ -69,7 +70,8 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
if (ret) {
g_free(intp->interrupt);
g_free(intp);
- error_report("vfio: Error: trigger event_notifier_init failed ");
+ error_setg_errno(errp, -ret,
+ "failed to initialize trigger eventd notifier");
return NULL;
}
if (vfio_irq_is_automasked(intp)) {
@@ -80,7 +82,8 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
g_free(intp->interrupt);
g_free(intp->unmask);
g_free(intp);
- error_report("vfio: Error: resamplefd event_notifier_init failed");
+ error_setg_errno(errp, -ret,
+ "failed to initialize resample eventd notifier");
return NULL;
}
}
@@ -456,9 +459,10 @@ static int vfio_platform_hot_reset_multi(VFIODevice
*vbasedev)
* vfio_populate_device - Allocate and populate MMIO region
* and IRQ structs according to driver returned information
* @vbasedev: the VFIO device handle
+ * @errp: error object
*
*/
-static int vfio_populate_device(VFIODevice *vbasedev)
+static int vfio_populate_device(VFIODevice *vbasedev, Error **errp)
{
VFIOINTp *intp, *tmp;
int i, ret = -1;
@@ -466,7 +470,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
container_of(vbasedev, VFIOPlatformDevice, vbasedev);
if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) {
- error_report("vfio: Um, this isn't a platform device");
+ error_setg(errp, "this isn't a platform device");
return ret;
}
@@ -480,7 +484,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
vdev->regions[i], i, name);
g_free(name);
if (ret) {
- error_report("vfio: Error getting region %d info: %m", i);
+ error_setg_errno(errp, -ret, "failed to get region %d info", i);
goto reg_error;
}
}
@@ -496,16 +500,14 @@ static int vfio_populate_device(VFIODevice *vbasedev)
irq.index = i;
ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
if (ret) {
- error_report("vfio: error getting device %s irq info",
- vbasedev->name);
+ error_setg_errno(errp, -ret, "failed to get device irq info");
goto irq_err;
} else {
trace_vfio_platform_populate_interrupts(irq.index,
irq.count,
irq.flags);
- intp = vfio_init_intp(vbasedev, irq);
+ intp = vfio_init_intp(vbasedev, irq, errp);
if (!intp) {
- error_report("vfio: Error installing IRQ %d up", i);
goto irq_err;
}
}
@@ -613,9 +615,8 @@ static int vfio_base_device_init(VFIODevice *vbasedev)
goto error;
}
- ret = vfio_populate_device(vbasedev);
+ ret = vfio_populate_device(vbasedev, &err);
if (ret) {
- error_report("vfio: failed to populate device %s", vbasedev->name);
vfio_put_group(group);
}
- [Qemu-devel] [PULL 01/19] vfio/pci: Use local error object in vfio_initfn, (continued)
- [Qemu-devel] [PULL 01/19] vfio/pci: Use local error object in vfio_initfn, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 02/19] vfio/pci: Pass an error object to vfio_populate_vga, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 03/19] vfio/pci: Pass an error object to vfio_populate_device, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 04/19] vfio/pci: Pass an error object to vfio_msix_early_setup, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 05/19] vfio/pci: Pass an error object to vfio_intx_enable, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 06/19] vfio/pci: Pass an error object to vfio_add_capabilities, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 07/19] vfio/pci: Pass an error object to vfio_pci_igd_opregion_init, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 08/19] vfio: Pass an Error object to vfio_connect_container, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 09/19] vfio: Pass an error object to vfio_get_group, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 10/19] vfio: Pass an error object to vfio_get_device, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 11/19] vfio/platform: Pass an error object to vfio_populate_device,
Alex Williamson <=
- [Qemu-devel] [PULL 12/19] vfio/platform: fix a wrong returned value in vfio_populate_device, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 13/19] vfio/platform: Pass an error object to vfio_base_device_init, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 14/19] vfio/pci: Conversion to realize, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 15/19] vfio/pci: Remove vfio_msix_early_setup returned value, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 16/19] vfio/pci: Remove vfio_populate_device returned value, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 17/19] vfio/pci: Handle host oversight, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 18/19] vfio/pci: Fix vfio_rtl8168_quirk_data_read address offset, Alex Williamson, 2016/10/17
- [Qemu-devel] [PULL 19/19] vfio: fix duplicate function call, Alex Williamson, 2016/10/17
- Re: [Qemu-devel] [PULL 00/19] VFIO updates 2016-10-17, Peter Maydell, 2016/10/18