From patchwork Mon Aug 14 14:23:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110023 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281996obb; Mon, 14 Aug 2017 07:26:39 -0700 (PDT) X-Received: by 10.107.173.150 with SMTP id m22mr19305889ioo.264.1502720799749; Mon, 14 Aug 2017 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720799; cv=none; d=google.com; s=arc-20160816; b=fEeDN2X3mPW/AkxEg+nBU01pMI39dwK92NdwO2YHu8PATE4ESvQWU9l+WWn5UZB/Z7 MXs4FPfpfhtjmrKHylVUVBFpVNCg6YSqpCXS0b7M1PkHW04yYSY4Vj1w5Xo/EqwisobL ENVGqEpG2kRLljDPIJJru1W4SkLyd/WL0yfxqtmxbt3nlLDZyEcqF4lslhZcaOBjgovn yOkQZ4XcCNU9eAP3Zvet8Q95oOs+ZR6M79F1CeuaR3AdQ5kIWZJPxGWr2ywjl+Ew7Onw pKoek9vAE0gXz24nK5IvYVOUiKymngCKa8yDDFG11HJa4q9p/S1Rqa+VUfU+ZIzQtDCC m3jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=2D7UBZz3v8W8EHFw32152XF6iDS3RFkmLF6yIrhZmQY=; b=Imeq7bUN3gzrAWwVy3b0SqiN6tp9GITENI1GVpi3++KvJxbfRef7lKfelyyzqki26l SvN0VTYsiwoQEvJBd/jnba9GihgqioFLRsaW3+aYeHTKQ0/IPBvPuYfxhHRW7pkEWu8b dnHxLjqRswBQBbYQ4U/vS9C02VsjyZ51iEJJW6ilg7EGqcP9kx3g9lSMQYsghi4uB9S0 dEKljESZiVskmXqNQ7ZlwQJ/KU7+mr5TVe/85w0NX7cOJ5MXdLBjY2umVAaNXHazOtz6 f1nh0SleHfQJgjJUgQi4Dmlnkwk5SGEznvRakzZHZZRodImQftI9rcSTHf6bTKW2bqpt ofaA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 91si7153653ioi.126.2017.08.14.07.26.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:39 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIK-0000Es-8p; Mon, 14 Aug 2017 14:24:40 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGII-0000DU-KN for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:38 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 0E/D4-03557-5A2B1995; Mon, 14 Aug 2017 14:24:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfppom RBj+ei1ks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkHLnSzFlwTrNh1dxdjA+MC/i5GLg4hgc2M EguP/WbpYuQEck4zShw6rQ5iswloStz5/IkJxBYRkJa49vkyI0gDs8BrJonPW7cxgySEBQIk7 ndfB7NZBFQlHpz7zghi8wpYSrz7+QNsqISAvMSutousIDangJVE592dUMssJU6sns02gZF7AS PDKkaN4tSistQiXUMDvaSizPSMktzEzBwgz0wvN7W4ODE9NScxqVgvOT93EyPQwwxAsIPx+Pu 4Q4ySHExKorwJPr2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4UzdOjBQSLEpNT61Iy8wBhhpM WoKDR0mEdxZImre4IDG3ODMdInWKUZfj1YT/35iEWPLy81KlxHlrNgAVCYAUZZTmwY2Ahf0lR lkpYV5GoKOEeApSi3IzS1DlXzGKczAqCfM6gaziycwrgdv0CugIJqAj+kDu5y0uSURISTUwNr 48fZw1bN5f3zec5e19G/0MC+Xkn8608j0f2FDwKa7n0s4Mi2751Lp073My5y957ZS0eZ4h31X 2t0EuMUyYxzB/skRnRLDexJv3b5ZpOtwt4ou4HabffnLjzd1v3Pv1p+TkrBIXKgiKSA8J2sTy 6fr0ZSqh9yzvJwm9Se/nmFFRW5thxKrEUpyRaKjFXFScCABxqgoIdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1502720676!111915511!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26572 invoked from network); 14 Aug 2017 14:24:37 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:37 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D7AE164F; Mon, 14 Aug 2017 07:24:36 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACC873F483; Mon, 14 Aug 2017 07:24:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:55 +0100 Message-Id: <20170814142418.13267-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 04/27] xen/mm: Move {G, M]FN <-> {G, M}ADDR helpers to common code 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Helpers to convert {G,M}FN to {G,M}ADDR and vice-versa were recently introduced on ARM. However, they could be used in common code to simplify a bit the code when using typesafes. Signed-off-by: Julien Grall --- Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/include/asm-arm/mm.h | 4 ---- xen/include/xen/mm.h | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index ef84b72474..28bdcc900e 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -207,10 +207,6 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) #define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) #define paddr_to_pdx(pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define gfn_to_gaddr(gfn) pfn_to_paddr(gfn_x(gfn)) -#define gaddr_to_gfn(ga) _gfn(paddr_to_pfn(ga)) -#define mfn_to_maddr(mfn) pfn_to_paddr(mfn_x(mfn)) -#define maddr_to_mfn(ma) _mfn(paddr_to_pfn(ma)) #define vmap_to_mfn(va) paddr_to_pfn(virt_to_maddr((vaddr_t)va)) #define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 503b92e4b0..eb0409d832 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -92,6 +92,9 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) return mfn_x(x) == mfn_x(y); } +#define maddr_to_mfn(maddr) _mfn(paddr_to_pfn(maddr)) +#define mfn_to_maddr(mfn) pfn_to_paddr(mfn_x(mfn)) + TYPE_SAFE(unsigned long, gfn); #define PRI_gfn "05lx" #define INVALID_GFN _gfn(~0UL) @@ -130,6 +133,9 @@ static inline bool_t gfn_eq(gfn_t x, gfn_t y) return gfn_x(x) == gfn_x(y); } +#define gaddr_to_gfn(gaddr) _gfn(paddr_to_pfn(gaddr)) +#define gfn_to_gaddr(gfn) pfn_to_paddr(gfn_x(gfn)) + TYPE_SAFE(unsigned long, pfn); #define PRI_pfn "05lx" #define INVALID_PFN (~0UL)