WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2 of 2] Add configuration options to selectively disa

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2 of 2] Add configuration options to selectively disable S3 and S4 ACPI power states
From: Paul Durrant <paul.durrant@xxxxxxxxxx>
Date: Fri, 18 Nov 2011 11:19:31 +0000
Cc: paul.durrant@xxxxxxxxxx
Delivery-date: Fri, 18 Nov 2011 03:26:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1321615169@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1321615169@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Paul Durrant <paul.durrant@xxxxxxxxxx>
# Date 1321615161 0
# Node ID 5118aa3562ea7d9a3d8fb742d378f9347ae62836
# Parent  8a29891d6a98002b299d73253935c161ecf393a1
Add configuration options to selectively disable S3 and S4 ACPI power states.

Introduce acpi_s3 and acpi_s4 configuration options (default=1). The S3 and S4
packages are moved into separate SSDTs and their inclusion is controlled by the
new configuration options.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

diff -r 8a29891d6a98 -r 5118aa3562ea tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile    Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/Makefile    Fri Nov 18 11:19:21 2011 +0000
@@ -26,7 +26,7 @@ CFLAGS += $(CFLAGS_xeninclude)
 vpath iasl $(PATH)
 all: acpi.a
 
-ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
+ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
        iasl -vs -p $* -tc $<
        sed -e 's/AmlCode/$*/g' $*.hex >$@
        rm -f $*.hex $*.aml
@@ -57,7 +57,7 @@ iasl:
        @echo 
        @exit 1
 
-build.o: ssdt_pm.h ssdt_tpm.h
+build.o: ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h
 
 acpi.a: $(OBJS)
        $(AR) rc $@ $(OBJS)
diff -r 8a29891d6a98 -r 5118aa3562ea tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c     Fri Nov 18 11:19:21 2011 +0000
@@ -17,6 +17,8 @@
  */
 
 #include "acpi2_0.h"
+#include "ssdt_s3.h"
+#include "ssdt_s4.h"
 #include "ssdt_tpm.h"
 #include "ssdt_pm.h"
 #include "../config.h"
@@ -235,6 +237,26 @@ static int construct_secondary_tables(un
         table_ptrs[nr_tables++] = (unsigned long)ssdt;
     }
 
