From patchwork Wed Oct 18 14:03:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 10014793 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 CF3E8601E7 for ; Wed, 18 Oct 2017 14:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C42C128BDB for ; Wed, 18 Oct 2017 14:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B902828BEA; Wed, 18 Oct 2017 14:07:27 +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 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 6B0A928BDB for ; Wed, 18 Oct 2017 14:07:27 +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 1e4oyB-0007pt-NY; Wed, 18 Oct 2017 14:05: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 1e4oyA-0007pb-G5 for xen-devel@lists.xen.org; Wed, 18 Oct 2017 14:05:14 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 0A/5C-25852-99F57E95; Wed, 18 Oct 2017 14:05:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42JxWrrBXndm/PN Ig/N7RCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oy+524FE8Urtu3awdjAeFO4i5GDQ0LAX+Lm UyCTk4NNwEDi1qXvzCC2iIC6xOmOi6wgNrNAucSJ7YfZQGxhgXCJe9+mg9WwCKhKvNx/lAlkD K+AncSUplyQsISAnMSeizPYQWxOAXuJ2W39YLYQUMmaazPZIGw1ibfLz7CA2LwCghInZz5hgV glIXHwxQvmCYy8s5CkZiFJLWBkWsWoUZxaVJZapGtkqZdUlJmeUZKbmJmja2hgppebWlycmJ6 ak5hUrJecn7uJERg2DECwg/HAosBDjJIcTEqivLoHnkUK8SXlp1RmJBZnxBeV5qQWH2KU4eBQ kuBdHPc8UkiwKDU9tSItMwcYwDBpCQ4eJRHe77FAad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl5 6VKifMKgcwQACnKKM2DGwGLpkuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5rUEmcKTmVcCt+ kV0BFMQEesc3oCckRJIkJKqoGRyeXri0Tmqvl5pmo6TwQ6GlfZrjkRO4/d+mblhiX6WzLfW4q Wn75wyvOGRHjfow17rBQrrLiKXxSWMJ0M7j146WBlar30dZc4t5WFSrHPw22+WbhUeF+MFvNi jRP821DnM0c++niGl7FBAWdT/HzRhkXTYoPlxXdf/Wv2807LqZgAYWn+c0osxRmJhlrMRcWJA A7xWlOhAgAA X-Env-Sender: prvs=457f25213=ross.lagerwall@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1508335509!111976702!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: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10249 invoked from network); 18 Oct 2017 14:05:13 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 18 Oct 2017 14:05:13 -0000 X-IronPort-AV: E=Sophos;i="5.43,397,1503360000"; d="scan'208";a="454799339" From: Ross Lagerwall To: Xen-devel Date: Wed, 18 Oct 2017 15:03:38 +0100 Message-ID: <20171018140339.13888-5-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171018140339.13888-1-ross.lagerwall@citrix.com> References: <20171018140339.13888-1-ross.lagerwall@citrix.com> MIME-Version: 1.0 Cc: Ross Lagerwall , Ian Jackson , Wei Liu Subject: [Xen-devel] [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ross Lagerwall Acked-by: Ian Jackson --- tools/libs/devicemodel/Makefile | 2 +- tools/libs/devicemodel/core.c | 17 +++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 13 +++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 5 +++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile index 342371a..5b2df7a 100644 --- a/tools/libs/devicemodel/Makefile +++ b/tools/libs/devicemodel/Makefile @@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk MAJOR = 1 -MINOR = 1 +MINOR = 2 SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map CFLAGS += -Werror -Wmissing-prototypes diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c index b66d4f9..2a23077 100644 --- a/tools/libs/devicemodel/core.c +++ b/tools/libs/devicemodel/core.c @@ -564,6 +564,23 @@ int xendevicemodel_shutdown( return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); } +int xendevicemodel_add_to_physmap( + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t gpfn) +{ + struct xen_dm_op op; + struct xen_dm_op_add_to_physmap *data; + + memset(&op, 0, sizeof(op)); + + op.op = XEN_DMOP_add_to_physmap; + data = &op.u.add_to_physmap; + + data->idx = idx; + data->gpfn = gpfn; + + return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); +} + int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid) { return osdep_xendevicemodel_restrict(dmod, domid); diff --git a/tools/libs/devicemodel/include/xendevicemodel.h b/tools/libs/devicemodel/include/xendevicemodel.h index dda0bc7..2c4e392 100644 --- a/tools/libs/devicemodel/include/xendevicemodel.h +++ b/tools/libs/devicemodel/include/xendevicemodel.h @@ -326,6 +326,19 @@ int xendevicemodel_shutdown( xendevicemodel_handle *dmod, domid_t domid, unsigned int reason); /** + * Sets the GPFN at which a particular page appears in the domain's + * pseudophysical address space. + * + * @parm dmod a handle to an open devicemodel interface. + * @parm domid the domain id to be serviced + * @parm idx Index into GMFN space + * @parm gpfn GPFN in domid where the GMFN should appear + * @return 0 on success, -1 on failure. + */ +int xendevicemodel_add_to_physmap( + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t gpfn); + +/** * This function restricts the use of this handle to the specified * domain. * diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map index cefd32b..4a19ecb 100644 --- a/tools/libs/devicemodel/libxendevicemodel.map +++ b/tools/libs/devicemodel/libxendevicemodel.map @@ -27,3 +27,8 @@ VERS_1.1 { global: xendevicemodel_shutdown; } VERS_1.0; + +VERS_1.2 { + global: + xendevicemodel_add_to_physmap; +} VERS_1.1;