[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC][PATCH 04/13] Kemari: Kemari controller interface in libxc



This is an updated version of the following patch.  No major changes.

http://lists.xensource.com/archives/html/xen-devel/2009-03/msg00372.html

Signed-off-by: Yoshisato Yanagisawa <yanagisawa.yoshisato@xxxxxxxxxxxxx>
Signed-off-by: Yoshi Tamura <tamura.yoshiaki@xxxxxxxxxxxxx>
---
 tools/libxc/Makefile          |    2 +
 tools/libxc/xc_dom_kemari.c   |   79 ++++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xenctrl.h         |   13 +++++-
 tools/libxc/xenguest.h        |   45 +++++++++++++++++++++++
 tools/libxc/xg_save_restore.h |    1
 tools/xcutils/Makefile        |    1
 6 files changed, 139 insertions(+), 2 deletions(-)

diff -r b249f3e979a5 -r cf6a910e3663 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile    Mon Mar 09 10:32:24 2009 +0000
+++ b/tools/xcutils/Makefile    Wed Mar 11 18:03:47 2009 +0900
@@ -15,6 +15,7 @@
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)

 PROGRAMS = xc_restore xc_save readnotes lsevtchn
+PROGRAMS += xc_kemari_restore xc_kemari_save

 LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)

diff -r b249f3e979a5 -r cf6a910e3663 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Mon Mar 09 10:32:24 2009 +0000
+++ b/tools/libxc/Makefile      Wed Mar 11 18:03:47 2009 +0900
@@ -31,6 +31,8 @@
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xg_private.c
 GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_dom_kemari_restore.c xc_dom_kemari_save.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_dom_kemari.c
 GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c

 vpath %.c ../../xen/common/libelf
diff -r b249f3e979a5 -r cf6a910e3663 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Mar 09 10:32:24 2009 +0000
+++ b/tools/libxc/xenctrl.h     Wed Mar 11 18:03:47 2009 +0900
@@ -1041,8 +1041,8 @@
  */
 xc_error_handler xc_set_error_handler(xc_error_handler handler);

-int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value);
-int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value);
+int xc_set_hvm_param(int handle, domid_t dom, int param, uint64_t value);
+int xc_get_hvm_param(int handle, domid_t dom, int param, uint64_t *value);

 /* IA64 specific, nvram save */
 int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom);
@@ -1242,4 +1242,13 @@
 int xc_set_cpufreq_gov(int xc_handle, int cpuid, char *govname);
 int xc_set_cpufreq_para(int xc_handle, int cpuid,
                         int ctrl_type, int ctrl_value);
+
+/* kemari control interface */
+int xc_kemari_control(int xc_handle,
+                      uint32_t domid,
+                      uint32_t cmd,
+                      evtchn_port_t *port,
+                      uint32_t *num_pages,
+                      uint64_t *mfn,
+                      uint16_t tap_mode);
 #endif /* XENCTRL_H */
diff -r b249f3e979a5 -r cf6a910e3663 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Mon Mar 09 10:32:24 2009 +0000
+++ b/tools/libxc/xenguest.h    Wed Mar 11 18:03:47 2009 +0900
@@ -43,6 +43,51 @@
  * @return 0 on success, -1 on failure
  */
 int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
+                      unsigned int store_evtchn, unsigned long *store_mfn,
+                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      unsigned int hvm, unsigned int pae);
+
+/**
+ * This function will save a running domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to save a domain to
+ * @parm dom the id of the domain
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_save(int xc_handle, int io_fd, uint32_t dom,
+                   void *kemari_ring, uint32_t flags /* XCFLAGS_xxx */,
+                   int hvm,
+                   void *(*init_qemu_maps)(int, unsigned));
+
+/**
+ * This function will update a domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to save a domain to
+ * @parm dom the id of the domain
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_update(int xc_handle, int io_fd, uint32_t dom,
+                     void *kemari_ring, uint32_t flags,
+                     void (*qemu_save_image)(int),
+                     void (*qemu_end_flip)(void),
+                     void (*qemu_end_save)(void),
+                     void (*qemu_image_sent)(void));
+
+/**
+ * This function will restore a saved domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to restore a domain from
+ * @parm dom the id of the domain
+ * @parm store_evtchn the store event channel for this domain to use
+ * @parm store_mfn returned with the mfn of the store page
+ * @parm hvm non-zero if this is a HVM restore
+ * @parm pae non-zero if this HVM domain has PAE support enabled
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_restore(int xc_handle, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
                       unsigned int console_evtchn, unsigned long *console_mfn,
                       unsigned int hvm, unsigned int pae);
diff -r b249f3e979a5 -r cf6a910e3663 tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Mon Mar 09 10:32:24 2009 +0000
+++ b/tools/libxc/xg_save_restore.h     Wed Mar 11 18:03:47 2009 +0900
@@ -8,6 +8,7 @@

 #include <xen/foreign/x86_32.h>
 #include <xen/foreign/x86_64.h>
+#include <xen/kemari.h>

 /*
 ** We process save/restore/migrate in batches of pages; the below
diff -r b249f3e979a5 -r cf6a910e3663 tools/libxc/xc_dom_kemari.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_dom_kemari.c       Wed Mar 11 18:03:47 2009 +0900
@@ -0,0 +1,79 @@
+/*
+ * xc_dom_kemari.c
+ *
+ * The API for manipulating and obtaining information on kemari-domains.
+ *
+ * Copyright (C) 2008 Nippon Telegraph and Telephone Corporation
+ *
+ * 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
+ *
+ */
+
+#include "xc_private.h"
+
+/*
+ * Kemari controller interface.
+ */
+int xc_kemari_control(int xc_handle,
+    uint32_t domid,
+    uint32_t cmd,
+    evtchn_port_t *port,
+    uint32_t *num_pages,
+    uint64_t *mfn,
+    uint16_t tap_mode)
+{
+    int rc;
+    struct xen_domctl_kemari_op *kemari_op;
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_kemari_op;
+    domctl.domain = (domid_t)domid;
+
+    kemari_op = &domctl.u.kemari_op;
+    kemari_op->cmd = cmd;
+
+    if ( cmd == XEN_KEMARI_OP_attach )
+    {
+        kemari_op->u.attach.port = *port;
+        kemari_op->u.attach.evtchn_tap_mode = tap_mode;
+    }
+
+    if ( cmd /* == */ & XEN_KEMARI_OP_detach )
+        kemari_op->u.detach.port = *port;
+
+    DPRINTF("xc_kemari_control: cmd=%d\n", cmd);
+
+    rc = do_domctl(xc_handle, &domctl);
+
+    if ( cmd == XEN_KEMARI_OP_enable )
+    {
+        *port = kemari_op->u.enable.port;
+        *mfn = kemari_op->u.enable.mfn;
+        *num_pages = kemari_op->u.enable.num_pages;
+    }
+
+    return rc;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.