[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhSdy3fMm5gVASMqfs7qMdUp7omZG5tKSeDCxvDA1YALPDiTA@mail.gmail.com>
Date: Mon, 27 Mar 2023 17:44:26 +0530
From: Anup Patel <anup@...infault.org>
To: Alexandre Ghiti <alexghiti@...osinc.com>
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Andrew Jones <ajones@...tanamicro.com>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v9 2/3] riscv: Move the linear mapping creation in its own function
On Fri, Mar 24, 2023 at 9:26 PM Alexandre Ghiti <alexghiti@...osinc.com> wrote:
>
> No change intended, it just splits the linear mapping creation from
> setup_vm_final: this prepares for upcoming additions to the linear
> mapping creation.
>
> Signed-off-by: Alexandre Ghiti <alexghiti@...osinc.com>
Reviewed-by: Anup Patel <anup@...infault.org>
Tested-by: Anup Patel <anup@...infault.org>
Regards,
Anup
> ---
> arch/riscv/mm/init.c | 42 ++++++++++++++++++++++++++++--------------
> 1 file changed, 28 insertions(+), 14 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index cc558d94559a..3b37d8606920 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -1086,16 +1086,25 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
> pt_ops_set_fixmap();
> }
>
> -static void __init setup_vm_final(void)
> +static void __init create_linear_mapping_range(phys_addr_t start,
> + phys_addr_t end)
> {
> + phys_addr_t pa;
> uintptr_t va, map_size;
> - phys_addr_t pa, start, end;
> - u64 i;
>
> - /* Setup swapper PGD for fixmap */
> - create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
> - __pa_symbol(fixmap_pgd_next),
> - PGDIR_SIZE, PAGE_TABLE);
> + for (pa = start; pa < end; pa += map_size) {
> + va = (uintptr_t)__va(pa);
> + map_size = best_map_size(pa, end - pa);
> +
> + create_pgd_mapping(swapper_pg_dir, va, pa, map_size,
> + pgprot_from_va(va));
> + }
> +}
> +
> +static void __init create_linear_mapping_page_table(void)
> +{
> + phys_addr_t start, end;
> + u64 i;
>
> /* Map all memory banks in the linear mapping */
> for_each_mem_range(i, &start, &end) {
> @@ -1107,14 +1116,19 @@ static void __init setup_vm_final(void)
> if (end >= __pa(PAGE_OFFSET) + memory_limit)
> end = __pa(PAGE_OFFSET) + memory_limit;
>
> - for (pa = start; pa < end; pa += map_size) {
> - va = (uintptr_t)__va(pa);
> - map_size = best_map_size(pa, end - pa);
> -
> - create_pgd_mapping(swapper_pg_dir, va, pa, map_size,
> - pgprot_from_va(va));
> - }
> + create_linear_mapping_range(start, end);
> }
> +}
> +
> +static void __init setup_vm_final(void)
> +{
> + /* Setup swapper PGD for fixmap */
> + create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
> + __pa_symbol(fixmap_pgd_next),
> + PGDIR_SIZE, PAGE_TABLE);
> +
> + /* Map the linear mapping */
> + create_linear_mapping_page_table();
>
> /* Map the kernel */
> if (IS_ENABLED(CONFIG_64BIT))
> --
> 2.37.2
>
Powered by blists - more mailing lists