riscv: Fixup pfn_valid error with wrong max_mapnr
authorGuo Ren <guoren@linux.alibaba.com>
Thu, 21 Jan 2021 06:31:17 +0000 (14:31 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 23 Jan 2021 04:18:03 +0000 (20:18 -0800)
The max_mapnr is the number of PFNs, not absolute PFN offset.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Fixes: d0d8aae64566 ("RISC-V: Set maximum number of mapped pages correctly")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/mm/init.c

index 7cd4993f4ff21a932b6ef29512f685ea4e947f9a..f9f9568d689ef53e215c44de8b4468ae3033cfa9 100644 (file)
@@ -196,7 +196,7 @@ void __init setup_bootmem(void)
        max_pfn = PFN_DOWN(dram_end);
        max_low_pfn = max_pfn;
        dma32_phys_limit = min(4UL * SZ_1G, (unsigned long)PFN_PHYS(max_low_pfn));
-       set_max_mapnr(max_low_pfn);
+       set_max_mapnr(max_low_pfn - ARCH_PFN_OFFSET);
 
 #ifdef CONFIG_BLK_DEV_INITRD
        setup_initrd();