From patchwork Tue Jun 14 12:07:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 69988 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2011485qgf; Tue, 14 Jun 2016 05:08:45 -0700 (PDT) X-Received: by 10.176.3.72 with SMTP id 66mr8326016uat.146.1465906125096; Tue, 14 Jun 2016 05:08:45 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id j32si6941667uad.104.2016.06.14.05.08.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jun 2016 05:08:45 -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 1bCn7n-0004rt-Iy; Tue, 14 Jun 2016 12:07:19 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCn7m-0004rg-V2 for xen-devel@lists.xen.org; Tue, 14 Jun 2016 12:07:19 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 95/84-30266-673FF575; Tue, 14 Jun 2016 12:07:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRWlGSWpSXmKPExsVysyfVTbf0c3y 4wa/dxhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aa3euYCu6JV8zetoqxgXGZUBcjF4eQwCZG iXNL57J3MXICOacZJW6tVQCx2QQ0Je58/sQEYosISEtc+3yZEcRmFgiTuP1mF5gtLBAusfrxX VYQm0VAVWLjuztgc3gFXCSaG7vAbAkBOYmTxyYD1XBwcAq4StydIgyxykViZsssxgmM3AsYGV YxqhenFpWlFuka6yUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBPqWAQh2MHb8czr EKMnBpCTKe3tifLgQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd4ln4BygkWp6akVaZk5wCCDSUtw 8CiJ8C4ESfMWFyTmFmemQ6ROMSpKifOagSQEQBIZpXlwbbDAvsQoKyXMywh0iBBPQWpRbmYJq vwrRnEORiVh3qUgU3gy80rgpr8CWswEtNhmOtjikkSElFQDI3tQNN+tK0nLVPepuJZrWazz+Z 3LveOE0f4dKt1afouUPrYFz1nI2GVg+m9ufsep6w7fEjbVbeKN+WKfsfLa/fRXIk9mvKt92as nvdr23sRfEuIFDosdb/otEk6+p/Sn9mN4q80PzX/rs4yaJLOm2SXZN07l9ON+4Srws1jc0Irx ucrTNYcLlFiKMxINtZiLihMBdE/BoGcCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1465906037!18879252!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2304 invoked from network); 14 Jun 2016 12:07:17 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-21.messagelabs.com with SMTP; 14 Jun 2016 12:07:17 -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 435422A2; Tue, 14 Jun 2016 05:07:57 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D37993F246; Tue, 14 Jun 2016 05:07:15 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 14 Jun 2016 13:07:00 +0100 Message-Id: <1465906027-16614-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465906027-16614-1-git-send-email-julien.grall@arm.com> References: <1465906027-16614-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, wei.chen@linaro.org Subject: [Xen-devel] [PATCH 1/8] xen/arm: Rename gmfn_to_mfn to gfn_to_mfn and use gfn/mfn typesafe 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" The correct acronym for a guest physical frame is gfn. Also use the recently introduced typesafe gfn/mfn to avoid mixing the two different kind of frame. Signed-off-by: Julien Grall --- xen/arch/arm/p2m.c | 6 +++--- xen/common/grant_table.c | 4 ++-- xen/common/memory.c | 4 ++-- xen/include/asm-arm/p2m.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 6a19c57..867e294 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1479,10 +1479,10 @@ int p2m_cache_flush(struct domain *d, xen_pfn_t start_mfn, xen_pfn_t end_mfn) d->arch.p2m.default_access); } -unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) +mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn) { - paddr_t p = p2m_lookup(d, pfn_to_paddr(gpfn), NULL); - return p >> PAGE_SHIFT; + paddr_t p = p2m_lookup(d, pfn_to_paddr(gfn_x(gfn)), NULL); + return _mfn(p >> PAGE_SHIFT); } /* diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 8b22299..3c304f4 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -256,7 +256,7 @@ static int __get_paged_frame(unsigned long gfn, unsigned long *frame, struct pag } *frame = page_to_mfn(*page); #else - *frame = gmfn_to_mfn(rd, gfn); + *frame = mfn_x(gfn_to_mfn(rd, _gfn(gfn))); *page = mfn_valid(*frame) ? mfn_to_page(*frame) : NULL; if ( (!(*page)) || (!get_page(*page, rd)) ) { @@ -1788,7 +1788,7 @@ gnttab_transfer( mfn = INVALID_MFN; } #else - mfn = gmfn_to_mfn(d, gop.mfn); + mfn = mfn_x(gfn_to_mfn(d, _gfn(gop.mfn))); #endif /* Check the passed page frame for basic validity. */ diff --git a/xen/common/memory.c b/xen/common/memory.c index ccc6436..3149f26 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -264,7 +264,7 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) return 1; } #else - mfn = gmfn_to_mfn(d, gmfn); + mfn = mfn_x(gfn_to_mfn(d, _gfn(gmfn))); #endif if ( unlikely(!mfn_valid(mfn)) ) { @@ -488,7 +488,7 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg) goto fail; } #else /* !CONFIG_X86 */ - mfn = gmfn_to_mfn(d, gmfn + k); + mfn = mfn_x(gfn_to_mfn(d, _gfn(gmfn + k))); #endif if ( unlikely(!mfn_valid(mfn)) ) { diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index d240d1e..75c65a8 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -178,7 +178,7 @@ void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, unsigned long mfn, unsigned int page_order); -unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn); +mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn); /* * Populate-on-demand