From patchwork Wed Feb 10 11:07:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 8270261 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5B45BEEE5 for ; Wed, 10 Feb 2016 11:10:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4F662037E for ; Wed, 10 Feb 2016 11:10:27 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB6C42037C for ; Wed, 10 Feb 2016 11:10:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTScW-0008Br-Qx; Wed, 10 Feb 2016 11:07:40 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTScU-0008Bd-TN for xen-devel@lists.xen.org; Wed, 10 Feb 2016 11:07:39 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id C0/A9-09708-AF91BB65; Wed, 10 Feb 2016 11:07:38 +0000 X-Env-Sender: prvs=841e7c5e8=Ian.Campbell@citrix.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1455102453!14946561!1 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: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14973 invoked from network); 10 Feb 2016 11:07:36 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-15.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 10 Feb 2016 11:07:36 -0000 X-IronPort-AV: E=Sophos;i="5.22,425,1449532800"; d="scan'208";a="337239966" From: Ian Campbell To: , Date: Wed, 10 Feb 2016 11:07:04 +0000 Message-ID: <1455102425-16245-4-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455102412.19857.155.camel@citrix.com> References: <1455102412.19857.155.camel@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v2 4/5] xen: move xenforeignmemory compat layer into common place X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we no longer support Xen 4.2 and earlier only the <470 case needs this so it can live with all the others. Signed-off-by: Ian Campbell Reviewed-by: Stefano Stabellini --- include/hw/xen/xen_common.h | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 254ef14..7a3cce0 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -53,7 +53,20 @@ typedef xc_gnttab xengnttab_handle; #define xengnttab_map_grant_refs(h, c, d, r, p) \ xc_gnttab_map_grant_refs(h, c, d, r, p) -/* See below for xenforeignmemory_* APIs */ +#define xenforeignmemory_open(l, f) xen_xc + +static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom, + int prot, size_t pages, + const xen_pfn_t arr[/*pages*/], + int err[/*pages*/]) +{ + if (err) + return xc_map_foreign_bulk(h, dom, prot, arr, err, pages); + else + return xc_map_foreign_pages(h, dom, prot, arr, pages); +} + +#define xenforeignmemory_unmap(h, p, s) munmap(p, s * XC_PAGE_SIZE) #else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 471 */ @@ -359,23 +372,4 @@ static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref, #endif #endif -#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 471 - -#define xenforeignmemory_open(l, f) xen_xc - -static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom, - int prot, size_t pages, - const xen_pfn_t arr[/*pages*/], - int err[/*pages*/]) -{ - if (err) - return xc_map_foreign_bulk(h, dom, prot, arr, err, pages); - else - return xc_map_foreign_pages(h, dom, prot, arr, pages); -} - -#define xenforeignmemory_unmap(h, p, s) munmap(p, s * XC_PAGE_SIZE) - -#endif - #endif /* QEMU_HW_XEN_COMMON_H */