x86: kdump: move xen_pv_domain() check and insert_resource() to setup_arch()

From: Chen Zhou <chenzhou10@huawei.com>
Link: https://lkml.org/lkml/2021/1/30/53
Link: 8ec4a816f2

We will make the functions reserve_crashkernel() as generic, the
xen_pv_domain() check in reserve_crashkernel() is relevant only to
x86, the same as insert_resource() in reserve_crashkernel[_low]().
So move xen_pv_domain() check and insert_resource() to setup_arch()
to keep them in x86.

Suggested-by: Mike Rapoport <rppt@kernel.org>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Tested-by: John Donnelly <John.p.donnelly@oracle.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Acked-by: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Bin Lai <robinlai@tencent.com>
This commit is contained in:
Kairui Song 2022-06-06 13:49:38 +08:00 committed by Jianping Liu
parent 2fbb10e99b
commit e5eac006f6
1 changed files with 11 additions and 8 deletions

View File

@ -518,7 +518,6 @@ static int __init reserve_crashkernel_low(void)
crashk_low_res.start = low_base;
crashk_low_res.end = low_base + low_size - 1;
insert_resource(&iomem_resource, &crashk_low_res);
#endif
return 0;
}
@ -542,11 +541,6 @@ static void __init reserve_crashkernel(void)
high = true;
}
if (xen_pv_domain()) {
pr_info("Ignoring crashkernel for a Xen PV domain\n");
return;
}
/* 0 means: find the address automatically */
if (!crash_base) {
/*
@ -599,7 +593,6 @@ static void __init reserve_crashkernel(void)
crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
insert_resource(&iomem_resource, &crashk_res);
}
#else
static void __init reserve_crashkernel(void)
@ -1212,7 +1205,17 @@ void __init setup_arch(char **cmdline_p)
* Reserve memory for crash kernel after SRAT is parsed so that it
* won't consume hotpluggable memory.
*/
reserve_crashkernel();
if (xen_pv_domain())
pr_info("Ignoring crashkernel for a Xen PV domain\n");
else {
reserve_crashkernel();
#ifdef CONFIG_KEXEC_CORE
if (crashk_res.end > crashk_res.start)
insert_resource(&iomem_resource, &crashk_res);
if (crashk_low_res.end > crashk_low_res.start)
insert_resource(&iomem_resource, &crashk_low_res);
#endif
}
memblock_find_dma_reserve();