From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eric Auger <eric.auger@redhat.com>,
Markus Armbruster <armbru@redhat.com>
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 [thread overview]
Message-ID: <20161017195318.17307.94201.stgit@gimli.home> (raw)
In-Reply-To: <20161017194945.17307.78340.stgit@gimli.home>
From: Eric Auger <eric.auger@redhat.com>
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 <eric.auger@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
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);
}
next prev parent reply other threads:[~2016-10-17 19:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 19:51 [Qemu-devel] [PULL 00/19] VFIO updates 2016-10-17 Alex Williamson
2016-10-17 19:51 ` [Qemu-devel] [PULL 01/19] vfio/pci: Use local error object in vfio_initfn Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 02/19] vfio/pci: Pass an error object to vfio_populate_vga Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 03/19] vfio/pci: Pass an error object to vfio_populate_device Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 04/19] vfio/pci: Pass an error object to vfio_msix_early_setup Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 05/19] vfio/pci: Pass an error object to vfio_intx_enable Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 06/19] vfio/pci: Pass an error object to vfio_add_capabilities Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 07/19] vfio/pci: Pass an error object to vfio_pci_igd_opregion_init Alex Williamson
2016-10-17 19:52 ` [Qemu-devel] [PULL 08/19] vfio: Pass an Error object to vfio_connect_container Alex Williamson
2016-10-17 19:53 ` [Qemu-devel] [PULL 09/19] vfio: Pass an error object to vfio_get_group Alex Williamson
2016-10-17 19:53 ` [Qemu-devel] [PULL 10/19] vfio: Pass an error object to vfio_get_device Alex Williamson
2016-10-17 19:53 ` Alex Williamson [this message]
2016-10-17 19:53 ` [Qemu-devel] [PULL 12/19] vfio/platform: fix a wrong returned value in vfio_populate_device Alex Williamson
2016-10-17 19:53 ` [Qemu-devel] [PULL 13/19] vfio/platform: Pass an error object to vfio_base_device_init Alex Williamson
2016-10-17 19:53 ` [Qemu-devel] [PULL 14/19] vfio/pci: Conversion to realize Alex Williamson
2016-10-17 19:53 ` [Qemu-devel] [PULL 15/19] vfio/pci: Remove vfio_msix_early_setup returned value Alex Williamson
2016-10-17 19:54 ` [Qemu-devel] [PULL 16/19] vfio/pci: Remove vfio_populate_device " Alex Williamson
2016-10-17 19:54 ` [Qemu-devel] [PULL 17/19] vfio/pci: Handle host oversight Alex Williamson
2016-10-17 19:54 ` [Qemu-devel] [PULL 18/19] vfio/pci: Fix vfio_rtl8168_quirk_data_read address offset Alex Williamson
2016-10-17 19:54 ` [Qemu-devel] [PULL 19/19] vfio: fix duplicate function call Alex Williamson
2016-10-18 11:34 ` [Qemu-devel] [PULL 00/19] VFIO updates 2016-10-17 Peter Maydell
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=20161017195318.17307.94201.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=eric.auger@redhat.com \
--cc=qemu-devel@nongnu.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).