From patchwork Tue May 28 14:54:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis LIaskovitis X-Patchwork-Id: 10965103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8C8F933 for ; Tue, 28 May 2019 14:56:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7B4D28358 for ; Tue, 28 May 2019 14:56:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBBD128538; Tue, 28 May 2019 14:56:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7957428358 for ; Tue, 28 May 2019 14:56:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVdUr-0000VI-Q0; Tue, 28 May 2019 14:54:37 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVdUq-0000Ur-7l for xen-devel@lists.xenproject.org; Tue, 28 May 2019 14:54:36 +0000 X-Inumbo-ID: 8195844a-8158-11e9-8980-bc764e045a96 Received: from smtp.nue.novell.com (unknown [195.135.221.5]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 8195844a-8158-11e9-8980-bc764e045a96; Tue, 28 May 2019 14:54:35 +0000 (UTC) Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 28 May 2019 16:54:33 +0200 Received: from linux-nq5u.suse.de (nwb-a10-snat.microfocus.com [10.120.13.201]) by emea4-mta.ukb.novell.com with ESMTP (NOT encrypted); Tue, 28 May 2019 15:54:23 +0100 From: Vasilis Liaskovitis To: xen-devel@lists.xenproject.org Date: Tue, 28 May 2019 16:54:14 +0200 Message-Id: <20190528145416.16918-3-vliaskovitis@suse.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528145416.16918-1-vliaskovitis@suse.com> References: <20190528145416.16918-1-vliaskovitis@suse.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 2/4] libxc: add function to get hypervisor parameters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com, jbeulich@suse.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, vliaskovitis@suse.com, anthony.perard@citrix.com, dgdegra@tycho.nsa.gov Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a new libxc function to get hypervisor parameters. Signed-off-by: Vasilis Liaskovitis --- tools/libxc/include/xenctrl.h | 1 + tools/libxc/xc_misc.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index a3628e56bb..3482ca1a91 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1228,6 +1228,7 @@ int xc_readconsolering(xc_interface *xch, int xc_send_debug_keys(xc_interface *xch, char *keys); int xc_set_parameters(xc_interface *xch, char *params); +int xc_get_parameters(xc_interface *xch, char *params, char *values); typedef struct xen_sysctl_physinfo xc_physinfo_t; typedef struct xen_sysctl_cputopo xc_cputopo_t; diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 5e6714ae2b..439ad91194 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -208,6 +208,32 @@ int xc_set_parameters(xc_interface *xch, char *params) return ret; } +int xc_get_parameters(xc_interface *xch, char *params, char *values) +{ + int ret, len = strlen(params); + DECLARE_SYSCTL; + DECLARE_HYPERCALL_BOUNCE(params, len, XC_HYPERCALL_BUFFER_BOUNCE_IN); + DECLARE_HYPERCALL_BOUNCE(values, 1023, XC_HYPERCALL_BUFFER_BOUNCE_OUT); + + if ( xc_hypercall_bounce_pre(xch, params) ) + return -1; + if ( xc_hypercall_bounce_pre(xch, values) ) + return -1; + + sysctl.cmd = XEN_SYSCTL_get_parameter; + set_xen_guest_handle(sysctl.u.get_parameter.params, params); + set_xen_guest_handle(sysctl.u.get_parameter.values, values); + sysctl.u.get_parameter.size = len; + memset(sysctl.u.get_parameter.pad, 0, sizeof(sysctl.u.get_parameter.pad)); + + ret = do_sysctl(xch, &sysctl); + + xc_hypercall_bounce_post(xch, params); + xc_hypercall_bounce_post(xch, values); + + return ret; +} + int xc_physinfo(xc_interface *xch, xc_physinfo_t *put_info) {