[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhSdy0LLu4o6uOB8t_Wv6jsOrrrSMx0pv1E1B5F679gan3i6g@mail.gmail.com>
Date: Tue, 23 Nov 2021 09:14:40 +0530
From: Anup Patel <anup@...infault.org>
To: Guo Ren <guoren@...nel.org>
Cc: Palmer Dabbelt <palmer@...belt.com>, atishp@...osinc.com,
"linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Guo Ren <guoren@...ux.alibaba.com>,
Anup Patel <anup.patel@....com>,
Alexandre Ghiti <alexandre.ghiti@...onical.com>,
Alexandre Ghiti <alex@...ti.fr>
Subject: Re: [RFC PATCH 2/3] riscv: Add early_param to decrease firmware region
+Alex
On Tue, Nov 23, 2021 at 7:27 AM <guoren@...nel.org> wrote:
>
> From: Guo Ren <guoren@...ux.alibaba.com>
>
> Using riscv.fw_size in cmdline to tell the kernel what the
> firmware (opensbi) size is. Then reserve the proper size of
> firmware to save memory instead of the whole 2MB. It's helpful
> to satisfy a small memory system (D1s/F133 from Allwinner).
>
> Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
> Cc: Palmer Dabbelt <palmer@...belt.com>
> Cc: Anup Patel <anup.patel@....com>
> Cc: Atish Patra <atishp@...osinc.com>
> ---
> arch/riscv/mm/init.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 920e78f8c3e4..f7db6d40213d 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -159,6 +159,15 @@ static int __init early_mem(char *p)
> }
> early_param("mem", early_mem);
>
> +static phys_addr_t firmware_size __initdata;
> +static int __init early_get_firmware_size(char *arg)
> +{
> + firmware_size = memparse(arg, &arg);
> +
> + return 0;
> +}
> +early_param("riscv.fwsz", early_get_firmware_size);
> +
We have avoided any RISC-V specific kernel parameter till now
and I don't think adding "riscv.fwsz" is the right approach.
OpenSBI adds a reserved memory node (mmode_resv@...0000)
to mark the memory where it is running as reserved. In fact, all
M-mode runtime firmware should be adding a reserved memory
node just like OpenSBI.
Regards,
Anup
> static void __init setup_bootmem(void)
> {
> phys_addr_t vmlinux_end = __pa_symbol(&_end);
> @@ -224,7 +233,10 @@ static void __init setup_bootmem(void)
> /*
> * Reserve OpenSBI region and depends on PMP to deny accesses.
> */
> - memblock_reserve(__pa(PAGE_OFFSET), LOAD_OFFSET);
> + if (firmware_size > PAGE_SIZE)
> + memblock_reserve(__pa(PAGE_OFFSET), firmware_size);
> + else
> + memblock_reserve(__pa(PAGE_OFFSET), LOAD_OFFSET);
>
> early_init_fdt_scan_reserved_mem();
> dma_contiguous_reserve(dma32_phys_limit);
> --
> 2.25.1
>
Powered by blists - more mailing lists