From: Shenming Lu Date: Wed, 10 Mar 2021 03:02:32 +0000 (+0800) Subject: vfio: Set the priority of the VFIO VM state change handler explicitly X-Git-Tag: v6.0.0-rc0~27^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ce1ff990eff6affbdd0492fe4fc95e113235e35;p=thirdparty%2Fqemu.git vfio: Set the priority of the VFIO VM state change handler explicitly In the VFIO VM state change handler when stopping the VM, the _RUNNING bit in device_state is cleared which makes the VFIO device stop, including no longer generating interrupts. Then we can save the pending states of all interrupts in the GIC VM state change handler (on ARM). So we have to set the priority of the VFIO VM state change handler explicitly (like virtio devices) to ensure it is called before the GIC's in saving. Signed-off-by: Shenming Lu Reviewed-by: Kirti Wankhede Reviewed-by: Cornelia Huck Message-Id: <20210310030233.1133-3-lushenming@huawei.com> Signed-off-by: Alex Williamson --- diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 003786f3cd9..eafb778947c 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -862,7 +862,8 @@ static int vfio_migration_init(VFIODevice *vbasedev, register_savevm_live(id, VMSTATE_INSTANCE_ID_ANY, 1, &savevm_vfio_handlers, vbasedev); - migration->vm_state = qemu_add_vm_change_state_handler(vfio_vmstate_change, + migration->vm_state = qdev_add_vm_change_state_handler(vbasedev->dev, + vfio_vmstate_change, vbasedev); migration->migration_state.notify = vfio_migration_state_notifier; add_migration_state_change_notifier(&migration->migration_state);