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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DA3FC433F5 for ; Thu, 30 Sep 2021 01:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22352615A4 for ; Thu, 30 Sep 2021 01:30:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347528AbhI3Bcg (ORCPT ); Wed, 29 Sep 2021 21:32:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:58472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347479AbhI3Bcf (ORCPT ); Wed, 29 Sep 2021 21:32:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21223617E1; Thu, 30 Sep 2021 01:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632965453; bh=ceqtqe3tP8kT4fg537bLiHXDr0BuBFKtfv/SdnOFWF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Po73306dW6G81QDX5q/qliETh5BHru1OilAP6EVgDEwr1x0WTKdIjoQ/a5ZIbrC5W JMWlojaoOycA2omq3R4Tea6hhMQLhRpeDpLDIVO1Q8C8F3k3en6jFiGy1mT1v1qCMw TdYj7obzUvSVlibusHtBGcA3EqDuIEdj0G96JVDTEb6jtcDoxqMyiFFS1irl9n4nE+ oN25IBa6cMVNQsmqdEsYwgtkJjx43TQFYOXGkzr7dhAfjIN5zTwXpm7nttashO28yF 54Bdy1/HqjaFF89qYAjZX2qRdC8ZO28REvYFwbWApFTEGJI2sO1K8TccHUsFinF9sM Sn1Sk5r6Z04tw== From: Mike Rapoport To: linux-arm-kernel@lists.infradead.org Cc: Alex Bee , Andrew Morton , Anshuman Khandual , Catalin Marinas , Christoph Hellwig , David Hildenbrand , Linux Kernel Mailing List , Marek Szyprowski , Mike Rapoport , Mike Rapoport , Robin Murphy , Will Deacon , iommu@lists.linux-foundation.org Subject: [PATCH 2/2] arm64/mm: drop HAVE_ARCH_PFN_VALID Date: Thu, 30 Sep 2021 04:30:39 +0300 Message-Id: <20210930013039.11260-3-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210930013039.11260-1-rppt@kernel.org> References: <20210930013039.11260-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anshuman Khandual CONFIG_SPARSEMEM_VMEMMAP is now the only available memory model on arm64 platforms and free_unused_memmap() would just return without creating any holes in the memmap mapping. There is no need for any special handling in pfn_valid() and HAVE_ARCH_PFN_VALID can just be dropped. This also moves the pfn upper bits sanity check into generic pfn_valid(). [rppt: rebased on v5.15-rc3] Link: https://lkml.kernel.org/r/1621947349-25421-1-git-send-email-anshuman.khandual@arm.com Signed-off-by: Anshuman Khandual Acked-by: David Hildenbrand Acked-by: Mike Rapoport Cc: Catalin Marinas Cc: Will Deacon Cc: David Hildenbrand Cc: Mike Rapoport Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Mike Rapoport --- arch/arm64/Kconfig | 1 - arch/arm64/include/asm/page.h | 1 - arch/arm64/mm/init.c | 37 ----------------------------------- 3 files changed, 39 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5c7ae4c3954b..53dd23f305be 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -154,7 +154,6 @@ config ARM64 select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT - select HAVE_ARCH_PFN_VALID select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h index f98c91bbd7c1..993a27ea6f54 100644 --- a/arch/arm64/include/asm/page.h +++ b/arch/arm64/include/asm/page.h @@ -41,7 +41,6 @@ void tag_clear_highpage(struct page *to); typedef struct page *pgtable_t; -int pfn_valid(unsigned long pfn); int pfn_is_map_memory(unsigned long pfn); #include diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 37a81754d9b6..e60c6eb813b7 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -160,43 +160,6 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) free_area_init(max_zone_pfns); } -int pfn_valid(unsigned long pfn) -{ - phys_addr_t addr = PFN_PHYS(pfn); - struct mem_section *ms; - - /* - * Ensure the upper PAGE_SHIFT bits are clear in the - * pfn. Else it might lead to false positives when - * some of the upper bits are set, but the lower bits - * match a valid pfn. - */ - if (PHYS_PFN(addr) != pfn) - return 0; - - if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) - return 0; - - ms = __pfn_to_section(pfn); - if (!valid_section(ms)) - return 0; - - /* - * ZONE_DEVICE memory does not have the memblock entries. - * memblock_is_map_memory() check for ZONE_DEVICE based - * addresses will always fail. Even the normal hotplugged - * memory will never have MEMBLOCK_NOMAP flag set in their - * memblock entries. Skip memblock search for all non early - * memory sections covering all of hotplug memory including - * both normal and ZONE_DEVICE based. - */ - if (!early_section(ms)) - return pfn_section_valid(ms, pfn); - - return memblock_is_memory(addr); -} -EXPORT_SYMBOL(pfn_valid); - int pfn_is_map_memory(unsigned long pfn) { phys_addr_t addr = PFN_PHYS(pfn); -- 2.28.0