[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 13/13] vfio: Make vfio-pci device migration capab
From: |
Kirti Wankhede |
Subject: |
[Qemu-devel] [PATCH v5 13/13] vfio: Make vfio-pci device migration capable. |
Date: |
Tue, 9 Jul 2019 00:47:32 +0530 |
Call vfio_migration_probe() and vfio_migration_finalize() functions for
vfio-pci device to enable migration for vfio PCI device.
Removed vfio_pci_vmstate structure.
Signed-off-by: Kirti Wankhede <address@hidden>
Reviewed-by: Neo Jia <address@hidden>
---
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 5fe4f8076cac..2ea17a814d55 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2852,6 +2852,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
vdev->vbasedev.ops = &vfio_pci_ops;
vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
vdev->vbasedev.dev = DEVICE(vdev);
+ vdev->vbasedev.device_state = 0;
tmp = g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev);
len = readlink(tmp, group_path, sizeof(group_path));
@@ -3112,6 +3113,12 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
}
}
+ ret = vfio_migration_probe(&vdev->vbasedev, errp);
+ if (ret) {
+ error_report("%s: Failed to setup for migration",
+ vdev->vbasedev.name);
+ }
+
vfio_register_err_notifier(vdev);
vfio_register_req_notifier(vdev);
vfio_setup_resetfn_quirk(vdev);
@@ -3131,6 +3138,7 @@ static void vfio_instance_finalize(Object *obj)
VFIOPCIDevice *vdev = PCI_VFIO(obj);
VFIOGroup *group = vdev->vbasedev.group;
+ vdev->vbasedev.device_state = 0;
vfio_display_finalize(vdev);
vfio_bars_finalize(vdev);
g_free(vdev->emulated_config_bits);
@@ -3159,6 +3167,7 @@ static void vfio_exitfn(PCIDevice *pdev)
}
vfio_teardown_msi(vdev);
vfio_bars_exit(vdev);
+ vfio_migration_finalize(&vdev->vbasedev);
}
static void vfio_pci_reset(DeviceState *dev)
@@ -3267,11 +3276,6 @@ static Property vfio_pci_dev_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
-static const VMStateDescription vfio_pci_vmstate = {
- .name = "vfio-pci",
- .unmigratable = 1,
-};
-
static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -3279,7 +3283,6 @@ static void vfio_pci_dev_class_init(ObjectClass *klass,
void *data)
dc->reset = vfio_pci_reset;
dc->props = vfio_pci_dev_properties;
- dc->vmsd = &vfio_pci_vmstate;
dc->desc = "VFIO-based PCI device assignment";
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
pdc->realize = vfio_realize;
--
2.7.0
- [Qemu-devel] [PATCH v5 03/13] vfio: Add vfio_get_object callback to VFIODeviceOps, (continued)
- [Qemu-devel] [PATCH v5 03/13] vfio: Add vfio_get_object callback to VFIODeviceOps, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 04/13] vfio: Add save and load functions for VFIO PCI devices, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 06/13] vfio: Add VM state change handler to know state of VM, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 07/13] vfio: Add migration state change notifier, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 08/13] vfio: Register SaveVMHandlers for VFIO device, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 05/13] vfio: Add migration region initialization and finalize function, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 09/13] vfio: Add save state functions to SaveVMHandlers, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 10/13] vfio: Add load state functions to SaveVMHandlers, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 11/13] vfio: Add function to get dirty page list, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 12/13] vfio: Add vfio_listerner_log_sync to mark dirty pages, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 13/13] vfio: Make vfio-pci device migration capable.,
Kirti Wankhede <=
- Re: [Qemu-devel] [PATCH v5 00/13] Add migration support for VFIO device, no-reply, 2019/07/08
- Re: [Qemu-devel] [PATCH v5 00/13] Add migration support for VFIO device, no-reply, 2019/07/08