From: Mao Minkai maominkai@wxiat.com
Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I56TYY
--------------------------------
Mark pci reserved region and memmap reserved region as MEMBLOCK_NOMAP instead of removing them from memblock, so they can be managed by using memblock api.
Signed-off-by: Mao Minkai maominkai@wxiat.com
Signed-off-by: Gu Zitao guzitao@wxiat.com Acked-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/sw_64/kernel/setup.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/arch/sw_64/kernel/setup.c b/arch/sw_64/kernel/setup.c index 2784ea5aa0ae..4f735f44ccc3 100644 --- a/arch/sw_64/kernel/setup.c +++ b/arch/sw_64/kernel/setup.c @@ -383,7 +383,7 @@ void __init process_memmap(void) } else { pr_info("reserved memmap region [mem %#018llx-%#018llx]\n", base, base + size - 1); - ret = memblock_remove(base, size); + ret = memblock_mark_nomap(base, size); if (ret) pr_err("reserve memmap region [mem %#018llx-%#018llx] failed\n", base, base + size - 1); @@ -399,7 +399,7 @@ void __init process_memmap(void) } else { pr_info("pci memmap region [mem %#018llx-%#018llx]\n", base, base + size - 1); - ret = memblock_remove(base, size); + ret = memblock_mark_nomap(base, size); if (ret) pr_err("reserve memmap region [mem %#018llx-%#018llx] failed\n", base, base + size - 1); @@ -496,7 +496,6 @@ insert_ram_resource(u64 start, u64 end, bool reserved)
static int __init request_standard_resources(void) { - int i; struct memblock_region *mblk;
extern char _text[], _etext[]; @@ -504,17 +503,12 @@ static int __init request_standard_resources(void) extern char __bss_start[], __bss_stop[];
for_each_mem_region(mblk) { - insert_ram_resource(mblk->base, mblk->base + mblk->size - 1, 0); - } - - for (i = 0; i < memmap_nr; i++) { - switch (memmap_map[i].type) { - case memmap_crashkernel: - break; - default: - insert_ram_resource(memmap_map[i].addr, - memmap_map[i].addr + memmap_map[i].size - 1, 1); - } + if (!memblock_is_nomap(mblk)) + insert_ram_resource(mblk->base, + mblk->base + mblk->size - 1, 0); + else + insert_ram_resource(mblk->base, + mblk->base + mblk->size - 1, 1); }
code_resource.start = __pa_symbol(_text);