From: Anup Patel <anup@brainfault.org>
To: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: linux-riscv <linux-riscv@lists.infradead.org>,
"linux-kernel@vger.kernel.org List"
<linux-kernel@vger.kernel.org>, Bin Meng <bin.meng@windriver.com>,
Palmer Dabbelt <palmerdabbelt@google.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
devicetree@vger.kernel.org
Subject: Re: [PATCH] riscv: add BUILTIN_DTB support for MMU-enabled targets
Date: Mon, 28 Dec 2020 17:29:41 +0530 [thread overview]
Message-ID: <CAAhSdy1M5pMjYHNWdOicb3N3fjTfQLEgE8tFb74sqGbPE_9eyQ@mail.gmail.com> (raw)
In-Reply-To: <20201226163037.43691-1-vitaly.wool@konsulko.com>
On Sat, Dec 26, 2020 at 10:03 PM Vitaly Wool <vitaly.wool@konsulko.com> wrote:
>
> Sometimes, especially in a production system we may not want to
> use a "smart bootloader" like u-boot to load kernel, ramdisk and
> device tree from a filesystem on eMMC, but rather load the kernel
> from a NAND partition and just run it as soon as we can, and in
> this case it is convenient to have device tree compiled into the
> kernel binary. Since this case is not limited to MMU-less systems,
> let's support it for these which have MMU enabled too.
>
> Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
> ---
> arch/riscv/Kconfig | 1 -
> arch/riscv/mm/init.c | 12 ++++++++++--
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 2b41f6d8e458..9464b4e3a71a 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -419,7 +419,6 @@ endmenu
>
> config BUILTIN_DTB
> def_bool n
> - depends on RISCV_M_MODE
> depends on OF
>
> menu "Power management options"
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 87c305c566ac..5d1c7a3ec01c 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -194,12 +194,20 @@ void __init setup_bootmem(void)
> setup_initrd();
> #endif /* CONFIG_BLK_DEV_INITRD */
>
> + /*
> + * If DTB is built in, no need to reserve its memblock.
> + * OTOH, initial_boot_params has to be set to properly copy DTB
> + * before unflattening later on.
> + */
> + if (IS_ENABLED(CONFIG_BUILTIN_DTB))
> + initial_boot_params = __va(dtb_early_pa);
Don't assign initial_boot_params directly here because the
early_init_dt_scan() will do it.
The setup_vm() is supposed to setup dtb_early_va and dtb_early_pa
for MMU-enabled case so please add a "#ifdef" over there for the
built-in DTB case.
> + else
> + memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
> +
> /*
> * Avoid using early_init_fdt_reserve_self() since __pa() does
> * not work for DTB pointers that are fixmap addresses
> */
This comment needs to be updated and moved along the memblock_reserve()
statement.
> - memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
> -
> early_init_fdt_scan_reserved_mem();
> dma_contiguous_reserve(dma32_phys_limit);
> memblock_allow_resize();
> --
> 2.29.2
>
This patch should be based upon Damiens builtin DTB patch.
Refer, https://www.spinics.net/lists/linux-gpio/msg56616.html
Regards,
Anup
next prev parent reply other threads:[~2020-12-28 12:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-26 16:30 [PATCH] riscv: add BUILTIN_DTB support for MMU-enabled targets Vitaly Wool
2020-12-28 11:59 ` Anup Patel [this message]
2020-12-28 13:35 ` Vitaly Wool
2020-12-28 14:10 ` Anup Patel
2020-12-28 16:38 ` Vitaly Wool
2020-12-29 5:05 ` Anup Patel
2020-12-31 9:53 ` Vitaly Wool
2021-01-01 15:27 ` Anup Patel
2020-12-28 14:13 ` Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAhSdy1M5pMjYHNWdOicb3N3fjTfQLEgE8tFb74sqGbPE_9eyQ@mail.gmail.com \
--to=anup@brainfault.org \
--cc=bin.meng@windriver.com \
--cc=damien.lemoal@wdc.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmerdabbelt@google.com \
--cc=vitaly.wool@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).