From patchwork Mon Oct 11 16:07:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 67452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D4A1CB6EFF for ; Tue, 12 Oct 2010 04:04:31 +1100 (EST) Received: from localhost ([127.0.0.1]:54609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5LnX-0000Vj-G2 for incoming@patchwork.ozlabs.org; Mon, 11 Oct 2010 13:04:27 -0400 Received: from [140.186.70.92] (port=58874 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5KvV-000067-OC for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:08:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5KvA-0002aD-W5 for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:08:37 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:33126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5KvA-0002WD-Sy for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:08:16 -0400 X-IronPort-AV: E=Sophos;i="4.57,314,1283745600"; d="scan'208";a="117578016" Received: from ftlpexchmx02.citrite.net ([10.9.154.127]) by FTLPIPO02.CITRIX.COM with ESMTP; 11 Oct 2010 12:08:16 -0400 Received: from smtp01.ad.xensource.com ([10.219.128.104]) by FTLPEXCHMX02.citrite.net with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Oct 2010 12:08:16 -0400 Received: from perard.cam.xci-test.com (perard.cam.xci-test.com [10.80.248.106]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id o9BG7ZXA001204; Mon, 11 Oct 2010 09:08:15 -0700 From: anthony.perard@citrix.com To: qemu-devel@nongnu.org Date: Mon, 11 Oct 2010 17:07:10 +0100 Message-Id: <1286813230-17539-15-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1286813230-17539-1-git-send-email-anthony.perard@citrix.com> References: <1286813230-17539-1-git-send-email-anthony.perard@citrix.com> X-OriginalArrivalTime: 11 Oct 2010 16:08:16.0365 (UTC) FILETIME=[837709D0:01CB695E] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony PERARD , xen-devel@lists.xensource.com, Stefano.Stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH V5 14/14] acpi-piix4: Add Xen hypercall for sleep state. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD Signed-off-by: Anthony PERARD --- hw/acpi_piix4.c | 4 ++++ hw/xen.h | 2 ++ xen-all.c | 7 +++++++ xen-stub.c | 4 ++++ 4 files changed, 17 insertions(+), 0 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index c8733e5..058bd5f 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -23,6 +23,7 @@ #include "acpi.h" #include "sysemu.h" #include "range.h" +#include "xen.h" //#define DEBUG @@ -168,6 +169,9 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val) if (s->cmos_s3) { qemu_irq_raise(s->cmos_s3); } + if (xen_enabled()) { + xen_set_hvm_sleep_state(); + } default: break; } diff --git a/hw/xen.h b/hw/xen.h index 0261ae6..23796bc 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -38,6 +38,8 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); void xen_piix3_set_irq(void *opaque, int irq_num, int level); void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len); +void xen_set_hvm_sleep_state(void); + int xen_init(int smp_cpus); #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY) diff --git a/xen-all.c b/xen-all.c index fc862cb..11a5911 100644 --- a/xen-all.c +++ b/xen-all.c @@ -459,6 +459,13 @@ static void xen_main_loop_prepare(XenIOState *state) } +/* ACPI */ + +void xen_set_hvm_sleep_state(void) +{ + xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3); +} + /* Initialise Xen */ static void xen_vm_change_state_handler(void *opaque, int running, int reason) diff --git a/xen-stub.c b/xen-stub.c index c9f477d..d22f475 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -28,6 +28,10 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size) { } +void xen_set_hvm_sleep_state(void) +{ +} + int xen_init(int smp_cpus) { return -ENOSYS;