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=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 7F749C433DF for ; Mon, 3 Aug 2020 12:47:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E866206D4 for ; Mon, 3 Aug 2020 12:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596458839; bh=8D/eoLQw6uioyrUa4daZgPAbYbH2SwbAgOK/2ZUhXjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AjSt88YfzIq6sGdlX//ggyTforgxfXqr2qi2jj+G3KynPLMb56AxRc443ZQ2EuOxc TwibDNzw2lG84omANwnNxwU8ts0cq2oxrxR8QZt2eOX5frtJNEu4XxD1S9tIHAdnvK 4qo/5+KgwLwxwQyyk7lplFApvy/iGpl0HCB0jIJc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727777AbgHCMrL (ORCPT ); Mon, 3 Aug 2020 08:47:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:51254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726300AbgHCM0I (ORCPT ); Mon, 3 Aug 2020 08:26:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA654207FC; Mon, 3 Aug 2020 12:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457567; bh=8D/eoLQw6uioyrUa4daZgPAbYbH2SwbAgOK/2ZUhXjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fg9PFtPNYgPEztmkKcVwiVZWNiUJ2NiMw8x4F4vWv/4ASC2NxxAU3vtXGnA9FI6VA Qvtcjqt+Zdl3Xux2nBrc1lU2A7YVDehPdL5Pt4zM8wNl2qoGfvgj/4qx4XEF3HLfjH NhUxrBv0TjPeOG7EoCdrkb6hOR6nuTQKOfvSvESA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.7 114/120] RISC-V: Set maximum number of mapped pages correctly Date: Mon, 3 Aug 2020 14:19:32 +0200 Message-Id: <20200803121908.454518155@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121902.860751811@linuxfoundation.org> References: <20200803121902.860751811@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Atish Patra [ Upstream commit d0d8aae64566b753c4330fbd5944b88af035f299 ] Currently, maximum number of mapper pages are set to the pfn calculated from the memblock size of the memblock containing kernel. This will work until that memblock spans the entire memory. However, it will be set to a wrong value if there are multiple memblocks defined in kernel (e.g. with efi runtime services). Set the the maximum value to the pfn calculated from dram size. Signed-off-by: Atish Patra Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 81493cee0a167..af8926777567f 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -170,9 +170,9 @@ void __init setup_bootmem(void) /* Reserve from the start of the kernel to the end of the kernel */ memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); - set_max_mapnr(PFN_DOWN(mem_size)); max_pfn = PFN_DOWN(memblock_end_of_DRAM()); max_low_pfn = max_pfn; + set_max_mapnr(max_low_pfn); #ifdef CONFIG_BLK_DEV_INITRD setup_initrd(); -- 2.25.1