@@ -56,6 +56,8 @@ typedef struct SaveVMHandlers {
int (*save_live_setup)(QEMUFile *f, void *opaque);
uint64_t (*save_live_pending)(QEMUFile *f, void *opaque, uint64_t max_size);
+ /* This runs after restoring CPU related state */
+ void (*post_load_state)(void *opaque);
LoadStateHandler *load_state;
} SaveVMHandlers;
@@ -702,6 +702,20 @@ bool qemu_savevm_state_blocked(Error **errp)
return false;
}
+void qemu_savevm_post_load(void)
+{
+ SaveStateEntry *se;
+
+ QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
+ if (!se->ops || !se->ops->post_load_state) {
+ continue;
+ }
+
+ se->ops->post_load_state(se->opaque);
+ }
+}
+
+
void qemu_savevm_state_header(QEMUFile *f)
{
trace_savevm_state_header();
@@ -1140,6 +1154,7 @@ int qemu_loadvm_state(QEMUFile *f)
}
cpu_synchronize_all_post_init();
+ qemu_savevm_post_load();
ret = 0;
After migration, Qemu needs to trigger mailbox irq to notify VF driver in the guest about status change. The irq delivery restarts to work after restoring CPU state. This patch is to add new callback to run after restoring CPU state and provide a way to trigger mailbox irq later. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> --- include/migration/vmstate.h | 2 ++ migration/savevm.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+)