From patchwork Tue Jul 25 14:11:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9862095 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 C2063600F5 for ; Tue, 25 Jul 2017 14:13:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B586425F31 for ; Tue, 25 Jul 2017 14:13:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA48F27F8F; Tue, 25 Jul 2017 14:13:58 +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 F040325F31 for ; Tue, 25 Jul 2017 14:13:55 +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 1da0YN-0006nS-7G; Tue, 25 Jul 2017 14:11:15 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da0YM-0006nL-3P for xen-devel@lists.xen.org; Tue, 25 Jul 2017 14:11:14 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id FC/60-02177-18157795; Tue, 25 Jul 2017 14:11:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHRDpG5DYHm kQVOjmcWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmtGw/iprwS2Fiu+bfzM3MDaIdTFyckgI+Es8 f/+aHcRmE9CX2P3iExOILSKgLnG64yJrFyMXB7PAHEaJqXP2MIIkhAWSJc48uMQGYrMIqEose vqOBcTmFfCUuHf+AjvEUDmJ88d/MoPYnAJeEvdXHQSrFwKq+fBqFiuErSZxrf8SO0SvoMTJmU /A5jALSEgcfPGCeQIj7ywkqVlIUgsYmVYxqhenFpWlFuka6SUVZaZnlOQmZuboGhqY6uWmFhc npqfmJCYV6yXn525iBAYPAxDsYPz+x+kQoyQHk5Io7zfd8kghvqT8lMqMxOKM+KLSnNTiQ4wy HBxKErwsAUA5waLU9NSKtMwcYBjDpCU4eJREeCP9gdK8xQWJucWZ6RCpU4y6HK8m/P/GJMSSl 5+XKiXOywwyQwCkKKM0D24ELKYuMcpKCfMyAh0lxFOQWpSbWYIq/4pRnINRSZj3Fsgqnsy8Er hNr4COYAI6Ys6MUpAjShIRUlINjJOesS1SEdDbOMXW/WWqaK3d34yPRy1k2lpum2zy6l/8car iQuP3xfKf7apNckQtUyZuWJprtVzowuO186SnHV/9pGOvYeTblOtx6f59fLPMLDz1Vxp6XSve /unIDEdp42tym6v3lv9iuGTXLye1KEvmwKccLaHYxWc/2TL4BU5fd+N17Ot74UosxRmJhlrMR cWJACLBPhqkAgAA X-Env-Sender: prvs=3721034a5=Andrew.Cooper3@citrix.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1500991871!90425691!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35818 invoked from network); 25 Jul 2017 14:11:12 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 25 Jul 2017 14:11:12 -0000 X-IronPort-AV: E=Sophos;i="5.40,411,1496102400"; d="scan'208";a="432873642" From: Andrew Cooper To: Xen-devel Date: Tue, 25 Jul 2017 15:11:08 +0100 Message-ID: <1500991868-25798-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1500991868-25798-1-git-send-email-andrew.cooper3@citrix.com> References: <1500991868-25798-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: George Dunlap , Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH 2/2] x86/mm: Rename get_page_and_type_from_pagenr() to get_page_and_type_from_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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 'pagenr' is actually an mfn. Rename the function to use consistent terminology, switching it to use a typesafe mfn_t. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu --- CC: Jan Beulich CC: George Dunlap CC: Wei Liu --- xen/arch/x86/mm.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 6075be6..51c93c1 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -731,17 +731,15 @@ static bool get_page_from_mfn(mfn_t mfn, struct domain *d) } -static int get_page_and_type_from_pagenr(unsigned long page_nr, - unsigned long type, - struct domain *d, - int partial, - int preemptible) +static int get_page_and_type_from_mfn( + mfn_t mfn, unsigned long type, struct domain *d, + int partial, int preemptible) { - struct page_info *page = mfn_to_page(page_nr); + struct page_info *page = mfn_to_page(mfn_x(mfn)); int rc; if ( likely(partial >= 0) && - unlikely(!get_page_from_mfn(_mfn(page_nr), d)) ) + unlikely(!get_page_from_mfn(mfn, d)) ) return -EINVAL; rc = (preemptible ? @@ -1125,7 +1123,7 @@ get_page_from_l2e( if ( !(l2e_get_flags(l2e) & _PAGE_PSE) ) { - rc = get_page_and_type_from_pagenr(mfn, PGT_l1_page_table, d, 0, 0); + rc = get_page_and_type_from_mfn(_mfn(mfn), PGT_l1_page_table, d, 0, 0); if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) ) rc = 0; return rc; @@ -1165,8 +1163,8 @@ get_page_from_l3e( return -EINVAL; } - rc = get_page_and_type_from_pagenr( - l3e_get_pfn(l3e), PGT_l2_page_table, d, partial, 1); + rc = get_page_and_type_from_mfn( + _mfn(l3e_get_pfn(l3e)), PGT_l2_page_table, d, partial, 1); if ( unlikely(rc == -EINVAL) && !is_pv_32bit_domain(d) && get_l3_linear_pagetable(l3e, pfn, d) ) @@ -1192,8 +1190,8 @@ get_page_from_l4e( return -EINVAL; } - rc = get_page_and_type_from_pagenr( - l4e_get_pfn(l4e), PGT_l3_page_table, d, partial, 1); + rc = get_page_and_type_from_mfn( + _mfn(l4e_get_pfn(l4e)), PGT_l3_page_table, d, partial, 1); if ( unlikely(rc == -EINVAL) && get_l4_linear_pagetable(l4e, pfn, d) ) rc = 0; @@ -1547,10 +1545,9 @@ static int alloc_l3_table(struct page_info *page) (l3e_get_flags(pl3e[i]) & l3_disallow_mask(d)) ) rc = -EINVAL; else - rc = get_page_and_type_from_pagenr(l3e_get_pfn(pl3e[i]), - PGT_l2_page_table | - PGT_pae_xen_l2, - d, partial, 1); + rc = get_page_and_type_from_mfn( + _mfn(l3e_get_pfn(pl3e[i])), + PGT_l2_page_table | PGT_pae_xen_l2, d, partial, 1); } else if ( !is_guest_l3_slot(i) || (rc = get_page_from_l3e(pl3e[i], pfn, d, partial)) > 0 ) @@ -3002,7 +2999,7 @@ int new_guest_cr3(unsigned long mfn) rc = paging_mode_refcounts(d) ? (get_page_from_mfn(_mfn(mfn), d) ? 0 : -EINVAL) - : get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 1); + : get_page_and_type_from_mfn(_mfn(mfn), PGT_root_page_table, d, 0, 1); switch ( rc ) { case 0: @@ -3377,9 +3374,8 @@ long do_mmuext_op( if ( op.arg1.mfn != 0 ) { - rc = get_page_and_type_from_pagenr(op.arg1.mfn, - PGT_root_page_table, - currd, 0, 1); + rc = get_page_and_type_from_mfn( + _mfn(op.arg1.mfn), PGT_root_page_table, currd, 0, 1); if ( unlikely(rc) ) {