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

[Xen-devel] [PATCH 08/12] tools/libxc: add per domain/cpupool parameter support



Add support for setting per domain and per cpupool parameters to libxc.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxc/include/xenctrl.h | 18 ++++++++++++++++++
 tools/libxc/xc_cpupool.c      | 23 +++++++++++++++++++++++
 tools/libxc/xc_domain.c       | 23 +++++++++++++++++++++++
 3 files changed, 64 insertions(+)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index bb75bcc84d..d22da5ee61 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1081,6 +1081,15 @@ int xc_domain_set_access_required(xc_interface *xch,
  */
 int xc_domain_set_virq_handler(xc_interface *xch, uint32_t domid, int virq);
 
+/**
+ * Set generic domain parameters.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid id of the domain
+ * @parm params parameter string to be passed to the hypervisor
+ */
+int xc_set_domain_parameters(xc_interface *xch, uint32_t domid, char *params);
+
 /*
  * CPUPOOL MANAGEMENT FUNCTIONS
  */
@@ -1178,6 +1187,15 @@ int xc_cpupool_movedomain(xc_interface *xch,
  */
 xc_cpumap_t xc_cpupool_freeinfo(xc_interface *xch);
 
+/**
+ * Set generic cpupool parameters.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm poolid id of the cpupool
+ * @parm params parameter string to be passed to the hypervisor
+ */
+int xc_set_cpupool_parameters(xc_interface *xch, uint32_t poolid, char 
*params);
+
 /*
  * EVENT CHANNEL FUNCTIONS
  *
diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c
index fbd8cc9d03..4df775884b 100644
--- a/tools/libxc/xc_cpupool.c
+++ b/tools/libxc/xc_cpupool.c
@@ -217,3 +217,26 @@ out:
     xc_hypercall_buffer_free(xch, local);
     return cpumap;
 }
+
+int xc_set_cpupool_parameters(xc_interface *xch, uint32_t poolid, char *params)
+{
+    int ret, len = strlen(params);
+    DECLARE_SYSCTL;
+    DECLARE_HYPERCALL_BOUNCE(params, len, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+    if ( xc_hypercall_bounce_pre(xch, params) )
+        return -1;
+
+    sysctl.cmd = XEN_SYSCTL_set_parameter;
+    set_xen_guest_handle(sysctl.u.set_parameter.params, params);
+    sysctl.u.set_parameter.size = len;
+    sysctl.u.set_parameter.scope = XEN_SYSCTL_SETPAR_SCOPE_CPUPOOL;
+    sysctl.u.set_parameter.pad = 0;
+    sysctl.u.set_parameter.instance = poolid;
+
+    ret = do_sysctl(xch, &sysctl);
+
+    xc_hypercall_bounce_post(xch, params);
+
+    return ret;
+}
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 05d771f2ce..265f018210 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -2386,6 +2386,29 @@ int xc_domain_soft_reset(xc_interface *xch,
     domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
+
+int xc_set_domain_parameters(xc_interface *xch, uint32_t domid, char *params)
+{
+    int ret, len = strlen(params);
+    DECLARE_DOMCTL;
+    DECLARE_HYPERCALL_BOUNCE(params, len, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+    if ( xc_hypercall_bounce_pre(xch, params) )
+        return -1;
+
+    domctl.cmd = XEN_DOMCTL_set_parameter;
+    domctl.domain = domid;
+    set_xen_guest_handle(domctl.u.set_parameter.params, params);
+    domctl.u.set_parameter.size = len;
+    memset(domctl.u.set_parameter.pad, 0, sizeof(domctl.u.set_parameter.pad));
+
+    ret = do_domctl(xch, &domctl);
+
+    xc_hypercall_bounce_post(xch, params);
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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