+    if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1) )
+    {
+        ssdt = mem_alloc(sizeof(ssdt_s3), 16);
+        if (!ssdt) return -1;
+        memcpy(ssdt, ssdt_s3, sizeof(ssdt_s3));
+        table_ptrs[nr_tables++] = (unsigned long)ssdt;
+    } else {
+        printf("S3 disabled\n");
+    }
+
+    if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1) )
+    {
+        ssdt = mem_alloc(sizeof(ssdt_s4), 16);
+        if (!ssdt) return -1;
+        memcpy(ssdt, ssdt_s4, sizeof(ssdt_s4));
+        table_ptrs[nr_tables++] = (unsigned long)ssdt;
+    } else {
+        printf("S4 disabled\n");
+    }
+
     /* TPM TCPA and SSDT. */
     tis_hdr = (uint16_t *)0xFED40F00;
     if ( (tis_hdr[0] == tis_signature[0]) &&
diff -r 8a29891d6a98 -r 5118aa3562ea tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl    Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl    Fri Nov 18 11:19:21 2011 +0000
@@ -27,24 +27,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
     Name (\APCL, 0x00010000)
     Name (\PUID, 0x00)
 
-    /*
-     * S3 (suspend-to-ram), S4 (suspend-to-disc) and S5 (power-off) type codes:
-     * must match piix4 emulation.
-     */
-    Name (\_S3, Package (0x04)
-    {
-        0x01,  /* PM1a_CNT.SLP_TYP */
-        0x01,  /* PM1b_CNT.SLP_TYP */
-        0x0,   /* reserved */
-        0x0    /* reserved */
-    })
-    Name (\_S4, Package (0x04)
-    {
-        0x00,  /* PM1a_CNT.SLP_TYP */
-        0x00,  /* PM1b_CNT.SLP_TYP */
-        0x00,  /* reserved */
-        0x00   /* reserved */
-    })
+    /* _S3 and _S4 are in separate SSDTs */
     Name (\_S5, Package (0x04)
     {
         0x00,  /* PM1a_CNT.SLP_TYP */
diff -r 8a29891d6a98 -r 5118aa3562ea tools/firmware/hvmloader/acpi/ssdt_s3.asl
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/acpi/ssdt_s3.asl Fri Nov 18 11:19:21 2011 +0000
@@ -0,0 +1,32 @@
+/*
+ * ssdt_s3.asl
+ *
+ * Copyright (c) 2011  Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+DefinitionBlock ("SSDT_S3.aml", "SSDT", 2, "Xen", "HVM", 0)
+{
+    /* Must match piix emulation */
+    Name (\_S3, Package (0x04)
+    {
+        0x01,  /* PM1a_CNT.SLP_TYP */
+        0x01,  /* PM1b_CNT.SLP_TYP */
+        0x0,   /* reserved */
+        0x0    /* reserved */
+    })
+}
+
diff -r 8a29891d6a98 -r 5118aa3562ea tools/firmware/hvmloader/acpi/ssdt_s4.asl
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/acpi/ssdt_s4.asl Fri Nov 18 11:19:21 2011 +0000
@@ -0,0 +1,32 @@
+/*
+ * ssdt_s4.asl
+ *
+ * Copyright (c) 2011  Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+DefinitionBlock ("SSDT_S4.aml", "SSDT", 2, "Xen", "HVM", 0)
+{
+    /* Must match piix emulation */
+    Name (\_S4, Package (0x04)
+    {
+        0x00,  /* PM1a_CNT.SLP_TYP */
+        0x00,  /* PM1b_CNT.SLP_TYP */
+        0x00,  /* reserved */
+        0x00   /* reserved */
+    })
+}
+
diff -r 8a29891d6a98 -r 5118aa3562ea tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/libxl/libxl_create.c        Fri Nov 18 11:19:21 2011 +0000
@@ -93,6 +93,8 @@ int libxl_init_build_info(libxl_ctx *ctx
         b_info->u.hvm.pae = 1;
         b_info->u.hvm.apic = 1;
         b_info->u.hvm.acpi = 1;
+        b_info->u.hvm.acpi_s3 = 1;
+        b_info->u.hvm.acpi_s4 = 1;
         b_info->u.hvm.nx = 1;
         b_info->u.hvm.viridian = 0;
         b_info->u.hvm.hpet = 1;
@@ -189,9 +191,13 @@ int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = libxl__sprintf(gc, "%lu.%02d", 
start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 3, sizeof(char *));
+        localents = libxl__calloc(gc, 7, sizeof(char *));
         localents[0] = "platform/acpi";
         localents[1] = (info->u.hvm.acpi) ? "1" : "0";
+        localents[2] = "platform/acpi_s3";
+        localents[3] = (info->u.hvm.acpi_s3) ? "1" : "0";
+        localents[4] = "platform/acpi_s4";
+        localents[5] = (info->u.hvm.acpi_s4) ? "1" : "0";
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff -r 8a29891d6a98 -r 5118aa3562ea tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/libxl/libxl_types.idl       Fri Nov 18 11:19:21 2011 +0000
@@ -167,6 +167,8 @@ libxl_domain_build_info = Struct("domain
                                        ("pae", bool),
                                        ("apic", bool),
                                        ("acpi", bool),
+                                       ("acpi_s3", bool),
+                                       ("acpi_s4", bool),
                                        ("nx", bool),
                                        ("viridian", bool),
                                        ("timeoffset", string),
diff -r 8a29891d6a98 -r 5118aa3562ea tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Nov 18 10:33:33 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Fri Nov 18 11:19:21 2011 +0000
@@ -683,6 +683,10 @@ static void parse_config_data(const char
             b_info->u.hvm.apic = l;
         if (!xlu_cfg_get_long (config, "acpi", &l))
             b_info->u.hvm.acpi = l;
+        if (!xlu_cfg_get_long (config, "acpi_s3", &l))
+            b_info->u.hvm.acpi_s3 = l;
+        if (!xlu_cfg_get_long (config, "acpi_s4", &l))
+            b_info->u.hvm.acpi_s4 = l;
         if (!xlu_cfg_get_long (config, "nx", &l))
             b_info->u.hvm.nx = l;
         if (!xlu_cfg_get_long (config, "viridian", &l))

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>