diff options
author | Huacai Chen <chenhc@lemote.com> | 2018-11-09 22:50:14 -0500 |
---|---|---|
committer | Paul Burton <paul.burton@mips.com> | 2018-11-12 14:36:58 -0500 |
commit | 25517ed4e99b3be4244dfd61d1e5c753b09faf2c (patch) | |
tree | 796674ecc7f5a8747645a1f4b7b67bb263c268b0 | |
parent | 82fba2df7f7c019627f24c5036dc99f41731d770 (diff) |
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: bcec54bf3118 ("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>
-rw-r--r-- | arch/mips/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ea09ed6a80a9..8c6c48ed786a 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -794,6 +794,7 @@ static void __init arch_mem_init(char **cmdline_p) | |||
794 | 794 | ||
795 | /* call board setup routine */ | 795 | /* call board setup routine */ |
796 | plat_mem_setup(); | 796 | plat_mem_setup(); |
797 | memblock_set_bottom_up(true); | ||
797 | 798 | ||
798 | /* | 799 | /* |
799 | * Make sure all kernel memory is in the maps. The "UP" and | 800 | * Make sure all kernel memory is in the maps. The "UP" and |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 0f852e1b5891..15e103c6d799 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -2260,10 +2260,8 @@ void __init trap_init(void) | |||
2260 | unsigned long size = 0x200 + VECTORSPACING*64; | 2260 | unsigned long size = 0x200 + VECTORSPACING*64; |
2261 | phys_addr_t ebase_pa; | 2261 | phys_addr_t ebase_pa; |
2262 | 2262 | ||
2263 | memblock_set_bottom_up(true); | ||
2264 | ebase = (unsigned long) | 2263 | ebase = (unsigned long) |
2265 | memblock_alloc_from(size, 1 << fls(size), 0); | 2264 | memblock_alloc_from(size, 1 << fls(size), 0); |
2266 | memblock_set_bottom_up(false); | ||
2267 | 2265 | ||
2268 | /* | 2266 | /* |
2269 | * Try to ensure ebase resides in KSeg0 if possible. | 2267 | * Try to ensure ebase resides in KSeg0 if possible. |
@@ -2307,6 +2305,7 @@ void __init trap_init(void) | |||
2307 | if (board_ebase_setup) | 2305 | if (board_ebase_setup) |
2308 | board_ebase_setup(); | 2306 | board_ebase_setup(); |
2309 | per_cpu_trap_init(true); | 2307 | per_cpu_trap_init(true); |
2308 | memblock_set_bottom_up(false); | ||
2310 | 2309 | ||
2311 | /* | 2310 | /* |
2312 | * Copy the generic exception handlers to their final destination. | 2311 | * Copy the generic exception handlers to their final destination. |