]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.20.6/arc-adjust-memblock_reserve-of-kernel-memory.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.20.6 / arc-adjust-memblock_reserve-of-kernel-memory.patch
1 From a3010a0465383300f909f62b8a83f83ffa7b2517 Mon Sep 17 00:00:00 2001
2 From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
3 Date: Wed, 19 Dec 2018 19:16:16 +0300
4 Subject: ARC: adjust memblock_reserve of kernel memory
5
6 From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
7
8 commit a3010a0465383300f909f62b8a83f83ffa7b2517 upstream.
9
10 In setup_arch_memory we reserve the memory area wherein the kernel
11 is located. Current implementation may reserve more memory than
12 it actually required in case of CONFIG_LINUX_LINK_BASE is not
13 equal to CONFIG_LINUX_RAM_BASE. This happens because we calculate
14 start of the reserved region relatively to the CONFIG_LINUX_RAM_BASE
15 and end of the region relatively to the CONFIG_LINUX_RAM_BASE.
16
17 For example in case of HSDK board we wasted 256MiB of physical memory:
18 ------------------->8------------------------------
19 Memory: 770416K/1048576K available (5496K kernel code,
20 240K rwdata, 1064K rodata, 2200K init, 275K bss,
21 278160K reserved, 0K cma-reserved)
22 ------------------->8------------------------------
23
24 Fix that.
25
26 Fixes: 9ed68785f7f2b ("ARC: mm: Decouple RAM base address from kernel link addr")
27 Cc: stable@vger.kernel.org #4.14+
28 Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
29 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31
32 ---
33 arch/arc/mm/init.c | 3 ++-
34 1 file changed, 2 insertions(+), 1 deletion(-)
35
36 --- a/arch/arc/mm/init.c
37 +++ b/arch/arc/mm/init.c
38 @@ -137,7 +137,8 @@ void __init setup_arch_memory(void)
39 */
40
41 memblock_add_node(low_mem_start, low_mem_sz, 0);
42 - memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
43 + memblock_reserve(CONFIG_LINUX_LINK_BASE,
44 + __pa(_end) - CONFIG_LINUX_LINK_BASE);
45
46 #ifdef CONFIG_BLK_DEV_INITRD
47 if (initrd_start)