From patchwork Mon Oct 23 09:05:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 10022191 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 287C4603FA for ; Mon, 23 Oct 2017 09:07:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E1672880F for ; Mon, 23 Oct 2017 09:07:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12FC228811; Mon, 23 Oct 2017 09:07:32 +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 B13B92880F for ; Mon, 23 Oct 2017 09:07:31 +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 1e6Yfg-0007Jg-Al; Mon, 23 Oct 2017 09:05:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6Yff-0007JE-JF for xen-devel@lists.xen.org; Mon, 23 Oct 2017 09:05:19 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id A7/C8-08608-EC0BDE95; Mon, 23 Oct 2017 09:05:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUvfchre RBre/KFgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBn3nm5lLfgtXDHhelUDY49gFyMnh4SAv8T6 o/+YQGw2AQOJW5e+M4PYIgKyEqu75rCD2MwC5RInth9mA7GFBWIltj97zAhiswioSnRNugVm8 wrYSkz7cZ4ZYqacxJ6LM8B6OQXsJJ79Xc4KYgsB1ezZ9YMFwlaTeLv8DAtEr6DEyZlPWCB2SU gcfPGCeQIj7ywkqVlIUgsYmVYxqhenFpWlFula6iUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCY V6yXn525iBAYOAxDsYLy7KeAQoyQHk5Io7++ct5FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHif rAfKCRalpqdWpGXmAEMYJi3BwaMkwjsVJM1bXJCYW5yZDpE6xajL0XHz7h8mIZa8/LxUKXHe9 yBFAiBFGaV5cCNg8XSJUVZKmJcR6CghnoLUotzMElT5V4ziHIxKwrz3QabwZOaVwG16BXQEE9 ARsvZvQI4oSURISTUwJuq5m+645rrwbtvPKYEVxwvMtib9SP/TJR7qIb6ryDI+ceNk5QyRADc R/WeMVjFpm6yl/jyYdivJjed5esKZO5esUm63SBx+WbHQY26bKNvxRSXKa5QKRea/DXqu0cP7 ptR6Ittv36vfaro2+u/I++vWJ1S6aJOvSdzlpwzte96u1i5mlglUYinOSDTUYi4qTgQAXONAz 6ICAAA= X-Env-Sender: prvs=462d8fd40=ross.lagerwall@citrix.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1508749515!81107749!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43855 invoked from network); 23 Oct 2017 09:05:18 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-11.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Oct 2017 09:05:18 -0000 X-IronPort-AV: E=Sophos;i="5.43,422,1503360000"; d="scan'208";a="447622360" From: Ross Lagerwall To: Date: Mon, 23 Oct 2017 10:05:09 +0100 Message-ID: <20171023090509.4338-6-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171023090509.4338-1-ross.lagerwall@citrix.com> References: <20171023090509.4338-1-ross.lagerwall@citrix.com> MIME-Version: 1.0 Cc: Ross Lagerwall , Ian Jackson , Wei Liu Subject: [Xen-devel] [PATCH v2 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr 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 Reviewed-by: Paul Durrant --- tools/libs/devicemodel/core.c | 19 +++++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 14 ++++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 1 + 3 files changed, 34 insertions(+) diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c index 07953d3..e496fc9 100644 --- a/tools/libs/devicemodel/core.c +++ b/tools/libs/devicemodel/core.c @@ -585,6 +585,25 @@ int xendevicemodel_add_to_physmap( return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); } +int xendevicemodel_pin_memory_cacheattr( + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end, + uint32_t type) +{ + struct xen_dm_op op; + struct xen_dm_op_pin_memory_cacheattr *data; + + memset(&op, 0, sizeof(op)); + + op.op = XEN_DMOP_pin_memory_cacheattr; + data = &op.u.pin_memory_cacheattr; + + data->start = start; + data->end = end; + data->type = type; + + 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 6967e58..d82535b 100644 --- a/tools/libs/devicemodel/include/xendevicemodel.h +++ b/tools/libs/devicemodel/include/xendevicemodel.h @@ -341,6 +341,20 @@ int xendevicemodel_add_to_physmap( uint64_t gpfn); /** + * Pins caching type of RAM space. + * + * @parm dmod a handle to an open devicemodel interface. + * @parm domid the domain id to be serviced + * @parm start Start gfn + * @parm end End gfn + * @parm type XEN_DOMCTL_MEM_CACHEATTR_* + * @return 0 on success, -1 on failure. + */ +int xendevicemodel_pin_memory_cacheattr( + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end, + uint32_t type); + +/** * 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 4a19ecb..e820b77 100644 --- a/tools/libs/devicemodel/libxendevicemodel.map +++ b/tools/libs/devicemodel/libxendevicemodel.map @@ -31,4 +31,5 @@ VERS_1.1 { VERS_1.2 { global: xendevicemodel_add_to_physmap; + xendevicemodel_pin_memory_cacheattr; } VERS_1.1;