summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/vfio/migration.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index ef397ebe6c..82f654afb6 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -724,7 +724,16 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state)
          * _RUNNING bit
          */
         mask = ~VFIO_DEVICE_STATE_RUNNING;
-        value = 0;
+
+        /*
+         * When VM state transition to stop for savevm command, device should
+         * start saving data.
+         */
+        if (state == RUN_STATE_SAVE_VM) {
+            value = VFIO_DEVICE_STATE_SAVING;
+        } else {
+            value = 0;
+        }
     }
 
     ret = vfio_migration_set_state(vbasedev, mask, value);