From patchwork Thu Feb 18 18:52:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vrabel X-Patchwork-Id: 8353551 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8DE62C0553 for ; Thu, 18 Feb 2016 18:55:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B42AE20395 for ; Thu, 18 Feb 2016 18:55:10 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF3F92039E for ; Thu, 18 Feb 2016 18:55:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWTgf-0002Uk-5J; Thu, 18 Feb 2016 18:52:25 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWTgd-0002UJ-O5 for xen-devel@lists.xenproject.org; Thu, 18 Feb 2016 18:52:23 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id CA/16-02745-7E216C65; Thu, 18 Feb 2016 18:52:23 +0000 X-Env-Sender: prvs=84994b707=david.vrabel@citrix.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1455821540!23446232!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38217 invoked from network); 18 Feb 2016 18:52:22 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 18 Feb 2016 18:52:22 -0000 X-IronPort-AV: E=Sophos;i="5.22,466,1449532800"; d="scan'208";a="339231518" From: David Vrabel To: Date: Thu, 18 Feb 2016 18:52:07 +0000 Message-ID: <1455821530-4263-3-git-send-email-david.vrabel@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455821530-4263-1-git-send-email-david.vrabel@citrix.com> References: <1455821530-4263-1-git-send-email-david.vrabel@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Andrew Cooper , David Vrabel , Jan Beulich Subject: [Xen-devel] [PATCHv1 2/5] tools/libxc: add xc_domain_get_param() and xc_domain_set_param() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These are a thin wrapper around the XEN_DOMCTL_param hypercall. Signed-off-by: David Vrabel Reviewed-by: Andrew Cooper --- tools/libxc/include/xenctrl.h | 5 +++++ tools/libxc/xc_domain.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 42eafa4..862c748 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -812,6 +812,11 @@ int xc_domain_hvm_setcontext(xc_interface *xch, const char *xc_domain_get_native_protocol(xc_interface *xch, uint32_t domid); +int xc_domain_get_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t *value); +int xc_domain_set_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t value, uint64_t *old_value); + /** * This function returns information about the execution context of a * particular vcpu of a domain. diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 4fa993a..4caa250 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -2574,6 +2574,41 @@ int xc_domain_soft_reset(xc_interface *xch, domctl.domain = (domid_t)domid; return do_domctl(xch, &domctl); } + +static int xc_domain_param(xc_interface *xch, unsigned int domid, + uint32_t param, int set, uint64_t *value) +{ + int ret; + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_param; + domctl.domain = domid; + domctl.u.param.param = param | (set ? XEN_DOMCTL_PARAM_SET : 0); + domctl.u.param.value = *value; + + ret = do_domctl(xch, &domctl); + if ( ret == 0 ) + *value = domctl.u.param.value; + return ret; +} + +int xc_domain_get_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t *value) +{ + return xc_domain_param(xch, domid, param, 0, value); +} + +int xc_domain_set_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t value, uint64_t *old_value) +{ + int ret; + + ret = xc_domain_param(xch, domid, param, 1, &value); + if ( ret == 0 && old_value ) + *old_value = value; + return ret; +} + /* * Local variables: * mode: C