Skip to content

Commit c99127c

Browse files
AlexGhitipalmer-dabbelt
authored andcommitted
riscv: Make sure the linear mapping does not use the kernel mapping
For 64-bit kernel, the end of the address space is occupied by the kernel mapping and currently, the functions to populate the kernel page tables (i.e. create_p*d_mapping) do not override existing mapping so we must make sure the linear mapping does not map memory in the kernel mapping by clipping the memory above the memory limit. Signed-off-by: Alexandre Ghiti <[email protected]> Fixes: c9811e3 ("riscv: Add mem kernel parameter support") Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent c09dc9e commit c99127c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/riscv/mm/init.c

+2
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,8 @@ static void __init setup_vm_final(void)
717717
if (start <= __pa(PAGE_OFFSET) &&
718718
__pa(PAGE_OFFSET) < end)
719719
start = __pa(PAGE_OFFSET);
720+
if (end >= __pa(PAGE_OFFSET) + memory_limit)
721+
end = __pa(PAGE_OFFSET) + memory_limit;
720722

721723
map_size = best_map_size(start, end - start);
722724
for (pa = start; pa < end; pa += map_size) {

0 commit comments

Comments
 (0)