From patchwork Tue Nov 24 13:35:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 7691311 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 995CB9F2E9 for ; Tue, 24 Nov 2015 13:51:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD19F207D7 for ; Tue, 24 Nov 2015 13:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E62B5207E6 for ; Tue, 24 Nov 2015 13:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754275AbbKXNvT (ORCPT ); Tue, 24 Nov 2015 08:51:19 -0500 Received: from mga11.intel.com ([192.55.52.93]:27403 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754249AbbKXNvD (ORCPT ); Tue, 24 Nov 2015 08:51:03 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 24 Nov 2015 05:51:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="858390160" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.159.159]) by orsmga002.jf.intel.com with ESMTP; 24 Nov 2015 05:50:58 -0800 From: Lan Tianyu To: aik@ozlabs.ru, alex.williamson@redhat.com, amit.shah@redhat.com, anthony@codemonkey.ws, ard.biesheuvel@linaro.org, blauwirbel@gmail.com, cornelia.huck@de.ibm.com, eddie.dong@intel.com, nrupal.jani@intel.com, agraf@suse.de, kvm@vger.kernel.org, pbonzini@redhat.com, qemu-devel@nongnu.org, emil.s.tantilov@intel.com, gerlitz.or@gmail.com, donald.c.skidmore@intel.com, mark.d.rustad@intel.com, mst@redhat.com, kraxel@redhat.com, lcapitulino@redhat.com, quintela@redhat.com Cc: Lan Tianyu Subject: [RFC PATCH V2 07/10] Qemu: Add post_load_state() to run after restoring CPU state Date: Tue, 24 Nov 2015 21:35:24 +0800 Message-Id: <1448372127-28115-8-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1448372127-28115-1-git-send-email-tianyu.lan@intel.com> References: <1448372127-28115-1-git-send-email-tianyu.lan@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;