[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH QEMU v25 04/17] vfio: Add migration region initialization and
From: |
Cornelia Huck |
Subject: |
Re: [PATCH QEMU v25 04/17] vfio: Add migration region initialization and finalize function |
Date: |
Tue, 23 Jun 2020 09:54:31 +0200 |
On Sun, 21 Jun 2020 01:51:13 +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/Makefile.objs | 2 +-
> hw/vfio/migration.c | 142
> ++++++++++++++++++++++++++++++++++++++++++
> hw/vfio/trace-events | 3 +
> include/hw/vfio/vfio-common.h | 9 +++
> 4 files changed, 155 insertions(+), 1 deletion(-)
> create mode 100644 hw/vfio/migration.c
(...)
> +static int vfio_migration_region_init(VFIODevice *vbasedev, int index)
> +{
> + VFIOMigration *migration = vbasedev->migration;
> + Object *obj = NULL;
> + int ret = -EINVAL;
> +
> + if (!vbasedev->ops->vfio_get_object) {
> + return ret;
> + }
> +
> + obj = vbasedev->ops->vfio_get_object(vbasedev);
> + if (!obj) {
> + return ret;
> + }
> +
> + ret = vfio_region_setup(obj, vbasedev, &migration->region, index,
> + "migration");
> + if (ret) {
> + error_report("%s: Failed to setup VFIO migration region %d: %s",
> + vbasedev->name, index, strerror(-ret));
> + goto err;
> + }
> +
> + if (!migration->region.size) {
> + ret = -EINVAL;
> + error_report("%s: Invalid region size of VFIO migration region %d:
> %s",
> + vbasedev->name, index, strerror(-ret));
Instead of only checking for size != 0, should we also check that the
region has a certain expected size or minimum size?
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + vfio_migration_region_exit(vbasedev);
> + return ret;
> +}
> +
(...)
Else looks good to me.
[PATCH QEMU v25 04/17] vfio: Add migration region initialization and finalize function, Kirti Wankhede, 2020/06/20
- Re: [PATCH QEMU v25 04/17] vfio: Add migration region initialization and finalize function,
Cornelia Huck <=
[PATCH QEMU v25 05/17] vfio: Add VM state change handler to know state of VM, Kirti Wankhede, 2020/06/20
Re: [PATCH QEMU v25 05/17] vfio: Add VM state change handler to know state of VM, Cornelia Huck, 2020/06/23
[PATCH QEMU v25 06/17] vfio: Add migration state change notifier, Kirti Wankhede, 2020/06/20
[PATCH QEMU v25 07/17] vfio: Register SaveVMHandlers for VFIO device, Kirti Wankhede, 2020/06/20