From patchwork Tue Jun 13 16:13:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105402 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486541qgd; Tue, 13 Jun 2017 09:15:38 -0700 (PDT) X-Received: by 10.157.36.47 with SMTP id p44mr580484ota.14.1497370538015; Tue, 13 Jun 2017 09:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370538; cv=none; d=google.com; s=arc-20160816; b=NLO0afA63V2iJ43VFKgwD+Q/P8sCwxc6GKBvrfpTlucRlejvoSmWN1JRef3My20eQW fYjtUyMcD0+TMwVWcn9SscZ3HCjkZLRZKZgPg3HNmC2TnzBPQvNHkXrgFY/Y/CoobOmT QNdJ2DVmIKVmvrpvMxvbDaZUwRWFlZS/cf+FOw7v8DWrnTqHzNop0+qCn3oqe1xltnLj +if5/csvS4BIzdKEMf9JzUX+w6mvEY5TA5FWormN2A2LSuirxuYWnOsYb2omUCcc+JD9 4kfNqncyClm8VoNabFje4XAoOXEysMzxvY0tEvWHzKTOe7uSYCafEjx1AXXkLE7us5pr pYIg== 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=Wujn8+7BIeElHopSLLNAtS5vXXJ3tlmjK0smXR7xufw=; b=WNXKymzNYiFTkcTbKVCpihhcSLdeDxAJW7G3xjJlzYYgimgaT7ZAamtVkvukjgdzJ3 Wtyc1SJzjGVheiZTMqvOc8r5+axjFSEdqO3EgfegRsP2Pb6aeFGyaJ50J8eMuinMbqKo LwgmvnTJTedbnFJZGQpJNSs61IjYOXV/de95HxBomxUW7P4KPhHuTNJd5L8zChORqjNJ xJ21J3jZGGblKnE7sUQnfZeYiDdDa+5slqPdRM5QiwUwY4gvsnEOyC0gcHIatS+ywQDS Rx4YJsHPORr0dldLQkvrbq+uFMnYrsjQNqXHX7vssx+1XSW+hnPx3+uJoMEytSiLC8tE y+8Q== 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 k17si356266otk.169.2017.06.13.09.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:38 -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 1dKoRv-0008DL-Co; Tue, 13 Jun 2017 16:13:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoRt-00089r-7I for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:45 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 13/09-03620-83F00495; Tue, 13 Jun 2017 16:13:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTdeU3yH SYN0VHYslHxezODB6HN39mymAMYo1My8pvyKBNWP6iYssBdP4K64emcTSwDiRt4uRi0NIYDOj xM4F31ggnNOMEg+2TGXtYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBComnBXrC4sECqxOu1N 9hAbBYBVYmTj06ygNi8AlYSXR2PwOISAvISu9ougs3kBIpfet4ENkdIwFKiefd6pgmM3AsYGV YxqhenFpWlFula6iUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBPqXAQh2MN7dFHC IUZKDSUmUd8sVm0ghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErz2fA6RQoJFqempFWmZOcBAg0lL cPAoifDeZwFK8xYXJOYWZ6ZDpE4xKkqJ804A6RMASWSU5sG1wYL7EqOslDAvI9AhQjwFqUW5m SWo8q8YxTkYlYR5l4BM4cnMK4Gb/gpoMRPQ4usgN/MWlyQipKQaGOUznX0vvfY/pnro4p4tST 8nTNObFdjbwPvtyPzKTZJCJnYZ+YF1y0XK1esW/N6ytTFp6XtBhdjQqS8zf7Gu8F3nxbYt5V7 KeWfnO8Xi32/MmubudPz+9den/3WbzI7zNTTcYJt3KyUuccGzXT5PRT6XBibZTV0VvGHOkim7 +Rj+HFJ7kPRQvVOJpTgj0VCLuag4EQChBWP3aQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1497370421!73736992!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57890 invoked from network); 13 Jun 2017 16:13:41 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-21.messagelabs.com with SMTP; 13 Jun 2017 16:13:41 -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 0AF6715A2; Tue, 13 Jun 2017 09:13:41 -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 46FFC3F557; Tue, 13 Jun 2017 09:13:40 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:08 +0100 Message-Id: <20170613161323.25196-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613161323.25196-1-julien.grall@arm.com> References: <20170613161323.25196-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 09/24] xen/arm: Define mfn_to_page/page_to_mfn in term of __mfn_to_page/__page_to_mfn 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" This is matching the x86 side where the __* version is used if you need to override the helpers in source files. At the same time, move the non-underscore version at the end of the defintion and add a comment to explain them. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/include/asm-arm/mm.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index f6915ad882..cc3220a6b7 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -203,10 +203,8 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) }) /* Convert between machine frame numbers and page-info structures. */ -#define mfn_to_page(mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) -#define page_to_mfn(pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) -#define __page_to_mfn(pg) page_to_mfn(pg) -#define __mfn_to_page(mfn) mfn_to_page(mfn) +#define __mfn_to_page(mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) +#define __page_to_mfn(pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) /* Convert between machine addresses and page-info structures. */ #define maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT) @@ -264,6 +262,13 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) #define virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT) #define mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) +/* + * We define non-underscored wrappers for above conversion functions. + * These are overriden in various source files while underscored version + * remain intact. + */ +#define mfn_to_page(mfn) __mfn_to_page(mfn) +#define page_to_mfn(pg) __page_to_mfn(pg) /* Convert between Xen-heap virtual addresses and page-info structures. */ static inline struct page_info *virt_to_page(const void *v)