From patchwork Thu Oct 21 17:36:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 68732 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 BB825B6F11 for ; Fri, 22 Oct 2010 05:00:36 +1100 (EST) Received: from localhost ([127.0.0.1]:57753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8zRI-0001y9-Ck for incoming@patchwork.ozlabs.org; Thu, 21 Oct 2010 14:00:32 -0400 Received: from [140.186.70.92] (port=43053 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8z5T-0000pM-QI for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8z5Q-0005qa-SH for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:37:58 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:52050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8z5Q-0005jY-Gk for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:37:56 -0400 X-IronPort-AV: E=Sophos;i="4.58,218,1286164800"; d="scan'208";a="119106478" Received: from ftlpexchmx02.citrite.net ([10.9.154.127]) by FTLPIPO02.CITRIX.COM with ESMTP; 21 Oct 2010 13:37:55 -0400 Received: from smtp01.ad.xensource.com ([10.219.128.104]) by FTLPEXCHMX02.citrite.net with Microsoft SMTPSVC(6.0.3790.4675); Thu, 21 Oct 2010 13:37:54 -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 o9LHb2iv009642; Thu, 21 Oct 2010 10:37:54 -0700 From: anthony.perard@citrix.com To: QEMU-devel Date: Thu, 21 Oct 2010 18:36:27 +0100 Message-Id: <1287682587-18642-16-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1287682587-18642-1-git-send-email-anthony.perard@citrix.com> References: <1287682587-18642-1-git-send-email-anthony.perard@citrix.com> X-OriginalArrivalTime: 21 Oct 2010 17:37:54.0964 (UTC) FILETIME=[B17D9D40:01CB7146] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony PERARD , Xen Devel , Stefano Stabellini Subject: [Qemu-devel] [PATCH V6 15/15] 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 f74f34c..c9a3694 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 @@ -172,6 +173,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;