Skip to content

Commit 25517ed

Browse files
chenhuacaipaulburton
authored andcommitted
MIPS: Let early memblock_alloc*() allocate memories bottom-up
After switched to NO_BOOTMEM, there are several boot failures. Some of them have been fixed and some of them haven't. I find that many of them are because of memory allocations are top-down, while the old behavior is bottom-up. This patch let early memblock_alloc*() allocate memories bottom-up to avoid some potential problems. Signed-off-by: Huacai Chen <chenhc@lemote.com> Signed-off-by: Paul Burton <paul.burton@mips.com> Fixes: bcec54b ("mips: switch to NO_BOOTMEM") Patchwork: https://patchwork.linux-mips.org/patch/21069/ References: https://patchwork.linux-mips.org/patch/21031/ Cc: Ralf Baechle <ralf@linux-mips.org> Cc: James Hogan <james.hogan@mips.com> Cc: Steven J . Hill <Steven.Hill@cavium.com> Cc: linux-mips@linux-mips.org Cc: Fuxin Zhang <zhangfx@lemote.com> Cc: Zhangjin Wu <wuzhangjin@gmail.com>
1 parent 82fba2d commit 25517ed

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/mips/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ static void __init arch_mem_init(char **cmdline_p)
794794

795795
/* call board setup routine */
796796
plat_mem_setup();
797+
memblock_set_bottom_up(true);
797798

798799
/*
799800
* Make sure all kernel memory is in the maps. The "UP" and

arch/mips/kernel/traps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,10 +2260,8 @@ void __init trap_init(void)
22602260
unsigned long size = 0x200 + VECTORSPACING*64;
22612261
phys_addr_t ebase_pa;
22622262

2263-
memblock_set_bottom_up(true);
22642263
ebase = (unsigned long)
22652264
memblock_alloc_from(size, 1 << fls(size), 0);
2266-
memblock_set_bottom_up(false);
22672265

22682266
/*
22692267
* Try to ensure ebase resides in KSeg0 if possible.
@@ -2307,6 +2305,7 @@ void __init trap_init(void)
23072305
if (board_ebase_setup)
23082306
board_ebase_setup();
23092307
per_cpu_trap_init(true);
2308+
memblock_set_bottom_up(false);
23102309

23112310
/*
23122311
* Copy the generic exception handlers to their final destination.

0 commit comments

Comments
 (0)