From patchwork Tue Jun 21 13:20:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9190541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0853B6075E for ; Tue, 21 Jun 2016 13:23:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED33327F8D for ; Tue, 21 Jun 2016 13:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1FAC28156; Tue, 21 Jun 2016 13:23:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 80B4D27F8D for ; Tue, 21 Jun 2016 13:23:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFLbr-0004Pz-8r; Tue, 21 Jun 2016 13:20:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFLbq-0004PP-0e for xen-devel@lists.xen.org; Tue, 21 Jun 2016 13:20:54 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 21/FB-02783-43F39675; Tue, 21 Jun 2016 13:20:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTdfEPjP c4Ow8cYslHxezODB6HN39mymAMYo1My8pvyKBNeNY2z2mgm3SFc8/vWZuYNwm2sXIxSEksIlR 4srfVSwQzmlGiY879rF1MXJysAloStz5/IkJxBYRkJa49vkyI4jNLHCJSeLjFF4QW1ggSmJOX wN7FyMHB4uAqsSRGX4gYV4BF4lNFzrByiUE5CROHpvMCmJzCrhKbLzYBTZSCKhm8tEvLBMYuR cwMqxiVC9OLSpLLdI11ksqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPQuAxDsYGz +4nSIUZKDSUmUl1k5I1yILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG+lXWa4kGBRanpqRVpmDjDM YNISHDxKIrzTQNK8xQWJucWZ6RCpU4yKUuK8xSAJAZBERmkeXBsstC8xykoJ8zICHSLEU5Bal JtZgir/ilGcg1FJmFcGZApPZl4J3PRXQIuZgBYv608HWVySiJCSamAMEJh1wrV/2eyaq5xTFS 5crKyc1XZalLlhWuxppid/vy37Y/F20zEOX3tvNdPWXUe0Z897EbvD841SyLa8H9sKdwpfSbj 9rtj8D9vHaw/OB33ykQ8Q3Zpe8Sv3XC5n/6UMa4/Tn89wiEv/idBqqe4WV/1Uqi7BUGU+deGx acFyBimFm3RPZrEpsRRnJBpqMRcVJwIAb0vtGGgCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1466515251!20223075!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 27381 invoked from network); 21 Jun 2016 13:20:52 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-31.messagelabs.com with SMTP; 21 Jun 2016 13:20:51 -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 5CE2A3B9; Tue, 21 Jun 2016 06:21:37 -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 964A93F246; Tue, 21 Jun 2016 06:20:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 21 Jun 2016 14:20:36 +0100 Message-Id: <1466515243-27264-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466515243-27264-1-git-send-email-julien.grall@arm.com> References: <1466515243-27264-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 v3 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Stefano Stabellini --- 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