summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJinyang He <hejinyang@loongson.cn>2020-11-25 18:11:02 +0800
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-11-27 10:56:26 +0100
commit1dac4585f585d3aa1a5af4821128ea2642700e48 (patch)
treec4a71852780705c759ac849cd95940e469ee2063
parent915d8aac69d32bf4272a015bf7bf3516deeaad5e (diff)
downloadlinux-1dac4585f585d3aa1a5af4821128ea2642700e48.tar.bz2
MIPS: Loongson64: Fix up reserving kernel memory range
Reserve memory from &_text to &_end. Otherwise if kernel address was modified, the memory range of start_pfn to kernel_start_pfn would be reserved. Then we could not use this range. Signed-off-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-rw-r--r--arch/mips/loongson64/numa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index 509b360e4d28..c6f0c48384f8 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -151,6 +151,9 @@ static void __init node_mem_init(unsigned int node)
NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
if (node == 0) {
+ /* kernel start address */
+ unsigned long kernel_start_pfn = PFN_DOWN(__pa_symbol(&_text));
+
/* kernel end address */
unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end));
@@ -158,8 +161,8 @@ static void __init node_mem_init(unsigned int node)
max_low_pfn = end_pfn;
/* Reserve the kernel text/data/bss */
- memblock_reserve(start_pfn << PAGE_SHIFT,
- ((kernel_end_pfn - start_pfn) << PAGE_SHIFT));
+ memblock_reserve(kernel_start_pfn << PAGE_SHIFT,
+ ((kernel_end_pfn - kernel_start_pfn) << PAGE_SHIFT));
/* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */
if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT))