xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xensource.com
Cc: paul.durrant@citrix.com
Subject: [PATCH 1 of 2] Add ACPI fixed sleep button for HVM
Date: Wed, 13 Jan 2010 10:16:11 +0000	[thread overview]
Message-ID: <cdf348c11aba31171bdc.1263377771@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1263377770@localhost.localdomain>

# HG changeset patch
# User Paul Durrant <paul.durrant@citrix.com>
# Date 1263377694 0
# Node ID cdf348c11aba31171bdc838ffe3a457acab0f7de
# Parent  13d4e78ede977ee92c4a4adf78a92b31ec52c00e
Add ACPI fixed sleep button for HVM.

signed-off-by: Paul Durrant <paul.durrant@citrix.com>

diff -r 13d4e78ede97 -r cdf348c11aba tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c	Wed Jan 13 08:33:34 2010 +0000
+++ b/tools/firmware/hvmloader/acpi/static_tables.c	Wed Jan 13 10:14:54 2010 +0000
@@ -68,7 +68,7 @@
     .p_lvl2_lat = 0x0fff, /* >100,  means we do not support C2 state */
     .p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
     .iapc_boot_arch = ACPI_8042,
-    .flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
+    .flags = (ACPI_PROC_C1 |
               ACPI_WBINVD |
               ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
 
diff -r 13d4e78ede97 -r cdf348c11aba xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/arch/x86/domctl.c	Wed Jan 13 10:14:54 2010 +0000
@@ -723,6 +723,19 @@
             {
                 ret = 0;
                 hvm_acpi_power_button(d);
+            }
+        }
+        break;
+
+        case XEN_DOMCTL_SENDTRIGGER_SLEEP:
+        {
+            extern void hvm_acpi_sleep_button(struct domain *d);
+
+            ret = -EINVAL;
+            if ( is_hvm_domain(d) ) 
+            {
+                ret = 0;
+                hvm_acpi_sleep_button(d);
             }
         }
         break;
diff -r 13d4e78ede97 -r cdf348c11aba xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c	Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/arch/x86/hvm/pmtimer.c	Wed Jan 13 10:14:54 2010 +0000
@@ -32,14 +32,16 @@
 #define TMR_STS    (1 << 0)
 #define GBL_STS    (1 << 5)
 #define PWRBTN_STS (1 << 8)
+#define SLPBTN_STS (1 << 9)
 
 /* The same in PM1a_EN */
 #define TMR_EN     (1 << 0)
 #define GBL_EN     (1 << 5)
 #define PWRBTN_EN  (1 << 8)
+#define SLPBTN_EN  (1 << 9)
 
 /* Mask of bits in PM1a_STS that can generate an SCI. */
-#define SCI_MASK (TMR_STS|PWRBTN_STS|GBL_STS) 
+#define SCI_MASK (TMR_STS|PWRBTN_STS|SLPBTN_STS|GBL_STS) 
 
 /* SCI IRQ number (must match SCI_INT number in ACPI FADT in hvmloader) */
 #define SCI_IRQ 9
@@ -64,6 +66,15 @@
     PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
     spin_lock(&s->lock);
     s->pm.pm1a_sts |= PWRBTN_STS;
+    pmt_update_sci(s);
+    spin_unlock(&s->lock);
+}
+
+void hvm_acpi_sleep_button(struct domain *d)
+{
+    PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
+    spin_lock(&s->lock);
+    s->pm.pm1a_sts |= SLPBTN_STS;
     pmt_update_sci(s);
     spin_unlock(&s->lock);
 }
diff -r 13d4e78ede97 -r cdf348c11aba xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Wed Jan 13 08:33:34 2010 +0000
+++ b/xen/include/public/domctl.h	Wed Jan 13 10:14:54 2010 +0000
@@ -439,6 +439,7 @@
 #define XEN_DOMCTL_SENDTRIGGER_RESET  1
 #define XEN_DOMCTL_SENDTRIGGER_INIT   2
 #define XEN_DOMCTL_SENDTRIGGER_POWER  3
+#define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
 struct xen_domctl_sendtrigger {
     uint32_t  trigger;  /* IN */
     uint32_t  vcpu;     /* IN */

  reply	other threads:[~2010-01-13 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 10:16 [PATCH 0 of 2] Add ACPI sleep button for HVM guests and a libxl method for 'pressing' sleep or power Paul Durrant
2010-01-13 10:16 ` Paul Durrant [this message]
2010-01-13 11:01   ` [PATCH 1 of 2] Add ACPI fixed sleep button for HVM Ian Campbell
2010-01-13 10:16 ` [PATCH 2 of 2] Add support to libxl to trigger power or sleep button pushes Paul Durrant
2010-01-13 11:00   ` Vincent Hanquez
2010-01-13 10:30 ` [PATCH 0 of 2] Add ACPI sleep button for HVM guests and a libxl method for 'pressing' sleep or power Pasi Kärkkäinen
2010-01-13 10:37   ` Paul Durrant
2010-01-14  0:39     ` Kouya Shimura
2010-01-13 12:46   ` Ian Pratt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdf348c11aba31171bdc.1263377771@localhost.localdomain \
    --to=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).