[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/19] vfio/pci: Pass an error object to vfio_msix_ea
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PULL 04/19] vfio/pci: Pass an error object to vfio_msix_early_setup |
Date: |
Mon, 17 Oct 2016 13:52:22 -0600 |
User-agent: |
StGit/0.17.1-dirty |
From: Eric Auger <address@hidden>
Pass an error object to prepare for migration to VFIO-PCI realize.
The returned value will be removed later on.
We now format an error in case of reading failure for
- the MSIX flags
- the MSIX table,
- the MSIX PBA.
Signed-off-by: Eric Auger <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>
---
hw/vfio/pci.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 46e3cb8..02e92b0 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1277,7 +1277,7 @@ static void vfio_pci_fixup_msix_region(VFIOPCIDevice
*vdev)
* need to first look for where the MSI-X table lives. So we
* unfortunately split MSI-X setup across two functions.
*/
-static int vfio_msix_early_setup(VFIOPCIDevice *vdev)
+static int vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
{
uint8_t pos;
uint16_t ctrl;
@@ -1292,16 +1292,19 @@ static int vfio_msix_early_setup(VFIOPCIDevice *vdev)
if (pread(fd, &ctrl, sizeof(ctrl),
vdev->config_offset + pos + PCI_MSIX_FLAGS) != sizeof(ctrl)) {
+ error_setg_errno(errp, errno, "failed to read PCI MSIX FLAGS");
return -errno;
}
if (pread(fd, &table, sizeof(table),
vdev->config_offset + pos + PCI_MSIX_TABLE) != sizeof(table)) {
+ error_setg_errno(errp, errno, "failed to read PCI MSIX TABLE");
return -errno;
}
if (pread(fd, &pba, sizeof(pba),
vdev->config_offset + pos + PCI_MSIX_PBA) != sizeof(pba)) {
+ error_setg_errno(errp, errno, "failed to read PCI MSIX PBA");
return -errno;
}
@@ -1332,8 +1335,8 @@ static int vfio_msix_early_setup(VFIOPCIDevice *vdev)
(vdev->device_id & 0xff00) == 0x5800) {
msix->pba_offset = 0x1000;
} else {
- error_report("vfio: Hardware reports invalid configuration, "
- "MSIX PBA outside of specified BAR");
+ error_setg(errp, "hardware reports invalid configuration, "
+ "MSIX PBA outside of specified BAR");
g_free(msix);
return -EINVAL;
}
@@ -2657,9 +2660,9 @@ static int vfio_initfn(PCIDevice *pdev)
vfio_pci_size_rom(vdev);
- ret = vfio_msix_early_setup(vdev);
+ ret = vfio_msix_early_setup(vdev, &err);
if (ret) {
- return ret;
+ goto error;
}
vfio_bars_setup(vdev);
- [Qemu-devel] [PULL 00/19] VFIO updates 2016-10-17, Alex Williamson, 2016/10/17
- [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 <=
- [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, 2016/10/17
- [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