* of the IGD device.
*/
int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
- struct vfio_region_info *info)
+ struct vfio_region_info *info, Error **errp)
{
int ret;
ret = pread(vdev->vbasedev.fd, vdev->igd_opregion,
info->size, info->offset);
if (ret != info->size) {
- error_report("vfio: Error reading IGD OpRegion");
+ error_setg(errp, "failed to read IGD OpRegion");
g_free(vdev->igd_opregion);
vdev->igd_opregion = NULL;
return -EINVAL;
}
/* Setup OpRegion access */
- ret = vfio_pci_igd_opregion_init(vdev, opregion);
+ ret = vfio_pci_igd_opregion_init(vdev, opregion, &err);
if (ret) {
- error_report("IGD device %s failed to setup OpRegion, "
- "legacy mode disabled", vdev->vbasedev.name);
+ error_append_hint(&err, "IGD legacy mode disabled\n");
+ error_reportf_err(err, ERR_PREFIX, vdev->vbasedev.name);
goto out;
}
goto out_teardown;
}
- ret = vfio_pci_igd_opregion_init(vdev, opregion);
+ ret = vfio_pci_igd_opregion_init(vdev, opregion, &err);
g_free(opregion);
if (ret) {
- error_setg_errno(&err, -ret, "IGD OpRegion initialization failed");
goto out_teardown;
}
}
int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp);
int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
- struct vfio_region_info *info);
+ struct vfio_region_info *info,
+ Error **errp);
#endif /* HW_VFIO_VFIO_PCI_H */