From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTAyn-0004MM-4h for qemu-devel@nongnu.org; Tue, 09 Feb 2016 11:17:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTAyh-0006aT-39 for qemu-devel@nongnu.org; Tue, 09 Feb 2016 11:17:28 -0500 Received: from smtp.citrix.com ([66.165.176.89]:17757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTAyg-0006aD-Uj for qemu-devel@nongnu.org; Tue, 09 Feb 2016 11:17:23 -0500 From: Ian Campbell Date: Tue, 9 Feb 2016 16:17:15 +0000 Message-ID: <1455034636-27829-4-git-send-email-ian.campbell@citrix.com> In-Reply-To: <1455034615.19857.96.camel@citrix.com> References: <1455034615.19857.96.camel@citrix.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 4/5] xen: move xenforeignmemory compat layer into common place List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org Cc: Ian Campbell , xen-devel@lists.xen.org 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 --- 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 */ -- 2.1.4