[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v27 04/17] vfio: Add migration region initialization and fina
From: |
Cornelia Huck |
Subject: |
Re: [PATCH v27 04/17] vfio: Add migration region initialization and finalize function |
Date: |
Fri, 23 Oct 2020 13:17:06 +0200 |
On Thu, 22 Oct 2020 16:41:54 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:
> Whether the VFIO device supports migration or not is decided based of
> migration region 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 <kwankhede@nvidia.com>
> Reviewed-by: Neo Jia <cjia@nvidia.com>
> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hw/vfio/meson.build | 1 +
> hw/vfio/migration.c | 129
> ++++++++++++++++++++++++++++++++++++++++++
> hw/vfio/trace-events | 3 +
> include/hw/vfio/vfio-common.h | 9 +++
> 4 files changed, 142 insertions(+)
> create mode 100644 hw/vfio/migration.c
(...)
> +static int vfio_migration_init(VFIODevice *vbasedev,
> + struct vfio_region_info *info)
> +{
> + int ret;
> + Object *obj;
> + VFIOMigration *migration;
> +
> + if (!vbasedev->ops->vfio_get_object) {
> + return -EINVAL;
> + }
> +
> + obj = vbasedev->ops->vfio_get_object(vbasedev);
> + if (!obj) {
> + return -EINVAL;
> + }
> +
> + migration = g_new0(VFIOMigration, 1);
> +
> + ret = vfio_region_setup(obj, vbasedev, &migration->region,
> + info->index, "migration");
> + if (ret) {
> + error_report("%s: Failed to setup VFIO migration region %d: %s",
> + vbasedev->name, info->index, strerror(-ret));
> + goto err;
> + }
> +
> + if (!migration->region.size) {
> + error_report("%s: Invalid zero-sized of VFIO migration region %d",
s/of //
> + vbasedev->name, info->index);
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + vbasedev->migration = migration;
> + return 0;
> +
> +err:
> + vfio_migration_region_exit(vbasedev);
> + g_free(migration);
> + return ret;
> +}
(...)
- [PATCH v27 00/17] Add migration support for VFIO devices, Kirti Wankhede, 2020/10/22
- [PATCH v27 01/17] vfio: Add function to unmap VFIO region, Kirti Wankhede, 2020/10/22
- [PATCH v27 02/17] vfio: Add vfio_get_object callback to VFIODeviceOps, Kirti Wankhede, 2020/10/22
- [PATCH v27 04/17] vfio: Add migration region initialization and finalize function, Kirti Wankhede, 2020/10/22
- [PATCH v27 06/17] vfio: Add migration state change notifier, Kirti Wankhede, 2020/10/22
- [PATCH v27 07/17] vfio: Register SaveVMHandlers for VFIO device, Kirti Wankhede, 2020/10/22
- [PATCH v27 03/17] vfio: Add save and load functions for VFIO PCI devices, Kirti Wankhede, 2020/10/22
- [PATCH v27 08/17] vfio: Add save state functions to SaveVMHandlers, Kirti Wankhede, 2020/10/22
- [PATCH v27 09/17] vfio: Add load state functions to SaveVMHandlers, Kirti Wankhede, 2020/10/22