From patchwork Thu Sep 30 01:30:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12527083 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 A6187C433F5 for ; Thu, 30 Sep 2021 01:32:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 732D6613D3 for ; Thu, 30 Sep 2021 01:32:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 732D6613D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=48zBSRk2vmK5hP6ww80Y9sY/CXZAbbAV/00llbhYXj4=; b=V4nmVbTQE4NkY0 MZHhUVbrk70CD236JG7JhEGeaRmZd8+m/HbI+KnaLrYP0xnVbMdcZ+fU8fjjNyTvfSSWUOkLdDTwQ zEKAxt8KJgM6kj1XVcj41SHX3fB3asVKNepzbnZMAHLwtVZNgTIW0AOf0RJBV/LGPmBOJhKYBVmja S63Kv7/Vh9RbjQmerkWUy/qvER1cA1WXNtdd16Hur5N2ZRK9giE1ZgrLLZnitIsJQvWjWzSnYw1Sh 06jPS432DHEpRu50TFI21B8FhlSQ2SPtFv/D5+H/cfec24nth55M706TpKS16AF5Iqrn0gW/KDV/9 47wLDJKd0YpbbB/3pABA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVkuj-00CiHs-Le; Thu, 30 Sep 2021 01:31:09 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVkuT-00CiGG-Sz for linux-arm-kernel@lists.infradead.org; Thu, 30 Sep 2021 01:30:55 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_183054_010570_23C5DD50 X-CRM114-Status: GOOD ( 17.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);