Skip to content

Commit d0e4dae

Browse files
lbmengpalmer-dabbelt
authored andcommitted
riscv: Fix 32-bit RISC-V boot failure
Commit dd2d082 ("riscv: Cleanup setup_bootmem()") adjusted the calling sequence in setup_bootmem(), which invalidates the fix commit de043da ("RISC-V: Fix usage of memblock_enforce_memory_limit") did for 32-bit RISC-V unfortunately. So now 32-bit RISC-V does not boot again when testing booting kernel on QEMU 'virt' with '-m 2G', which was exactly what the original commit de043da ("RISC-V: Fix usage of memblock_enforce_memory_limit") tried to fix. Fixes: dd2d082 ("riscv: Cleanup setup_bootmem()") Signed-off-by: Bin Meng <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6efb943 commit d0e4dae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/riscv/mm/init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void __init setup_bootmem(void)
123123
{
124124
phys_addr_t vmlinux_end = __pa_symbol(&_end);
125125
phys_addr_t vmlinux_start = __pa_symbol(&_start);
126-
phys_addr_t dram_end = memblock_end_of_DRAM();
126+
phys_addr_t dram_end;
127127
phys_addr_t max_mapped_addr = __pa(~(ulong)0);
128128

129129
#ifdef CONFIG_XIP_KERNEL
@@ -146,6 +146,8 @@ void __init setup_bootmem(void)
146146
#endif
147147
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
148148

149+
dram_end = memblock_end_of_DRAM();
150+
149151
/*
150152
* memblock allocator is not aware of the fact that last 4K bytes of
151153
* the addressable memory can not be mapped because of IS_ERR_VALUE

0 commit comments

Comments
 (0)