From patchwork Wed Oct 18 14:03:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 10014787 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 2ECFA603FF for ; Wed, 18 Oct 2017 14:07:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23EBE28BDB for ; Wed, 18 Oct 2017 14:07:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1881228C04; Wed, 18 Oct 2017 14:07:25 +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 BF8D428BE3 for ; Wed, 18 Oct 2017 14:07:24 +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 1e4oyE-0007rD-9N; Wed, 18 Oct 2017 14:05:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4oyC-0007qD-HS for xen-devel@lists.xen.org; Wed, 18 Oct 2017 14:05:16 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 76/89-29911-B9F57E95; Wed, 18 Oct 2017 14:05:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHSDve7s+Oe RBr8my1ks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlT9n1gKjglXPF+1mzmBsb7Al2MnBwSAv4S ay8uYQKx2QQMJG5d+s4MYosIqEuc7rjICmIzC5RLnNh+mA3EFhaIlfi+7w4LiM0ioCqx/9wHs HpeATuJWRc72CFmyknsuTgDzOYUsJeY3dYPZgsB1ay5NpMNwlaTeLv8DAtEr6DEyZlPWCB2SU gcfPGCeQIj7ywkqVlIUgsYmVYxahSnFpWlFukaWeolFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQ mFesl5+duYgQGDwMQ7GA8sCjwEKMkB5OSKK/ugWeRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4 F8c9jxQSLEpNT61Iy8wBhjFMWoKDR0mE93ssUJq3uCAxtzgzHSJ1ilGXo+Pm3T9MQix5+XmpU uK8QiAzBECKMkrz4EbAYuoSo6yUMC8j0FFCPAWpRbmZJajyrxjFORiVhHktQabwZOaVwG16BX QEE9AR65yegBxRkoiQkmpg1FkSpvDJo21XX6RZJevzBadv/D3ZJ1Q/15yrdYWS57PIhJovUuH bb4lNuS1kEF0S1nvEqyPel+vdch8PBY8Ht9bPNZ/XpL184evVYiIaDxZsuJXcWc+7TXHb95mb /XP9Fv0pShDmPuP/Kybx9Fq3jszY2R+T8sQb5d3nB/zaKJLyJLjszywuJZbijERDLeai4kQAa txkmaQCAAA= X-Env-Sender: prvs=457f25213=ross.lagerwall@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1508335509!111976702!4 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 10948 invoked from network); 18 Oct 2017 14:05:15 -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:15 -0000 X-IronPort-AV: E=Sophos;i="5.43,397,1503360000"; d="scan'208";a="454799341" From: Ross Lagerwall To: Xen-devel Date: Wed, 18 Oct 2017 15:03:39 +0100 Message-ID: <20171018140339.13888-6-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 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 2a23077..dada57e 100644 --- a/tools/libs/devicemodel/core.c +++ b/tools/libs/devicemodel/core.c @@ -581,6 +581,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 2c4e392..9de6d46 100644 --- a/tools/libs/devicemodel/include/xendevicemodel.h +++ b/tools/libs/devicemodel/include/xendevicemodel.h @@ -339,6 +339,20 @@ int xendevicemodel_add_to_physmap( xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, 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;