Patchwork Re: [PATCH V9 16/16] xen: Add Xen hypercall for sleep state in the cmos_s3 callback.

login
register
mail settings
Submitter Anthony PERARD
Date Jan. 26, 2011, 2:36 p.m.
Message ID <1296052615-17814-1-git-send-email-anthony.perard@citrix.com>
Download mbox | patch
Permalink /patch/80511/
State New
Headers show

Comments

Anthony PERARD - Jan. 26, 2011, 2:36 p.m.
From: Anthony PERARD <anthony.perard@citrix.com>

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/xen_machine_fv.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Anthony Liguori - Jan. 26, 2011, 11:14 p.m.
On 01/26/2011 08:36 AM, anthony.perard@citrix.com wrote:
> From: Anthony PERARD<anthony.perard@citrix.com>
>
> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
> ---
>   hw/xen_machine_fv.c |   11 ++++++++++-
>   1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
> index 0a90312..f48b978 100644
> --- a/hw/xen_machine_fv.c
> +++ b/hw/xen_machine_fv.c
> @@ -38,9 +38,18 @@
>   #include "xen/hvm/hvm_info_table.h"
>   #include "xen_platform.h"
>   #include "xen_common.h"
> +#include "xen_backend.h"
>
>   #define MAX_IDE_BUS 2
>
> +static void xen_cmos_set_s3_resume(void *opaque, int irq, int level)
> +{
> +    pc_cmos_set_s3_resume(opaque, irq, level);
> +    if (level) {
> +        xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3);
> +    }
> +}
> +
>    

Ack.

Regards,

Anthony Liguori

>   static void xen_init_fv(ram_addr_t ram_size,
>                           const char *boot_device,
>                           const char *kernel_filename,
> @@ -132,7 +141,7 @@ static void xen_init_fv(ram_addr_t ram_size,
>       }
>
>       if (acpi_enabled) {
> -        cmos_s3 = qemu_allocate_irqs(pc_cmos_set_s3_resume, rtc_state, 1);
> +        cmos_s3 = qemu_allocate_irqs(xen_cmos_set_s3_resume, rtc_state, 1);
>           smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
>           piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
>                         isa_reserve_irq(9), *cmos_s3, *smi_irq, 0);
>

Patch

diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index 0a90312..f48b978 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -38,9 +38,18 @@ 
 #include "xen/hvm/hvm_info_table.h"
 #include "xen_platform.h"
 #include "xen_common.h"
+#include "xen_backend.h"
 
 #define MAX_IDE_BUS 2
 
+static void xen_cmos_set_s3_resume(void *opaque, int irq, int level)
+{
+    pc_cmos_set_s3_resume(opaque, irq, level);
+    if (level) {
+        xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3);
+    }
+}
+
 static void xen_init_fv(ram_addr_t ram_size,
                         const char *boot_device,
                         const char *kernel_filename,
@@ -132,7 +141,7 @@  static void xen_init_fv(ram_addr_t ram_size,
     }
 
     if (acpi_enabled) {
-        cmos_s3 = qemu_allocate_irqs(pc_cmos_set_s3_resume, rtc_state, 1);
+        cmos_s3 = qemu_allocate_irqs(xen_cmos_set_s3_resume, rtc_state, 1);
         smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
         piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
                       isa_reserve_irq(9), *cmos_s3, *smi_irq, 0);