[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 04/16] vfio/pci: Pass an error object to vfio_msi
From: |
Eric Auger |
Subject: |
[Qemu-devel] [PATCH v3 04/16] vfio/pci: Pass an error object to vfio_msix_early_setup |
Date: |
Sun, 2 Oct 2016 20:50:02 +0000 |
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>
---
v1 -> v2:
- this patch now comes before the actual realize migration
- mention in the commit message we are no more silent on above errors
---
hw/vfio/pci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 8f825bd..d1967a2 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);
- if (ret) {
- return ret;
+ ret = vfio_msix_early_setup(vdev, &err);
+ if (err) {
+ goto error;
}
vfio_bars_setup(vdev);
--
1.9.1
- [Qemu-devel] [PATCH v3 00/16] Convert VFIO-PCI to realize, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 01/16] vfio/pci: Use local error object in vfio_initfn, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 02/16] vfio/pci: Pass an error object to vfio_populate_vga, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 03/16] vfio/pci: Pass an error object to vfio_populate_device, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 06/16] vfio/pci: Pass an error object to vfio_add_capabilities, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 05/16] vfio/pci: Pass an error object to vfio_intx_enable, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 07/16] vfio/pci: Pass an error object to vfio_pci_igd_opregion_init, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 04/16] vfio/pci: Pass an error object to vfio_msix_early_setup,
Eric Auger <=
- [Qemu-devel] [PATCH v3 08/16] vfio: Pass an error object to vfio_get_group, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 11/16] vfio/platform: fix a wrong returned value in vfio_populate_device, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 10/16] vfio/platform: Pass an error object to vfio_populate_device, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 09/16] vfio: Pass an error object to vfio_get_device, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 12/16] vfio/platform: Pass an error object to vfio_base_device_init, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 14/16] vfio/pci: Remove vfio_msix_early_setup returned value, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 15/16] vfio/pci: Remove vfio_populate_device returned value, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 13/16] vfio/pci: Conversion to realize, Eric Auger, 2016/10/02
- [Qemu-devel] [PATCH v3 16/16] vfio/pci: Handle host oversight, Eric Auger, 2016/10/02