Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2734522pxv; Sun, 27 Jun 2021 07:13:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbsFLtpGR5URngyaGV/9wHAuADm4hUiixdVL8abryImasxSX+A2ZXK0wecoQYFNcVzkEXW X-Received: by 2002:a17:906:c83b:: with SMTP id dd27mr20218760ejb.547.1624803189650; Sun, 27 Jun 2021 07:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624803189; cv=none; d=google.com; s=arc-20160816; b=0fwFR1lygOOyvcPiYBjaHswBLH4bGVHqzJdkgZy9+vAPqEppYGWNQMZmUGbRrsWW77 37S6Vgv0BCDKSGlNF13cpKZi1FyBzLhRsjw7EiAKkHcVybVAj6pXbiGacfEzlm8WQd54 uWwneE5+fYxuJBk+c2cszy8VQb3t8WVoEew2j1i/ZlKHr+NTVqHzGmU7rMayl9TsGE0O SKNYhLeBbOeKNuiLFG58cdfSXCfQL6mqrp929wURLd4T3R82rZTaF+TwrDQq1yXwnsSV 3EOeabkrHLTbFqrZ47Cwm8qxyW7wu7LdC7FU6PFkhkXe5eNen+H4AuNZMk+0czWGyyrR eQAA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=bTjmvU8yn2/k0kOaZkGNIygSTdPKkN7MOcxmayDA4lI=; b=e8nS4fuxcs+fldSHD3A7bQ4XhBrouqFdkHvDc2xs4vZBRkNWjYvDIAg23wFU8rnMhb Oi1xsKzgLWJoF5YM4AJkOcmMiOvTyhD08O45Pd58e1qRVhOOsp2yboSBa1Y5L1hII0UJ mZm5P5JW1jDYBD9txd+820mKaE1+Uu19t+nSHeLIW6r6Dz0jk77jEZFOvHFfIgyxn0rV 1OCZrE5mlOw83mWWPUXIIj+OQpfBJgW4wiQV09Zkge+7SNV11ZDKDkppFvyD/2dElvcu V7KGjlyoV8sUucgqYsr3IpnUGMZEtwcrSDa7fJEvAhqBKv11TtUFst85EGUIiPWLCXMF 3foQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OdGpBXHt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay17si13436901ejb.438.2021.06.27.07.12.45; Sun, 27 Jun 2021 07:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OdGpBXHt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbhF0Nxx (ORCPT + 99 others); Sun, 27 Jun 2021 09:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbhF0Nxw (ORCPT ); Sun, 27 Jun 2021 09:53:52 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8EEC061574; Sun, 27 Jun 2021 06:51:27 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id kt19so423642pjb.2; Sun, 27 Jun 2021 06:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bTjmvU8yn2/k0kOaZkGNIygSTdPKkN7MOcxmayDA4lI=; b=OdGpBXHtWVue7u4/yCfRuucDLA2lcAkTkuHNxW38YjfxpCkbjgrsqMQvzAVvwzpbje NUAq5k3FZpGXY8LygkpAhG32cyPFaxj2z6HNiEjy8p1BNCvZhjSebCmuvnOvQwlGSxQu 9Ub9gbmhiEFgsUYrNYChAT56HHUNvoeRw0kQJbLgE8wJKawlVYuY5U1p+dRNyYpIhJ9O FhDSmb9rQzHFG0svVN09s6BtJvfhn2MBda8/DIPGiy0pVsuvrWsu2AmFBHBvg1bjwgWo QIsi/O9P+d5PAkU/paZmZiuSXHhJk9qyKqNdJV2lt04OndwQpmNTgUkJmYvzH/JDvLrM CR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bTjmvU8yn2/k0kOaZkGNIygSTdPKkN7MOcxmayDA4lI=; b=exZLffKMhzFMNVP0gFOTvdd+C/qc2Q72tutgiOTQv0d8MI717i4Yu5IVG74Nq7+yLd pNq6WdoOkpU7utHOv/aK/JMaX3bY0zkzoXBdwdsrvdp7ut2/oKYYA8teSnHnrJD8wI+x riurOKNvdwD3I2dtO9d6ChROOfH0RRWU+cyxQC8H1h5Rn2GppkdCqSCHrP1r1knXZiR/ IcPi1pjfFE0fNEcf1p0BNS4F4TAy1qu1cOgAeTdDx9bp5GP83x654OY4AP+b+xBnO1XL uIOnsuWJwtdjhY8UUrYlqODgH8/6OCzr4r2iwQpz0dvHWgBmt6fyLgAOgPMBvgGNJNy3 oHHA== X-Gm-Message-State: AOAM532F+Y/AajCVFgXuYm/PRRv51ez2H3tyen4YG+ZgmiDCJl8Z3TqR 2LE3HgBU98eZzP+oyBRzf4I= X-Received: by 2002:a17:90a:b390:: with SMTP id e16mr22444595pjr.197.1624801887319; Sun, 27 Jun 2021 06:51:27 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id c5sm10870034pfv.47.2021.06.27.06.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 06:51:26 -0700 (PDT) From: Bin Meng To: Palmer Dabbelt , Atish Patra , Kefeng Wang , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: stable@vger.kernel.org, Bin Meng Subject: [PATCH] riscv: Fix 32-bit RISC-V boot failure Date: Sun, 27 Jun 2021 21:51:17 +0800 Message-Id: <20210627135117.28641-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit dd2d082b5760 ("riscv: Cleanup setup_bootmem()") adjusted the calling sequence in setup_bootmem(), which invalidates the fix commit de043da0b9e7 ("RISC-V: Fix usage of memblock_enforce_memory_limit") did for 32-bit RISC-V unfortunately. So now 32-bit RISC-V does not boot again when testing booting kernel on QEMU 'virt' with '-m 2G', which was exactly what the original commit de043da0b9e7 ("RISC-V: Fix usage of memblock_enforce_memory_limit") tried to fix. Fixes: dd2d082b5760 ("riscv: Cleanup setup_bootmem()") Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: Bin Meng --- arch/riscv/mm/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 4c4c92ce0bb8..9b23b95c50cf 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -123,7 +123,7 @@ void __init setup_bootmem(void) { phys_addr_t vmlinux_end = __pa_symbol(&_end); phys_addr_t vmlinux_start = __pa_symbol(&_start); - phys_addr_t dram_end = memblock_end_of_DRAM(); + phys_addr_t dram_end; phys_addr_t max_mapped_addr = __pa(~(ulong)0); #ifdef CONFIG_XIP_KERNEL @@ -146,6 +146,8 @@ void __init setup_bootmem(void) #endif memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); + dram_end = memblock_end_of_DRAM(); + /* * memblock allocator is not aware of the fact that last 4K bytes of * the addressable memory can not be mapped because of IS_ERR_VALUE -- 2.25.1