[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ioemu: HVM virtual S3
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1211290099 -3600 # Node ID 34ac0d3b5bfb59c7133a53061bfe8933faf404ef # Parent 4b4b829e34a233b5b9d1d3112cad069da58d9517 ioemu: HVM virtual S3 - add S3 suspend logic in PM1A control register. when guest write specific value to this register, QEMU will trigger S3 sleep by * reset all qemu device * set CMOS shutdown status as S3 resume, so that rombios will do S3 resume later * request Xen to S3-suspend the guest Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx> Signed-off-by: Liping Ke <liping.ke@xxxxxxxxx? Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/ioemu/hw/pc.c | 8 ++++++++ tools/ioemu/hw/piix4acpi.c | 11 +++++++++++ tools/ioemu/target-i386-dm/helper2.c | 4 ++++ tools/ioemu/vl.h | 1 + 4 files changed, 24 insertions(+) diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/hw/pc.c --- a/tools/ioemu/hw/pc.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/hw/pc.c Tue May 20 14:28:19 2008 +0100 @@ -1121,6 +1121,14 @@ static void pc_init_isa(uint64_t ram_siz initrd_filename, 0, NULL); } +/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE) + BIOS will read it and start S3 resume at POST Entry*/ +void cmos_set_s3_resume(void) +{ + if (rtc_state) + rtc_set_memory(rtc_state, 0xF, 0xFE); +} + QEMUMachine pc_machine = { "pc", "Standard PC", diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/hw/piix4acpi.c --- a/tools/ioemu/hw/piix4acpi.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/hw/piix4acpi.c Tue May 20 14:28:19 2008 +0100 @@ -25,6 +25,7 @@ #include "vl.h" #include <xen/hvm/ioreq.h> +#include <xen/hvm/params.h> /* PM1a_CNT bits, as defined in the ACPI specification. */ #define SCI_EN (1 << 0) @@ -35,6 +36,7 @@ /* Sleep state type codes as defined by the \_Sx objects in the DSDT. */ /* These must be kept in sync with the DSDT (hvmloader/acpi/dsdt.asl) */ #define SLP_TYP_S4 (6 << 10) +#define SLP_TYP_S3 (5 << 10) #define SLP_TYP_S5 (7 << 10) #define ACPI_DBG_IO_ADDR 0xb044 @@ -78,6 +80,8 @@ typedef struct PHPSlots { } PHPSlots; PHPSlots php_slots; + +int s3_shutdown_flag; static void piix4acpi_save(QEMUFile *f, void *opaque) { @@ -118,6 +122,13 @@ static void acpi_shutdown(uint32_t val) return; switch (val & SLP_TYP_Sx) { + case SLP_TYP_S3: + s3_shutdown_flag = 1; + qemu_system_reset(); + s3_shutdown_flag = 0; + cmos_set_s3_resume(); + xc_set_hvm_param(xc_handle, domid, HVM_PARAM_ACPI_S_STATE, 3); + break; case SLP_TYP_S4: case SLP_TYP_S5: qemu_system_shutdown_request(); diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/target-i386-dm/helper2.c Tue May 20 14:28:19 2008 +0100 @@ -133,8 +133,12 @@ CPUX86State *cpu_x86_init(void) /* called from main_cpu_reset */ void cpu_reset(CPUX86State *env) { + extern int s3_shutdown_flag; int xcHandle; int sts; + + if (s3_shutdown_flag) + return; xcHandle = xc_interface_open(); if (xcHandle < 0) diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/vl.h --- a/tools/ioemu/vl.h Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/vl.h Tue May 20 14:28:19 2008 +0100 @@ -1181,6 +1181,7 @@ extern int fd_bootchk; void ioport_set_a20(int enable); int ioport_get_a20(void); +void cmos_set_s3_resume(void); /* ppc.c */ extern QEMUMachine prep_machine; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |