未验证 提交 c99127c4 编写于 作者: A Alexandre Ghiti 提交者: Palmer Dabbelt

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: NAlexandre Ghiti <alex@ghiti.fr>
Fixes: c9811e37 ("riscv: Add mem kernel parameter support")
Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
上级 c09dc9e1
...@@ -717,6 +717,8 @@ static void __init setup_vm_final(void) ...@@ -717,6 +717,8 @@ static void __init setup_vm_final(void)
if (start <= __pa(PAGE_OFFSET) && if (start <= __pa(PAGE_OFFSET) &&
__pa(PAGE_OFFSET) < end) __pa(PAGE_OFFSET) < end)
start = __pa(PAGE_OFFSET); start = __pa(PAGE_OFFSET);
if (end >= __pa(PAGE_OFFSET) + memory_limit)
end = __pa(PAGE_OFFSET) + memory_limit;
map_size = best_map_size(start, end - start); map_size = best_map_size(start, end - start);
for (pa = start; pa < end; pa += map_size) { for (pa = start; pa < end; pa += map_size) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册