From patchwork Sun Jul 2 23:34:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 9821835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C31B860246 for ; Sun, 2 Jul 2017 23:36:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EC1F204C1 for ; Sun, 2 Jul 2017 23:36:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 935402097A; Sun, 2 Jul 2017 23:36:46 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 157D1204C1 for ; Sun, 2 Jul 2017 23:36:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRoNb-0002hl-T3; Sun, 02 Jul 2017 23:34:15 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRoNa-0002hP-JZ for xen-devel@lists.xen.org; Sun, 02 Jul 2017 23:34:14 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id DF/8D-03032-5F289595; Sun, 02 Jul 2017 23:34:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRWlGSWpSXmKPExsXSO6nOVfdrU2S kwZXzEhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bWj0+ZCr7xVuz/dYC5gfEedxcjF4eQwAQm ie+X/7BDOH8YJWZsaIFyNjBKbD69jRXC6WaUuNI/CSjDycEmoCMx7cApFhBbREBa4trny4wgN rOAkcTL/deYQWxhAS+JLTN2g9WwCKhK/Hl/hAnE5hVwl1h6pJsVxJYQkJO4ea6TGcI2lDj9cB vjBEaeBYwMqxg1ilOLylKLdI2N9JKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAr3 PAAQ7GE+vCzzEKMnBpCTKu/JaaKQQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd67jZGRQoJFqemp FWmZOcAwhElLcPAoifBe8wFK8xYXJOYWZ6ZDpE4x6nK8mvD/G5MQS15+XqqUOO98kBkCIEUZp XlwI2AxcYlRVkqYlxHoKCGegtSi3MwSVPlXjOIcjErCvLsagKbwZOaVwG16BXQEE9ARDT0RIE eUJCKkpBoY1V72Sv+fVXmB+8n1C99ffA6b2K53Sil6tYyuvUrK+2VJb8z/iWX9+bk5/Atz4mb HSPHlB12ll7E118Rtq1i+tTkz3eryv875Z5/u5Av4IXK+wO8sZ931P0++8zz7puxua5H+l89j 57s5Z84c8ZqnvaCh68Ti8+/81gtIp9Z0xN7bOfvQef0djEosxRmJhlrMRcWJANPU8TWEAgAA X-Env-Sender: dongli.zhang@oracle.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1499038451!95692274!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62577 invoked from network); 2 Jul 2017 23:34:13 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-13.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Jul 2017 23:34:13 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v62NY5ZH001633 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 2 Jul 2017 23:34:05 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v62NY4rk004969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 2 Jul 2017 23:34:04 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v62NY2BU026069; Sun, 2 Jul 2017 23:34:02 GMT Received: from linux.cn.oracle.com (/10.182.70.224) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 02 Jul 2017 16:34:01 -0700 From: Dongli Zhang To: xen-devel@lists.xen.org Date: Mon, 3 Jul 2017 07:34:12 +0800 Message-Id: <1499038453-17050-1-git-send-email-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com Subject: [Xen-devel] [PATCH v2 1/2] tools/libxc: add interface for GNTTABOP_query_size X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds new interface for GNTTABOP_query_size in libxc to help query the current grant table frames and maximum grant table frames for a specific domain. Signed-off-by: Dongli Zhang Acked-by: Wei Liu --- Changed since v1: * Change %d to %u in ERROR() --- tools/libxc/include/xenctrl.h | 1 + tools/libxc/xc_gnttab.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 1629f41..155c69e 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1597,6 +1597,7 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count); /* Logs iff hypercall bounce fails, otherwise doesn't. */ +int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query); int xc_gnttab_get_version(xc_interface *xch, int domid); /* Never logs */ grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, int domid, int *gnt_num); grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, int domid, int *gnt_num); diff --git a/tools/libxc/xc_gnttab.c b/tools/libxc/xc_gnttab.c index af53fac..9e6f1fb 100644 --- a/tools/libxc/xc_gnttab.c +++ b/tools/libxc/xc_gnttab.c @@ -38,6 +38,18 @@ int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count) return ret; } +int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query) +{ + int rc; + + rc = xc_gnttab_op(xch, GNTTABOP_query_size, query, sizeof(*query), 1); + + if ( rc || (query->status != GNTST_okay) ) + ERROR("Could not query dom %u's grant size\n", query->dom); + + return rc; +} + int xc_gnttab_get_version(xc_interface *xch, int domid) { struct gnttab_get_version query;