From patchwork Mon Jun 20 13:37:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 70446 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1516246qgy; Mon, 20 Jun 2016 06:39:33 -0700 (PDT) X-Received: by 10.36.3.7 with SMTP id e7mr16855833ite.15.1466429973672; Mon, 20 Jun 2016 06:39:33 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u67si4977605itf.74.2016.06.20.06.39.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 06:39:33 -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 1bEzOV-0005Dd-1A; Mon, 20 Jun 2016 13:37:39 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bEzOU-0005DU-2w for xen-devel@lists.xen.org; Mon, 20 Jun 2016 13:37:38 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 13/32-00606-1A1F7675; Mon, 20 Jun 2016 13:37:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTXfBx/R wg3N9JhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8axtntMBdukK55/es3cwLhNtIuRi0NIYBOj xM2XP9kgnNOMEj/7rjF1MXJysAloStz5/AnMFhGQlrj2+TIjiM0scIlJ4uMUXhBbWCBKYuXUH vYuRg4OFgFViRsH40HCvAIuEs8vf2MDsSUE5CROHpvMCmJzCrhKHHz2gx3EFgKq6f+1i2kCI/ cCRoZVjOrFqUVlqUW6JnpJRZnpGSW5iZk5uoYGpnq5qcXFiempOYlJxXrJ+bmbGIHeZQCCHYy 3+pwPMUpyMCmJ8k5/kh4uxJeUn1KZkVicEV9UmpNafIhRhoNDSYL32VugnGBRanpqRVpmDjDM YNISHDxKIrwHQNK8xQWJucWZ6RCpU4yKUuK8C0ESAiCJjNI8uDZYaF9ilJUS5mUEOkSIpyC1K DezBFX+FaM4B6OSMO9xkCk8mXklcNNfAS1mAlq8rB9scUkiQkqqgTEm880+ifAMTsOjudJHWs xnc6eyMrMKfDxjvSa0nOfEpvcrHsbz77tjw1d+d8nKmQbrt81bmbHn9VeVu/nNazYeOrBL5hb vnohVplpbZsXKOfvccKjdc6Vo6zq/jTaqa+9Ouz93/saC9Se/nV2xs/Dww+sn9hd7s7wsEt84 c4d++Gbdsqe/p86yUmIpzkg01GIuKk4EAPOYVsRoAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1466429856!45783328!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 44074 invoked from network); 20 Jun 2016 13:37:36 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 20 Jun 2016 13:37:36 -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 448B2B9A; Mon, 20 Jun 2016 06:38:21 -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 4B32F3F246; Mon, 20 Jun 2016 06:37:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 20 Jun 2016 14:37:18 +0100 Message-Id: <1466429845-28240-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466429845-28240-1-git-send-email-julien.grall@arm.com> References: <1466429845-28240-1-git-send-email-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v2 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 Acked-by: Jan Beulich --- Cc: Stefano Stabellini Cc: Jan Beulich Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu Changes in v2: - Add Jan's acked-by - CCed the relevant maintainers --- 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 65d8f1a..ab0cb41 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1481,10 +1481,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 46b1d9f..b54b076 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