From patchwork Wed Sep 25 16:51:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 277929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 952482C00C5 for ; Thu, 26 Sep 2013 02:52:50 +1000 (EST) Received: from localhost ([::1]:53959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOsKV-0006gk-En for incoming@patchwork.ozlabs.org; Wed, 25 Sep 2013 12:52:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOsJx-0006fv-Ev for qemu-devel@nongnu.org; Wed, 25 Sep 2013 12:52:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOsJs-0002kC-Qw for qemu-devel@nongnu.org; Wed, 25 Sep 2013 12:52:13 -0400 Received: from smtp.citrix.com ([66.165.176.89]:51042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOsJs-0002k1-MZ for qemu-devel@nongnu.org; Wed, 25 Sep 2013 12:52:08 -0400 X-IronPort-AV: E=Sophos;i="4.90,979,1371081600"; d="scan'208";a="57338128" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 25 Sep 2013 16:52:06 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Wed, 25 Sep 2013 12:52:06 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1VOsJk-0008KP-PH; Wed, 25 Sep 2013 17:52:00 +0100 From: Stefano Stabellini To: Date: Wed, 25 Sep 2013 17:51:21 +0100 Message-ID: <1380127883-6421-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Anthony.Perard@citrix.com, "Liu, Jinsong" , xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini Subject: [Qemu-devel] [PULL 2/4] qemu: Add qemu xen logic for Xen HVM S3 resume X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu, Jinsong This patch is qemu patch 2 to fix Xen HVM S3 bug, adding qemu xen logic. When qemu wakeup, qemu xen logic is notified and hypercall to xen hypervisor to unpause domain. Signed-off-by: Liu Jinsong Signed-off-by: Stefano Stabellini Reviewed-by: Anthony PERARD --- xen-all.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/xen-all.c b/xen-all.c index 839f14f..10af44c 100644 --- a/xen-all.c +++ b/xen-all.c @@ -98,6 +98,7 @@ typedef struct XenIOState { Notifier exit; Notifier suspend; + Notifier wakeup; } XenIOState; /* Xen specific function for piix pci */ @@ -1060,6 +1061,11 @@ static void xen_read_physmap(XenIOState *state) free(entries); } +static void xen_wakeup_notifier(Notifier *notifier, void *data) +{ + xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); +} + int xen_hvm_init(MemoryRegion **ram_memory) { int i, rc; @@ -1089,6 +1095,9 @@ int xen_hvm_init(MemoryRegion **ram_memory) state->suspend.notify = xen_suspend_notifier; qemu_register_suspend_notifier(&state->suspend); + state->wakeup.notify = xen_wakeup_notifier; + qemu_register_wakeup_notifier(&state->wakeup); + xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn); DPRINTF("shared page at pfn %lx\n", ioreq_pfn); state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE,