From patchwork Fri Feb 12 17:31:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 8294101 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 326E79F1E0 for ; Fri, 12 Feb 2016 17:32:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9521A20429 for ; Fri, 12 Feb 2016 17:32:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3D5520421 for ; Fri, 12 Feb 2016 17:32:01 +0000 (UTC) Received: from localhost ([::1]:34725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUHZZ-0006JJ-76 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Feb 2016 12:32:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUHZM-0006HX-OJ for qemu-devel@nongnu.org; Fri, 12 Feb 2016 12:31:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUHZJ-0006DX-KH for qemu-devel@nongnu.org; Fri, 12 Feb 2016 12:31:48 -0500 Received: from smtp.citrix.com ([66.165.176.89]:43528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUHZJ-0006D0-Dn for qemu-devel@nongnu.org; Fri, 12 Feb 2016 12:31:45 -0500 X-IronPort-AV: E=Sophos;i="5.22,436,1449532800"; d="scan'208";a="331404939" From: Stefano Stabellini To: Date: Fri, 12 Feb 2016 17:31:04 +0000 Message-ID: <1455298265-16795-4-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Ian Campbell , xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini Subject: [Qemu-devel] [PULL 4/5] xen: move xenforeignmemory compat layer into common place X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Ian Campbell 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 Signed-off-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 */