riscv: Move early fdt mapping creation in its own function
authorAlexandre Ghiti <alex@ghiti.fr>
Fri, 23 Jul 2021 13:01:28 +0000 (15:01 +0200)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 12 Aug 2021 05:41:38 +0000 (22:41 -0700)
commitfe45ffa4c505783637233609b677446020738b87
tree32ec59da03e33565b7bd0494ae73272977218623
parent977765ce319b98939205cf07aa1d76150713c69b
riscv: Move early fdt mapping creation in its own function

The code that handles the early fdt mapping is hard to read and does not
create the same mapping size depending on the kernel:

- for 64-bit, 2 PMD entries are used which amounts to a 4MB mapping
- for 32-bit, 2 PGDIR entries are used which amounts to a 8MB mapping

So keep using 2 PMD entries for 64-bit and use only one PGD entry for
32-bit needed to cover 4MB. Move that into a new function called
create_fdt_early_page_table which, using the same naming as
create_kernel_page_table.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/mm/init.c