From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCH 10/11] libxc: add xc_evtchn_set_limit() Date: Fri, 13 Sep 2013 17:56:12 +0100 Message-ID: <1379091373-30293-11-git-send-email-david.vrabel@citrix.com> References: <1379091373-30293-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1379091373-30293-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Jackson , Keir Fraser , David Vrabel , Jan Beulich , Ian Campbell List-Id: xen-devel@lists.xenproject.org From: David Vrabel Add xc_evtchn_set_limit(), a wrapper around the EVTCHNOP_set_limit hypercall. Signed-off-by: David Vrabel Cc: Ian Campbell Cc: Ian Jackson --- 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