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

[Xen-devel] [PATCH 10/11] libxc: add xc_evtchn_set_limit()



From: David Vrabel <david.vrabel@xxxxxxxxxx>

Add xc_evtchn_set_limit(), a wrapper around the EVTCHNOP_set_limit
hypercall.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_evtchn.c |    6 ++++++
 tools/libxc/xenctrl.h   |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c
index 2e0679e..fd9d120 100644
--- a/tools/libxc/xc_evtchn.c
+++ b/tools/libxc/xc_evtchn.c
@@ -78,6 +78,12 @@ int xc_evtchn_status(xc_interface *xch, xc_evtchn_status_t 
*status)
                         sizeof(*status), 1);
 }
 
+int xc_evtchn_set_limit(xc_interface *xch, domid_t domid, uint32_t max_port)
+{
+    struct evtchn_set_limit arg = { .domid = domid, max_port = max_port };
+    return do_evtchn_op(xch, EVTCHNOP_set_limit, &arg, sizeof(arg), 0);
+}
+
 int xc_evtchn_fd(xc_evtchn *xce)
 {
     return xce->ops->u.evtchn.fd(xce, xce->ops_handle);
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index f2cebaf..f5b1aa3 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -964,6 +964,19 @@ int xc_evtchn_reset(xc_interface *xch,
 typedef struct evtchn_status xc_evtchn_status_t;
 int xc_evtchn_status(xc_interface *xch, xc_evtchn_status_t *status);
 
+/**
+ * Set the maximum port number that a domain may use.
+ *
+ * The toolstack may use this to limit the amount of Xen resources
+ * (xenheap, global mapping pages, etc.) the domain may use for event
+ * channels.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid the ID of the domain
+ * @parm max_port the new maximum port number
+ */
+int xc_evtchn_set_limit(xc_interface *xch, domid_t domid, uint32_t max_port);
+
 /*
  * Return a handle to the event channel driver, or NULL on failure, in
  * which case errno will be set appropriately.
-- 
1.7.2.5


_______________________________________________
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®.