On Tue, 5 May 2020 04:14:40 +0530 Kirti Wankhede <kwankh...@nvidia.com> wrote:
> - Migration functions are implemented for VFIO_DEVICE_TYPE_PCI device in this > patch series. I would drop this sentence; people looking at this patch in the future are unlikely to care. > - VFIO device supports migration or not is decided based of migration region "Whether the VFIO device..." s/based of/based on/ > query. If migration region query is successful and migration region > initialization is successful then migration is supported else migration is > blocked. > > Signed-off-by: Kirti Wankhede <kwankh...@nvidia.com> > Reviewed-by: Neo Jia <c...@nvidia.com> > --- > hw/vfio/Makefile.objs | 2 +- > hw/vfio/migration.c | 138 > ++++++++++++++++++++++++++++++++++++++++++ > hw/vfio/trace-events | 3 + > include/hw/vfio/vfio-common.h | 9 +++ > 4 files changed, 151 insertions(+), 1 deletion(-) > create mode 100644 hw/vfio/migration.c > +int vfio_migration_probe(VFIODevice *vbasedev, Error **errp) > +{ > + struct vfio_region_info *info; > + Error *local_err = NULL; > + int ret; > + > + ret = vfio_get_dev_region_info(vbasedev, VFIO_REGION_TYPE_MIGRATION, > + VFIO_REGION_SUBTYPE_MIGRATION, &info); > + if (ret) { > + goto add_blocker; > + } > + > + ret = vfio_migration_init(vbasedev, info); > + if (ret) { > + goto add_blocker; > + } > + > + trace_vfio_migration_probe(vbasedev->name, info->index); > + return 0; > + > +add_blocker: > + error_setg(&vbasedev->migration_blocker, > + "VFIO device doesn't support migration"); > + ret = migrate_add_blocker(vbasedev->migration_blocker, &local_err); > + if (local_err) { Rather check for ret? > + error_propagate(errp, local_err); > + error_free(vbasedev->migration_blocker); vbasedev->migration_blocker = NULL; ? > + } > + return ret; I think you also need to free info somewhere? > +}