From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zowo6-0002eV-6P for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:04:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zowo2-00066C-TG for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:04:10 -0400 Received: from mga14.intel.com ([192.55.52.115]:13830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zowo2-000662-Nq for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:04:06 -0400 From: Lan Tianyu Date: Thu, 22 Oct 2015 00:52:36 +0800 Message-Id: <1445446357-5539-3-git-send-email-tianyu.lan@intel.com> In-Reply-To: <1445446357-5539-1-git-send-email-tianyu.lan@intel.com> References: <1445446357-5539-1-git-send-email-tianyu.lan@intel.com> Subject: [Qemu-devel] [RFC PATCH 2/3] Qemu: Add post_load_state() to run after restoring CPU state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: amit.shah@redhat.com, eblake@redhat.com, eddie.dong@intel.com, nrupal.jani@intel.com, yang.z.zhang@intel.com, agraf@suse.de, kvm@vger.kernel.org, pbonzini@redhat.com, qemu-devel@nongnu.org, emil.s.tantilov@intel.com, ehabkost@redhat.com, lcapitulino@redhat.com, lersek@redhat.com, mst@redhat.com, quintela@redhat.com, rth@twiddle.net Cc: Lan Tianyu 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 --- include/migration/vmstate.h | 2 ++ migration/savevm.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 0695d7c..dc681a6 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -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; diff --git a/migration/savevm.c b/migration/savevm.c index 9e0e286..48b6223 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -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; -- 1.9.3