From patchwork Sun Sep 1 09:54:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Jinsong" X-Patchwork-Id: 271588 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 8CA412C0082 for ; Sun, 1 Sep 2013 19:54:41 +1000 (EST) Received: from localhost ([::1]:33222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4Mh-0001aN-RQ for incoming@patchwork.ozlabs.org; Sun, 01 Sep 2013 05:54:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4MM-0001TK-1j for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VG4MG-00059D-W7 for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:54:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:18316) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4MG-000597-JS for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:54:12 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 01 Sep 2013 02:54:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,1001,1367996400"; d="scan'208,223";a="389525654" Received: from fmsmsx105.amr.corp.intel.com ([10.19.9.36]) by fmsmga001.fm.intel.com with ESMTP; 01 Sep 2013 02:54:11 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.19.9.53) by FMSMSX105.amr.corp.intel.com (10.19.9.36) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sun, 1 Sep 2013 02:54:11 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX102.amr.corp.intel.com (10.19.9.53) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sun, 1 Sep 2013 02:54:10 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.99]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.227]) with mapi id 14.03.0123.003; Sun, 1 Sep 2013 17:54:04 +0800 From: "Liu, Jinsong" To: Anthony PERARD , Stefano Stabellini Thread-Topic: [PATCH 2/2] qemu-xen: add qemu xen logic for HVM S3 resume Thread-Index: AQHOpZG3n22gM+PNSE2jwdSv1v3CmZmwponQ Date: Sun, 1 Sep 2013 09:54:02 +0000 Message-ID: References: <5220B3A3.4000100@citrix.com> In-Reply-To: <5220B3A3.4000100@citrix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.20 Cc: George Dunlap , "qemu-devel@nongnu.org" , Ian Campbell , "xen-devel@lists.xen.org" Subject: [Qemu-devel] [PATCH 2/2] qemu-xen: add qemu xen logic for 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 e7d4bd70eae8da131dc3ff2cec70cb2c7b6575a9 Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Mon, 2 Sep 2013 00:39:20 +0800 Subject: [PATCH 2/2] qemu-xen: add qemu xen logic for HVM S3 resume This patch is qemu-xen patch 2 to fix 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 Acked-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 15be8ed..bef946b 100644 --- a/xen-all.c +++ b/xen-all.c @@ -97,6 +97,7 @@ typedef struct XenIOState { Notifier exit; Notifier suspend; + Notifier later_wakeup; } XenIOState; /* Xen specific function for piix pci */ @@ -139,6 +140,11 @@ static void xen_suspend_notifier(Notifier *notifier, void *data) xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3); } +static void xen_later_wakeup_notifier(Notifier *notifier, void *data) +{ + xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); +} + /* Xen Interrupt Controller */ static void xen_set_irq(void *opaque, int irq, int level) @@ -1106,6 +1112,9 @@ int xen_hvm_init(void) state->suspend.notify = xen_suspend_notifier; qemu_register_suspend_notifier(&state->suspend); + state->later_wakeup.notify = xen_later_wakeup_notifier; + qemu_register_later_wakeup_notifier(&state->later_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,