Skip to content

Commit d0d8aae

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Set maximum number of mapped pages correctly
Currently, maximum number of mapper pages are set to the pfn calculated from the memblock size of the memblock containing kernel. This will work until that memblock spans the entire memory. However, it will be set to a wrong value if there are multiple memblocks defined in kernel (e.g. with efi runtime services). Set the the maximum value to the pfn calculated from dram size. Signed-off-by: Atish Patra <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 4cb699d commit d0d8aae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ void __init setup_bootmem(void)
150150
/* Reserve from the start of the kernel to the end of the kernel */
151151
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
152152

153-
set_max_mapnr(PFN_DOWN(mem_size));
154153
max_pfn = PFN_DOWN(memblock_end_of_DRAM());
155154
max_low_pfn = max_pfn;
155+
set_max_mapnr(max_low_pfn);
156156

157157
#ifdef CONFIG_BLK_DEV_INITRD
158158
setup_initrd();

0 commit comments

Comments
 (0)