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

[Xen-devel] [RFC PATCH 09/10] libxl: Add VTPOWER, VTREBOOT and VTPING



From: Don Slutz <dslutz@xxxxxxxxxxx>

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 tools/libxl/libxl.c         | 12 ++++++++++++
 tools/libxl/libxl_types.idl |  3 +++
 tools/libxl/xl_cmdtable.c   |  2 +-
 xen/arch/x86/domctl.c       | 34 ++++++++++++++++++++++++++++++++++
 xen/include/public/domctl.h |  3 +++
 5 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index fd8b988..1ec8484 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -5057,6 +5057,18 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
         rc = xc_domain_send_trigger(ctx->xch, domid,
                                     XEN_DOMCTL_SENDTRIGGER_SLEEP, vcpuid);
         break;
+    case LIBXL_TRIGGER_VTPOWER:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_VTPOWER, vcpuid);
+        break;
+    case LIBXL_TRIGGER_VTREBOOT:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_VTREBOOT, vcpuid);
+        break;
+    case LIBXL_TRIGGER_VTPING:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_VTPING, vcpuid);
+        break;
     case LIBXL_TRIGGER_NMI:
         rc = xc_domain_send_trigger(ctx->xch, domid,
                                     XEN_DOMCTL_SENDTRIGGER_NMI, vcpuid);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 71ba64e..80a8ee8 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -105,6 +105,9 @@ libxl_trigger = Enumeration("trigger", [
     (4, "INIT"),
     (5, "RESET"),
     (6, "S3RESUME"),
+    (7, "VTPOWER"),
+    (8, "VTREBOOT"),
+    (9, "VTPING"),
     ])
 
 libxl_tsc_mode = Enumeration("tsc_mode", [
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index ebe0220..98db8ae 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -290,7 +290,7 @@ struct cmd_spec cmd_table[] = {
     { "trigger",
       &main_trigger, 0, 1,
       "Send a trigger to a domain",
-      "<Domain> <nmi|reset|init|power|sleep|s3resume> [<VCPU>]",
+      "<Domain> <nmi|reset|init|power|sleep|s3resume|vtpower|vtreboot|vtping> 
[<VCPU>]",
     },
     { "sysrq",
       &main_sysrq, 0, 1,
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index ef6c140..8b77ce2 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -23,6 +23,7 @@
 #include <xen/paging.h>
 #include <asm/irq.h>
 #include <asm/hvm/hvm.h>
+#include <asm/hvm/vmport.h>
 #include <asm/hvm/support.h>
 #include <asm/hvm/cacheattr.h>
 #include <asm/processor.h>
@@ -577,6 +578,39 @@ long arch_do_domctl(
         }
         break;
 
+        case XEN_DOMCTL_SENDTRIGGER_VTPOWER:
+        {
+            ret = -EINVAL;
+            if ( is_hvm_domain(d) )
+            {
+                ret = 0;
+                vmport_ctrl_send(&d->arch.hvm_domain, "OS_Halt", 1);
+            }
+        }
+        break;
+
+        case XEN_DOMCTL_SENDTRIGGER_VTREBOOT:
+        {
+            ret = -EINVAL;
+            if ( is_hvm_domain(d) )
+            {
+                ret = 0;
+                vmport_ctrl_send(&d->arch.hvm_domain, "OS_Reboot", 2);
+            }
+        }
+        break;
+
+        case XEN_DOMCTL_SENDTRIGGER_VTPING:
+        {
+            ret = -EINVAL;
+            if ( is_hvm_domain(d) )
+            {
+                ret = 0;
+                vmport_ctrl_send(&d->arch.hvm_domain, "ping", 3);
+            }
+        }
+        break;
+
         default:
             ret = -ENOSYS;
         }
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 01a3652..d71d57c 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -454,6 +454,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
 #define XEN_DOMCTL_SENDTRIGGER_INIT   2
 #define XEN_DOMCTL_SENDTRIGGER_POWER  3
 #define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
+#define XEN_DOMCTL_SENDTRIGGER_VTPOWER  5
+#define XEN_DOMCTL_SENDTRIGGER_VTREBOOT 6
+#define XEN_DOMCTL_SENDTRIGGER_VTPING   7
 struct xen_domctl_sendtrigger {
     uint32_t  trigger;  /* IN */
     uint32_t  vcpu;     /* IN */
-- 
1.8.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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