Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3639799ioa; Tue, 26 Apr 2022 07:22:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+yDKsdg0D/+fQj2lwS79NAtUj0p6DRA/c0sEswes+hYT+7bMYoX62qH32M2dsBxYAK6s0 X-Received: by 2002:aa7:c6c3:0:b0:425:b13b:94f with SMTP id b3-20020aa7c6c3000000b00425b13b094fmr24827654eds.313.1650982921488; Tue, 26 Apr 2022 07:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650982921; cv=none; d=google.com; s=arc-20160816; b=LbCSktwcigVeQl50u70EGrtjqFnh2Duk9SAO7MLSCVeJ7Zhy6/rHsM5kCLGmb81GIS ZF/0ZsVELoobhu5v8HSF4TWbzZXls8jNesYXJKN/vt+WPgAdjPVMm3qn+FA0Ty0rqEvm it9PYrUEhFm6GeSBIoB5z6lS3FwanTraaeSTiczG//ECQVPCBGWP4JUNCmYc2pFTg0Wd vDTKykbqbitdm1oEQd1uOYs4MAjGv7srqDKslqeRIoFDzDMfeH2QQ+FWzGXrLuNwJ1er GHkFvJNHAWpmLaZ0i8WQS/R9C5eOt2kFZyKQSIDGFqXrMLJCiA8hK31sgmOc3OtsSHyn ibOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UFRKsFqQFio4Ek/6ILON3LTWf8paiBhKJoENlDKs+6M=; b=bdJ1jnk7+a3duDJai+dooM3M+nT9lFmIad3Tmp+5lIZ2+atWQ87hO+Q2mS60MRc3B0 q59njC2oVJFoeJdmLeu//t87xbpp5Evg8OXVBZrM0ohBSMKCYon4xJkjXNpg+LN3Y0dw 5OSQr6XA3yEYt7jWaYpIdA9p9LMAtgNMDsTWDwppoCk0Mn9nCV8G0t+UO5VtUnHOP0kZ np6u2QIjxWOSV5IgxURkP9fQdflpkq/wp/Q+dDKEljLecDEQwQoSHBuMqLjsZ1N5SSTw h2DWiB6oAoMlk5n2HNBFSfT/9uS5v64yppmSQ9mXPtsIg/7F7C1JTUwL9XzBJZV2b55W 6VyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LoK6F9Mu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a1709061b4500b006e858da746esi4388441ejg.231.2022.04.26.07.21.32; Tue, 26 Apr 2022 07:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LoK6F9Mu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346026AbiDZJR7 (ORCPT + 99 others); Tue, 26 Apr 2022 05:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345859AbiDZItA (ORCPT ); Tue, 26 Apr 2022 04:49:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0540B8985; Tue, 26 Apr 2022 01:37:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9217FCE1BBB; Tue, 26 Apr 2022 08:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44945C385A4; Tue, 26 Apr 2022 08:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962266; bh=gJJX+P5oVPPmJ/jF+tf+hPzMZO+E1W428uqYIfRDOsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LoK6F9MuYMGvEpwb1pgn3mqJLW3BrMRg9oKA2SAZjiysSrI7qMM1CbnLF4hTY8Cmd aDrWVlgz9U3cLDP7K87+H6VHHjNzrDlxdh0r8BI1Yt9mF6RwjvISC0dMcBW3kGgwa5 GK29Lv/Q0cKtjtHfhRy/480cCu7mG3HC8yinKtN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anshuman Khandual , David Hildenbrand , Mike Rapoport , Catalin Marinas , Will Deacon , Mike Rapoport , Andrew Morton , Linus Torvalds , Georgi Djakov Subject: [PATCH 5.15 007/124] arm64/mm: drop HAVE_ARCH_PFN_VALID Date: Tue, 26 Apr 2022 10:20:08 +0200 Message-Id: <20220426081747.503282169@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anshuman Khandual commit 3de360c3fdb34fbdbaf6da3af94367d3fded95d3 upstream. 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 Link: https://lore.kernel.org/r/20210930013039.11260-3-rppt@kernel.org Signed-off-by: Will Deacon Fixes: 859a85ddf90e ("mm: remove pfn_valid_within() and CONFIG_HOLES_IN_ZONE") Link: https://lore.kernel.org/r/Yl0IZWT2nsiYtqBT@linux.ibm.com Signed-off-by: Georgi Djakov Signed-off-by: Greg Kroah-Hartman --- arch/arm64/Kconfig | 1 - arch/arm64/include/asm/page.h | 1 - arch/arm64/mm/init.c | 37 ------------------------------------- 3 files changed, 39 deletions(-) --- 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 --- 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 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -184,43 +184,6 @@ static void __init zone_sizes_init(unsig 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);