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 4/4]: Xend interface for HVM S3

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [Patch 4/4]: Xend interface for HVM S3
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Thu, 17 May 2007 00:50:37 +0800
Delivery-date: Wed, 16 May 2007 09:49:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AceX2lQlwSL+eLYeTbCeSaAsZbResA==
Thread-topic: [Patch 4/4]: Xend interface for HVM S3
[Patch 4/4]: Xend interface for HVM S3
  - extend "xm resume <domid>" to be able to S3 resume HVM domain.
  - when user issue "xm resume" command for HVM domain, xend will use xc
lib API to call HVMOP_s3_resume hypercall.

Note: it may not appropriate use xm resume for HVM s3, since xm resume
is originally designed for save/restor purpose. It will be fine that
xend maintainer find another place to put this code.

Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>

diff -r 8d4bb5f37e73 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue May 15 14:36:11 2007 -0400
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue May 15 14:43:34 2007 -0400
@@ -487,6 +487,24 @@ static PyObject *pyxc_get_hvm_param(XcOb
 
 }
 
+static PyObject *pyxc_hvm_s3_resume(XcObject *self,
+                                    PyObject *args,
+                                    PyObject *kwds)
+{
+    uint32_t dom;
+
+    static char *kwd_list[] = { "domid", NULL }; 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list,
+                                      &dom ) )
+        return NULL;
+
+    if ( xc_hvm_s3_resume(self->xc_handle, dom) != 0 )
+        return pyxc_error_to_exception();
+        
+    Py_INCREF(zero);
+    return zero;
+}
+
 static PyObject *pyxc_hvm_build(XcObject *self,
                                 PyObject *args,
                                 PyObject *kwds)
@@ -1252,6 +1270,13 @@ static PyMethodDef pyxc_methods[] = {
       " dom     [int]:      Identifier of domain to build into.\n"
       " param   [int]:      No. of HVM param.\n"
       "Returns: [int] value of the param.\n" },
+    
+    { "hvm_s3_resume", 
+      (PyCFunction)pyxc_hvm_s3_resume, 
+      METH_VARARGS | METH_KEYWORDS, "\n"
+      "resume HVM domain from S3 sleep state.\n"
+      " dom     [int]:      Identifier of domain .\n"
+      "Returns: [int] 0 on success; -1 on error.\n" },
 
     { "sched_id_get",
       (PyCFunction)pyxc_sched_id_get,
diff -r 8d4bb5f37e73 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue May 15 14:36:11 2007
-0400
+++ b/tools/python/xen/xend/XendDomain.py       Tue May 15 14:36:13 2007
-0400
@@ -866,6 +866,10 @@ class XendDomain:
             try:
                 dominfo = self.domain_lookup_nr(domname)
 
+                if dominfo.info.is_hvm():
+                    dominfo.hvm_resume()
+                    return
+
                 if not dominfo:
                     raise XendInvalidDomain(domname)
 
diff -r 8d4bb5f37e73 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue May 15 14:36:11 2007
-0400
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue May 15 14:36:13 2007
-0400
@@ -437,6 +437,13 @@ class XendDomainInfo:
         else:
             raise XendError('VM is not susupened; it is %s'
                             % XEN_API_VM_POWER_STATE[state])
+    def hvm_resume(self):
+        """ Resume a HVM domain from S3 sleep state."""
+        if not self.info.is_hvm():
+           raise XendError('Try to hvm_resume a non-HVM domain')

+        rc = xc.hvm_s3_resume(self.domid)
+        if not rc:
+            log.info("HVM S3 resume domain %d failed\n", self.domid)
 
     def shutdown(self, reason):
         """Shutdown a domain by signalling this via xenstored."""

Attachment: xend.patch
Description: xend.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [Patch 4/4]: Xend interface for HVM S3, Yu, Ke <=