Message ID | 20221107151524.3941467-1-conor.dooley@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2125600wru; Mon, 7 Nov 2022 07:37:29 -0800 (PST) X-Google-Smtp-Source: AMsMyM6cRvIpbvQz5nXjmXVKtsjI8fKJ5ZZoVq6fmb/z/yP3gLnoL3dTcdnCgL7NKuLG7ZxTkh8K X-Received: by 2002:a17:907:a087:b0:7ae:45f2:bf2d with SMTP id hu7-20020a170907a08700b007ae45f2bf2dmr13090127ejc.456.1667835448933; Mon, 07 Nov 2022 07:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667835448; cv=none; d=google.com; s=arc-20160816; b=RlpVGKiRIGequkoWI9Wo8AbYku6Q63h2fZBCKviz31Evlz5uTxYlO7gpwjZ6kcRqnT u0WgDDHTFnGT2n1oOVzWYVI/8bSRkKBPWAAMtqvmAgDGvh55t5UjxBOoJHFkUs5k+mbR LeJ+XWS71noENMFL2qmPNGUONvAENrLj5NYA+hEoSCshkTXBS3I0Om1D/6Xx2sUS04B1 G06sHjaWMDtE9YzmNyr+oXp3u6me8cvFUXcPiivpPmB0sPv5c4gOCC4jlCpIYrwd/aIM 6B4ye3JuQ2uDD+rOd96x2knMjqVoT3QGYCHfYqcQJftvthv7zR34swimOMON8FKzRc2A tsUA== 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=lWgoJoOnlYL3kDkNzJuQ46aKYBxuQVzB3R+aYzMjy2M=; b=UXoXrow5J9PSpoTyJE+TpAPTznxzTsakjMKFy5OKPVy//UmGUGkW/KqKyLyfAGFm5k 80GgbjD/jhr7mjXlSPofM8mGq8LVutg4Id3Ipjpv0QXC84mymcsuwp5+u4W7PotUCYKd VvN035d3+iz+qBOaUnSzSTZhi115IXzebwZbU9K4EU04r37ZHitPQU0Ia/Mzsuw83lM7 jurc1C+kHuX+x1yy9VW/c5zw8HjF7IPkK4tz9EYzNxnRGKvL7vJvIDffOY0FmPmhuQMC LOOrp0Mbx8H/dSJVSh0CBFmnxTQlWSbw1VAuo7E0P4JH+O7wy9C2CRQqMg/58yiQKzF5 lZAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=lBB4Tz5u; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a056402524c00b00459fc3fcf3csi11539862edd.102.2022.11.07.07.37.01; Mon, 07 Nov 2022 07:37:28 -0800 (PST) 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=@microchip.com header.s=mchp header.b=lBB4Tz5u; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232827AbiKGPQN (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 10:16:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbiKGPQK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 10:16:10 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25AE1EAF8 for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 07:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667834166; x=1699370166; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Hua8FnSNgyK0XNfauia0YSWtJJuQvu8Oq20DaFtM3II=; b=lBB4Tz5un807k34fQ9KYque8Lrg4iJNgI5jwS5QJz0M0XxLQGxoY/i2I 69jMd7TnGnd1NrY9RlG8Rj2pBzc5CikTMQ7PhHwBNvG7ISb8M2Qa5i1cP 7yiFA5kpxOnH8j4QwcLQi3gSUnPiTM5BkRZYuCze5IytiqKzwUO47CJE8 MXQHhH6aN9aV+Y2GyYNahXE5ZfYWTPBNBayCy/pYVSCDYlpACiRHHlJX+ 4V1l9THS68xDGTWXabELfu2Hwpinkx3Aa9zS9R/gTmBdrO+DfhRkAoheQ W9aHG47sQtS5yAnYG6/8WUQ0VgwuoQART0x38XHRe1Q/mBrfYZKlcg4W3 w==; X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="198734479" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Nov 2022 08:16:06 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 7 Nov 2022 08:16:05 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 7 Nov 2022 08:16:03 -0700 From: Conor Dooley <conor.dooley@microchip.com> To: Palmer Dabbelt <palmer@dabbelt.com> CC: Paul Walmsley <paul.walmsley@sifive.com>, Albert Ou <aou@eecs.berkeley.edu>, Conor Dooley <conor.dooley@microchip.com>, "Daire McNamara" <daire.mcnamara@microchip.com>, Anup Patel <anup@brainfault.org>, Atish Patra <atishp@rivosinc.com>, Nick Kossifidis <mick@ics.forth.gr>, <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>, "Valentina Fernandez" <valentina.fernandezalanis@microchip.com>, Evgenii Shatokhin <e.shatokhin@yadro.com> Subject: [PATCH v1] riscv: fix reserved memory setup Date: Mon, 7 Nov 2022 15:15:25 +0000 Message-ID: <20221107151524.3941467-1-conor.dooley@microchip.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748852224084248263?= X-GMAIL-MSGID: =?utf-8?q?1748852224084248263?= |
Series |
[v1] riscv: fix reserved memory setup
|
|
Commit Message
Conor Dooley
Nov. 7, 2022, 3:15 p.m. UTC
Currently, RISC-V sets up reserved memory using the "early" copy of the
device tree. As a result, when trying to get a reserved memory region
using of_reserved_mem_lookup(), the pointer to reserved memory regions
is using the early, pre-virtual-memory address which causes a kernel
panic when trying to use the buffer's name:
Unable to handle kernel paging request at virtual address 00000000401c31ac
Oops [#1]
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 6.0.0-rc1-00001-g0d9d6953d834 #1
Hardware name: Microchip PolarFire-SoC Icicle Kit (DT)
epc : string+0x4a/0xea
ra : vsnprintf+0x1e4/0x336
epc : ffffffff80335ea0 ra : ffffffff80338936 sp : ffffffff81203be0
gp : ffffffff812e0a98 tp : ffffffff8120de40 t0 : 0000000000000000
t1 : ffffffff81203e28 t2 : 7265736572203a46 s0 : ffffffff81203c20
s1 : ffffffff81203e28 a0 : ffffffff81203d22 a1 : 0000000000000000
a2 : ffffffff81203d08 a3 : 0000000081203d21 a4 : ffffffffffffffff
a5 : 00000000401c31ac a6 : ffff0a00ffffff04 a7 : ffffffffffffffff
s2 : ffffffff81203d08 s3 : ffffffff81203d00 s4 : 0000000000000008
s5 : ffffffff000000ff s6 : 0000000000ffffff s7 : 00000000ffffff00
s8 : ffffffff80d9821a s9 : ffffffff81203d22 s10: 0000000000000002
s11: ffffffff80d9821c t3 : ffffffff812f3617 t4 : ffffffff812f3617
t5 : ffffffff812f3618 t6 : ffffffff81203d08
status: 0000000200000100 badaddr: 00000000401c31ac cause: 000000000000000d
[<ffffffff80338936>] vsnprintf+0x1e4/0x336
[<ffffffff80055ae2>] vprintk_store+0xf6/0x344
[<ffffffff80055d86>] vprintk_emit+0x56/0x192
[<ffffffff80055ed8>] vprintk_default+0x16/0x1e
[<ffffffff800563d2>] vprintk+0x72/0x80
[<ffffffff806813b2>] _printk+0x36/0x50
[<ffffffff8068af48>] print_reserved_mem+0x1c/0x24
[<ffffffff808057ec>] paging_init+0x528/0x5bc
[<ffffffff808031ae>] setup_arch+0xd0/0x592
[<ffffffff8080070e>] start_kernel+0x82/0x73c
early_init_fdt_scan_reserved_mem() takes no arguments as it operates on
initial_boot_params, which is populated by early_init_dt_verify(). On
RISC-V, early_init_dt_verify() is called twice. Once, directly, in
setup_arch() if CONFIG_BUILTIN_DTB is not enabled and once indirectly,
very early in the boot process, by parse_dtb() when it calls
early_init_dt_scan_nodes().
This first call uses dtb_early_va to set initial_boot_params, which is
not usable later in the boot process when
early_init_fdt_scan_reserved_mem() is called. On arm64 for example, the
corresponding call to early_init_dt_scan_nodes() uses fixmap addresses
and doesn't suffer the same fate.
Move early_init_fdt_scan_reserved_mem() further along the boot sequence,
after the direct call to early_init_dt_verify() in setup_arch() so that
the names use the correct virtual memory addresses. The above supposed
that CONFIG_BUILTIN_DTB was not set, but should work equally in the case
where it is - unflatted_and_copy_device_tree() also updates
initial_boot_params.
Reported-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com>
Reported-by: Evgenii Shatokhin <e.shatokhin@yadro.com>
Link: https://lore.kernel.org/linux-riscv/f8e67f82-103d-156c-deb0-d6d6e2756f5e@microchip.com/
Fixes: 922b0375fc93 ("riscv: Fix memblock reservation for device tree blob")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
arch/riscv/kernel/setup.c | 1 +
arch/riscv/mm/init.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
Comments
Hi, On 07.11.2022 18:15, Conor Dooley wrote: > «Внимание! Данное письмо от внешнего адресата!» > > Currently, RISC-V sets up reserved memory using the "early" copy of the > device tree. As a result, when trying to get a reserved memory region > using of_reserved_mem_lookup(), the pointer to reserved memory regions > is using the early, pre-virtual-memory address which causes a kernel > panic when trying to use the buffer's name: > > Unable to handle kernel paging request at virtual address 00000000401c31ac > Oops [#1] > Modules linked in: > CPU: 0 PID: 0 Comm: swapper Not tainted 6.0.0-rc1-00001-g0d9d6953d834 #1 > Hardware name: Microchip PolarFire-SoC Icicle Kit (DT) > epc : string+0x4a/0xea > ra : vsnprintf+0x1e4/0x336 > epc : ffffffff80335ea0 ra : ffffffff80338936 sp : ffffffff81203be0 > gp : ffffffff812e0a98 tp : ffffffff8120de40 t0 : 0000000000000000 > t1 : ffffffff81203e28 t2 : 7265736572203a46 s0 : ffffffff81203c20 > s1 : ffffffff81203e28 a0 : ffffffff81203d22 a1 : 0000000000000000 > a2 : ffffffff81203d08 a3 : 0000000081203d21 a4 : ffffffffffffffff > a5 : 00000000401c31ac a6 : ffff0a00ffffff04 a7 : ffffffffffffffff > s2 : ffffffff81203d08 s3 : ffffffff81203d00 s4 : 0000000000000008 > s5 : ffffffff000000ff s6 : 0000000000ffffff s7 : 00000000ffffff00 > s8 : ffffffff80d9821a s9 : ffffffff81203d22 s10: 0000000000000002 > s11: ffffffff80d9821c t3 : ffffffff812f3617 t4 : ffffffff812f3617 > t5 : ffffffff812f3618 t6 : ffffffff81203d08 > status: 0000000200000100 badaddr: 00000000401c31ac cause: 000000000000000d > [<ffffffff80338936>] vsnprintf+0x1e4/0x336 > [<ffffffff80055ae2>] vprintk_store+0xf6/0x344 > [<ffffffff80055d86>] vprintk_emit+0x56/0x192 > [<ffffffff80055ed8>] vprintk_default+0x16/0x1e > [<ffffffff800563d2>] vprintk+0x72/0x80 > [<ffffffff806813b2>] _printk+0x36/0x50 > [<ffffffff8068af48>] print_reserved_mem+0x1c/0x24 > [<ffffffff808057ec>] paging_init+0x528/0x5bc > [<ffffffff808031ae>] setup_arch+0xd0/0x592 > [<ffffffff8080070e>] start_kernel+0x82/0x73c > > early_init_fdt_scan_reserved_mem() takes no arguments as it operates on > initial_boot_params, which is populated by early_init_dt_verify(). On > RISC-V, early_init_dt_verify() is called twice. Once, directly, in > setup_arch() if CONFIG_BUILTIN_DTB is not enabled and once indirectly, > very early in the boot process, by parse_dtb() when it calls > early_init_dt_scan_nodes(). > > This first call uses dtb_early_va to set initial_boot_params, which is > not usable later in the boot process when > early_init_fdt_scan_reserved_mem() is called. On arm64 for example, the > corresponding call to early_init_dt_scan_nodes() uses fixmap addresses > and doesn't suffer the same fate. Thank you for looking into this! As I wrote earlier, I ran into this issue too, while working on a remoteproc driver for our RISC-V-based SoC. The proposed patch fixes the bug for me and seems to have no problematic side-effects. So: Tested-by: Evgenii Shatokhin <e.shatokhin@yadro.com> > > Move early_init_fdt_scan_reserved_mem() further along the boot sequence, > after the direct call to early_init_dt_verify() in setup_arch() so that > the names use the correct virtual memory addresses. The above supposed > that CONFIG_BUILTIN_DTB was not set, but should work equally in the case > where it is - unflatted_and_copy_device_tree() also updates > initial_boot_params. > > Reported-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com> > Reported-by: Evgenii Shatokhin <e.shatokhin@yadro.com> > Link: https://lore.kernel.org/linux-riscv/f8e67f82-103d-156c-deb0-d6d6e2756f5e@microchip.com/ > Fixes: 922b0375fc93 ("riscv: Fix memblock reservation for device tree blob") > Signed-off-by: Conor Dooley <conor.dooley@microchip.com> > --- > arch/riscv/kernel/setup.c | 1 + > arch/riscv/mm/init.c | 1 - > 2 files changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c > index ad76bb59b059..67ec1fadcfe2 100644 > --- a/arch/riscv/kernel/setup.c > +++ b/arch/riscv/kernel/setup.c > @@ -283,6 +283,7 @@ void __init setup_arch(char **cmdline_p) > else > pr_err("No DTB found in kernel mappings\n"); > #endif > + early_init_fdt_scan_reserved_mem(); > misc_mem_init(); > > init_resources(); > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index b56a0a75533f..50a1b6edd491 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -262,7 +262,6 @@ static void __init setup_bootmem(void) > memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); > } > > - early_init_fdt_scan_reserved_mem(); > dma_contiguous_reserve(dma32_phys_limit); > if (IS_ENABLED(CONFIG_64BIT)) > hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); > -- > 2.38.0 >
On Tue, Nov 08, 2022 at 12:40:19AM +0300, Evgenii Shatokhin wrote: > Hi, > Thank you for looking into this! > > As I wrote earlier, I ran into this issue too, while working on a remoteproc > driver for our RISC-V-based SoC. > > The proposed patch fixes the bug for me and seems to have no problematic > side-effects. So: > > Tested-by: Evgenii Shatokhin <e.shatokhin@yadro.com> Apologies for forgetting to add the T-b tag & thanks for re-sending it. Conor.
On Mon, 7 Nov 2022 15:15:25 +0000, Conor Dooley wrote: > Currently, RISC-V sets up reserved memory using the "early" copy of the > device tree. As a result, when trying to get a reserved memory region > using of_reserved_mem_lookup(), the pointer to reserved memory regions > is using the early, pre-virtual-memory address which causes a kernel > panic when trying to use the buffer's name: > > Unable to handle kernel paging request at virtual address 00000000401c31ac > Oops [#1] > Modules linked in: > CPU: 0 PID: 0 Comm: swapper Not tainted 6.0.0-rc1-00001-g0d9d6953d834 #1 > Hardware name: Microchip PolarFire-SoC Icicle Kit (DT) > epc : string+0x4a/0xea > ra : vsnprintf+0x1e4/0x336 > epc : ffffffff80335ea0 ra : ffffffff80338936 sp : ffffffff81203be0 > gp : ffffffff812e0a98 tp : ffffffff8120de40 t0 : 0000000000000000 > t1 : ffffffff81203e28 t2 : 7265736572203a46 s0 : ffffffff81203c20 > s1 : ffffffff81203e28 a0 : ffffffff81203d22 a1 : 0000000000000000 > a2 : ffffffff81203d08 a3 : 0000000081203d21 a4 : ffffffffffffffff > a5 : 00000000401c31ac a6 : ffff0a00ffffff04 a7 : ffffffffffffffff > s2 : ffffffff81203d08 s3 : ffffffff81203d00 s4 : 0000000000000008 > s5 : ffffffff000000ff s6 : 0000000000ffffff s7 : 00000000ffffff00 > s8 : ffffffff80d9821a s9 : ffffffff81203d22 s10: 0000000000000002 > s11: ffffffff80d9821c t3 : ffffffff812f3617 t4 : ffffffff812f3617 > t5 : ffffffff812f3618 t6 : ffffffff81203d08 > status: 0000000200000100 badaddr: 00000000401c31ac cause: 000000000000000d > [<ffffffff80338936>] vsnprintf+0x1e4/0x336 > [<ffffffff80055ae2>] vprintk_store+0xf6/0x344 > [<ffffffff80055d86>] vprintk_emit+0x56/0x192 > [<ffffffff80055ed8>] vprintk_default+0x16/0x1e > [<ffffffff800563d2>] vprintk+0x72/0x80 > [<ffffffff806813b2>] _printk+0x36/0x50 > [<ffffffff8068af48>] print_reserved_mem+0x1c/0x24 > [<ffffffff808057ec>] paging_init+0x528/0x5bc > [<ffffffff808031ae>] setup_arch+0xd0/0x592 > [<ffffffff8080070e>] start_kernel+0x82/0x73c > > [...] Applied, thanks! [1/1] riscv: fix reserved memory setup https://git.kernel.org/palmer/c/50e63dd8ed92 Best regards,
Hello: This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <palmer@rivosinc.com>: On Mon, 7 Nov 2022 15:15:25 +0000 you wrote: > Currently, RISC-V sets up reserved memory using the "early" copy of the > device tree. As a result, when trying to get a reserved memory region > using of_reserved_mem_lookup(), the pointer to reserved memory regions > is using the early, pre-virtual-memory address which causes a kernel > panic when trying to use the buffer's name: > > Unable to handle kernel paging request at virtual address 00000000401c31ac > Oops [#1] > Modules linked in: > CPU: 0 PID: 0 Comm: swapper Not tainted 6.0.0-rc1-00001-g0d9d6953d834 #1 > Hardware name: Microchip PolarFire-SoC Icicle Kit (DT) > epc : string+0x4a/0xea > ra : vsnprintf+0x1e4/0x336 > epc : ffffffff80335ea0 ra : ffffffff80338936 sp : ffffffff81203be0 > gp : ffffffff812e0a98 tp : ffffffff8120de40 t0 : 0000000000000000 > t1 : ffffffff81203e28 t2 : 7265736572203a46 s0 : ffffffff81203c20 > s1 : ffffffff81203e28 a0 : ffffffff81203d22 a1 : 0000000000000000 > a2 : ffffffff81203d08 a3 : 0000000081203d21 a4 : ffffffffffffffff > a5 : 00000000401c31ac a6 : ffff0a00ffffff04 a7 : ffffffffffffffff > s2 : ffffffff81203d08 s3 : ffffffff81203d00 s4 : 0000000000000008 > s5 : ffffffff000000ff s6 : 0000000000ffffff s7 : 00000000ffffff00 > s8 : ffffffff80d9821a s9 : ffffffff81203d22 s10: 0000000000000002 > s11: ffffffff80d9821c t3 : ffffffff812f3617 t4 : ffffffff812f3617 > t5 : ffffffff812f3618 t6 : ffffffff81203d08 > status: 0000000200000100 badaddr: 00000000401c31ac cause: 000000000000000d > [<ffffffff80338936>] vsnprintf+0x1e4/0x336 > [<ffffffff80055ae2>] vprintk_store+0xf6/0x344 > [<ffffffff80055d86>] vprintk_emit+0x56/0x192 > [<ffffffff80055ed8>] vprintk_default+0x16/0x1e > [<ffffffff800563d2>] vprintk+0x72/0x80 > [<ffffffff806813b2>] _printk+0x36/0x50 > [<ffffffff8068af48>] print_reserved_mem+0x1c/0x24 > [<ffffffff808057ec>] paging_init+0x528/0x5bc > [<ffffffff808031ae>] setup_arch+0xd0/0x592 > [<ffffffff8080070e>] start_kernel+0x82/0x73c > > [...] Here is the summary with links: - [v1] riscv: fix reserved memory setup https://git.kernel.org/riscv/c/50e63dd8ed92 You are awesome, thank you!
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index ad76bb59b059..67ec1fadcfe2 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -283,6 +283,7 @@ void __init setup_arch(char **cmdline_p) else pr_err("No DTB found in kernel mappings\n"); #endif + early_init_fdt_scan_reserved_mem(); misc_mem_init(); init_resources(); diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index b56a0a75533f..50a1b6edd491 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -262,7 +262,6 @@ static void __init setup_bootmem(void) memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); } - early_init_fdt_scan_reserved_mem(); dma_contiguous_reserve(dma32_phys_limit); if (IS_ENABLED(CONFIG_64BIT)) hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);