From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 073D4C48BE6 for ; Wed, 16 Jun 2021 07:30:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E65466128C for ; Wed, 16 Jun 2021 07:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbhFPHcd (ORCPT ); Wed, 16 Jun 2021 03:32:33 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:58424 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbhFPHcR (ORCPT ); Wed, 16 Jun 2021 03:32:17 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0071A1FD64; Wed, 16 Jun 2021 07:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623828611; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B5lCFKLS4SrkKe1lJQmspLTLsY+q2DCNZBeEteAkDQg=; b=kBk7upbTudELxn7yk841qgv/oTl4rY+JGrnXx/ubDi7or2hFGGLcCc/8IfvwqRjNXUmSs8 DvdYGZHd+Nl/PdO99VHbDn9iHrQb8dHkoOHCudS/c0YIIBoEVMTyWWWTMF6kIviO54rDko riExKLBpi2seQw6jy11YdqeHGxnRf+I= Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id A8DBC118DD; Wed, 16 Jun 2021 07:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623828610; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B5lCFKLS4SrkKe1lJQmspLTLsY+q2DCNZBeEteAkDQg=; b=eZR6UrR0IN/1H5lwf+BJwP8nIqhw0G0LC3nS3EHasCUSZUHuKQtAyH9P4xUtVldEvTR4+n TvEL48QavumVOcMtRU9RbokYzMc6wbMcBITMtPW4k48qrxHo53UDD6xeF7CaHeQbxnlpnt HO6SlWPPONAx2ISAbOkkl56EZ1vSlGs= Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id GDcVKIKoyWBfZAAALh3uQQ (envelope-from ); Wed, 16 Jun 2021 07:30:10 +0000 From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH 2/2] xen: rename wrong named pfn related variables Date: Wed, 16 Jun 2021 09:30:07 +0200 Message-Id: <20210616073007.5215-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210616073007.5215-1-jgross@suse.com> References: <20210616073007.5215-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are some variables in Xen specific coding which names imply them holding a PFN, while in reality they are containing numbers of PFNs. Rename them accordingly. Signed-off-by: Juergen Gross --- arch/x86/include/asm/xen/page.h | 4 ++-- arch/x86/xen/p2m.c | 31 ++++++++++++++++--------------- arch/x86/xen/setup.c | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 1a162e559753..3590d6bf42c7 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h @@ -51,7 +51,7 @@ extern unsigned long *machine_to_phys_mapping; extern unsigned long machine_to_phys_nr; extern unsigned long *xen_p2m_addr; extern unsigned long xen_p2m_size; -extern unsigned long xen_max_p2m_pfn; +extern unsigned long xen_p2m_max_size; extern int xen_alloc_p2m_entry(unsigned long pfn); @@ -144,7 +144,7 @@ static inline unsigned long __pfn_to_mfn(unsigned long pfn) if (pfn < xen_p2m_size) mfn = xen_p2m_addr[pfn]; - else if (unlikely(pfn < xen_max_p2m_pfn)) + else if (unlikely(pfn < xen_p2m_max_size)) return get_phys_to_machine(pfn); else return IDENTITY_FRAME(pfn); diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 5e6e236977c7..babdc18dbef7 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -95,8 +95,8 @@ unsigned long *xen_p2m_addr __read_mostly; EXPORT_SYMBOL_GPL(xen_p2m_addr); unsigned long xen_p2m_size __read_mostly; EXPORT_SYMBOL_GPL(xen_p2m_size); -unsigned long xen_max_p2m_pfn __read_mostly; -EXPORT_SYMBOL_GPL(xen_max_p2m_pfn); +unsigned long xen_p2m_max_size __read_mostly; +EXPORT_SYMBOL_GPL(xen_p2m_max_size); #ifdef CONFIG_XEN_MEMORY_HOTPLUG_LIMIT #define P2M_LIMIT CONFIG_XEN_MEMORY_HOTPLUG_LIMIT @@ -121,7 +121,7 @@ static pte_t *p2m_identity_pte; * can avoid scanning the whole P2M (which may be sized to account for * hotplugged memory). */ -static unsigned long xen_p2m_last_pfn; +static unsigned long xen_p2m_pfn_limit; static inline unsigned p2m_top_index(unsigned long pfn) { @@ -239,7 +239,7 @@ void __ref xen_build_mfn_list_list(void) p2m_mid_mfn_init(p2m_mid_missing_mfn, p2m_missing); } - for (pfn = 0; pfn < xen_max_p2m_pfn && pfn < MAX_P2M_PFN; + for (pfn = 0; pfn < xen_p2m_max_size && pfn < MAX_P2M_PFN; pfn += P2M_PER_PAGE) { topidx = p2m_top_index(pfn); mididx = p2m_mid_index(pfn); @@ -284,7 +284,7 @@ void xen_setup_mfn_list_list(void) else HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = virt_to_mfn(p2m_top_mfn); - HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn; + HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_pfn_limit; HYPERVISOR_shared_info->arch.p2m_generation = 0; HYPERVISOR_shared_info->arch.p2m_vaddr = (unsigned long)xen_p2m_addr; HYPERVISOR_shared_info->arch.p2m_cr3 = @@ -302,7 +302,7 @@ void __init xen_build_dynamic_phys_to_machine(void) for (pfn = xen_start_info->nr_pages; pfn < xen_p2m_size; pfn++) xen_p2m_addr[pfn] = INVALID_P2M_ENTRY; - xen_max_p2m_pfn = xen_p2m_size; + xen_p2m_max_size = xen_p2m_size; } #define P2M_TYPE_IDENTITY 0 @@ -353,7 +353,7 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m) pfn_pte(PFN_DOWN(__pa(p2m_identity)), PAGE_KERNEL_RO)); } - for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += chunk) { + for (pfn = 0; pfn < xen_p2m_max_size; pfn += chunk) { /* * Try to map missing/identity PMDs or p2m-pages if possible. * We have to respect the structure of the mfn_list_list @@ -413,21 +413,22 @@ void __init xen_vmalloc_p2m_tree(void) static struct vm_struct vm; unsigned long p2m_limit; - xen_p2m_last_pfn = xen_max_p2m_pfn; + xen_p2m_pfn_limit = xen_p2m_max_size; p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE; vm.flags = VM_ALLOC; - vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit), + vm.size = ALIGN(sizeof(unsigned long) * + max(xen_p2m_max_size, p2m_limit), PMD_SIZE * PMDS_PER_MID_PAGE); vm_area_register_early(&vm, PMD_SIZE * PMDS_PER_MID_PAGE); pr_notice("p2m virtual area at %p, size is %lx\n", vm.addr, vm.size); - xen_max_p2m_pfn = vm.size / sizeof(unsigned long); + xen_p2m_max_size = vm.size / sizeof(unsigned long); xen_rebuild_p2m_list(vm.addr); xen_p2m_addr = vm.addr; - xen_p2m_size = xen_max_p2m_pfn; + xen_p2m_size = xen_p2m_max_size; xen_inv_extra_mem(); } @@ -438,7 +439,7 @@ unsigned long get_phys_to_machine(unsigned long pfn) unsigned int level; if (unlikely(pfn >= xen_p2m_size)) { - if (pfn < xen_max_p2m_pfn) + if (pfn < xen_p2m_max_size) return xen_chk_extra_mem(pfn); return IDENTITY_FRAME(pfn); @@ -618,9 +619,9 @@ int xen_alloc_p2m_entry(unsigned long pfn) } /* Expanded the p2m? */ - if (pfn >= xen_p2m_last_pfn) { - xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE); - HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn; + if (pfn >= xen_p2m_pfn_limit) { + xen_p2m_pfn_limit = ALIGN(pfn + 1, P2M_PER_PAGE); + HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_pfn_limit; } return 0; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 8bfc10330107..1caddd3fa0e1 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -816,7 +816,7 @@ char * __init xen_memory_setup(void) n_pfns = PFN_DOWN(addr + chunk_size) - pfn_s; extra_pages -= n_pfns; xen_add_extra_mem(pfn_s, n_pfns); - xen_max_p2m_pfn = pfn_s + n_pfns; + xen_p2m_max_size = pfn_s + n_pfns; } else discard = true; } -- 2.26.2