diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index b81cb7e23b0cd6551e445df0dff00ed2ae581df6..8c27298477065a28c65f3aeac13eb02ad68917ac 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -720,7 +720,7 @@ static void vfio_vmstate_change_prepare(void *opaque, bool running, static void vfio_vmstate_change(void *opaque, bool running, RunState state) { VFIODevice *vbasedev = opaque; - enum vfio_device_mig_state new_state; + enum vfio_device_mig_state new_state, pre_state; int ret; if (running) { @@ -733,6 +733,8 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state) VFIO_DEVICE_STATE_STOP; } + pre_state = vbasedev->migration->device_state; + /* * If setting the device in new_state fails, the device should be reset. * To do so, use ERROR state as a recover state. @@ -747,6 +749,10 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state) if (migrate_get_current()->to_dst_file) { qemu_file_set_error(migrate_get_current()->to_dst_file, ret); } + + if (pre_state == VFIO_DEVICE_STATE_RESUMING) { + exit(EXIT_FAILURE); + } } trace_vfio_vmstate_change(vbasedev->name, running, RunState_str(state),