vfio/migration: Rename entry points
Pick names that align with the section drivers should use them from, avoiding the confusion of calling a _finalize() function from _exit() and generalizing the actual _finalize() to handle removing the viommu blocker. Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Link: https://lore.kernel.org/r/167820912978.606734.12740287349119694623.stgit@omen Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
333f988d19
commit
8249cffc62
@ -447,7 +447,7 @@ int vfio_block_giommu_migration(Error **errp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfio_unblock_giommu_migration(void)
|
void vfio_migration_finalize(void)
|
||||||
{
|
{
|
||||||
if (!giommu_migration_blocker ||
|
if (!giommu_migration_blocker ||
|
||||||
vfio_viommu_preset()) {
|
vfio_viommu_preset()) {
|
||||||
|
@ -521,7 +521,7 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_migration_exit(VFIODevice *vbasedev)
|
static void vfio_migration_free(VFIODevice *vbasedev)
|
||||||
{
|
{
|
||||||
g_free(vbasedev->migration);
|
g_free(vbasedev->migration);
|
||||||
vbasedev->migration = NULL;
|
vbasedev->migration = NULL;
|
||||||
@ -631,7 +631,7 @@ int64_t vfio_mig_bytes_transferred(void)
|
|||||||
return bytes_transferred;
|
return bytes_transferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
|
int vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
|
||||||
{
|
{
|
||||||
int ret = -ENOTSUP;
|
int ret = -ENOTSUP;
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ add_blocker:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfio_migration_finalize(VFIODevice *vbasedev)
|
void vfio_migration_exit(VFIODevice *vbasedev)
|
||||||
{
|
{
|
||||||
if (vbasedev->migration) {
|
if (vbasedev->migration) {
|
||||||
VFIOMigration *migration = vbasedev->migration;
|
VFIOMigration *migration = vbasedev->migration;
|
||||||
@ -677,7 +677,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev)
|
|||||||
remove_migration_state_change_notifier(&migration->migration_state);
|
remove_migration_state_change_notifier(&migration->migration_state);
|
||||||
qemu_del_vm_change_state_handler(migration->vm_state);
|
qemu_del_vm_change_state_handler(migration->vm_state);
|
||||||
unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev);
|
unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev);
|
||||||
vfio_migration_exit(vbasedev);
|
vfio_migration_free(vbasedev);
|
||||||
vfio_unblock_multiple_devices_migration();
|
vfio_unblock_multiple_devices_migration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3145,7 +3145,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pdev->failover_pair_id) {
|
if (!pdev->failover_pair_id) {
|
||||||
ret = vfio_migration_probe(vbasedev, errp);
|
ret = vfio_migration_realize(vbasedev, errp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("%s: Migration disabled", vbasedev->name);
|
error_report("%s: Migration disabled", vbasedev->name);
|
||||||
}
|
}
|
||||||
@ -3185,7 +3185,7 @@ static void vfio_instance_finalize(Object *obj)
|
|||||||
*/
|
*/
|
||||||
vfio_put_device(vdev);
|
vfio_put_device(vdev);
|
||||||
vfio_put_group(group);
|
vfio_put_group(group);
|
||||||
vfio_unblock_giommu_migration();
|
vfio_migration_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_exitfn(PCIDevice *pdev)
|
static void vfio_exitfn(PCIDevice *pdev)
|
||||||
@ -3204,7 +3204,7 @@ static void vfio_exitfn(PCIDevice *pdev)
|
|||||||
}
|
}
|
||||||
vfio_teardown_msi(vdev);
|
vfio_teardown_msi(vdev);
|
||||||
vfio_bars_exit(vdev);
|
vfio_bars_exit(vdev);
|
||||||
vfio_migration_finalize(&vdev->vbasedev);
|
vfio_migration_exit(&vdev->vbasedev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_pci_reset(DeviceState *dev)
|
static void vfio_pci_reset(DeviceState *dev)
|
||||||
|
@ -223,7 +223,6 @@ bool vfio_mig_active(void);
|
|||||||
int vfio_block_multiple_devices_migration(Error **errp);
|
int vfio_block_multiple_devices_migration(Error **errp);
|
||||||
void vfio_unblock_multiple_devices_migration(void);
|
void vfio_unblock_multiple_devices_migration(void);
|
||||||
int vfio_block_giommu_migration(Error **errp);
|
int vfio_block_giommu_migration(Error **errp);
|
||||||
void vfio_unblock_giommu_migration(void);
|
|
||||||
int64_t vfio_mig_bytes_transferred(void);
|
int64_t vfio_mig_bytes_transferred(void);
|
||||||
|
|
||||||
#ifdef CONFIG_LINUX
|
#ifdef CONFIG_LINUX
|
||||||
@ -247,7 +246,8 @@ int vfio_spapr_create_window(VFIOContainer *container,
|
|||||||
int vfio_spapr_remove_window(VFIOContainer *container,
|
int vfio_spapr_remove_window(VFIOContainer *container,
|
||||||
hwaddr offset_within_address_space);
|
hwaddr offset_within_address_space);
|
||||||
|
|
||||||
int vfio_migration_probe(VFIODevice *vbasedev, Error **errp);
|
int vfio_migration_realize(VFIODevice *vbasedev, Error **errp);
|
||||||
void vfio_migration_finalize(VFIODevice *vbasedev);
|
void vfio_migration_exit(VFIODevice *vbasedev);
|
||||||
|
void vfio_migration_finalize(void);
|
||||||
|
|
||||||
#endif /* HW_VFIO_VFIO_COMMON_H */
|
#endif /* HW_VFIO_VFIO_COMMON_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user