[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211222130820.1754-3-thunder.leizhen@huawei.com>
Date: Wed, 22 Dec 2021 21:08:05 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
<x86@...nel.org>, "H . Peter Anvin" <hpa@...or.com>,
<linux-kernel@...r.kernel.org>, Dave Young <dyoung@...hat.com>,
Baoquan He <bhe@...hat.com>, Vivek Goyal <vgoyal@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>,
<kexec@...ts.infradead.org>,
Catalin Marinas <catalin.marinas@....com>,
"Will Deacon" <will@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
<devicetree@...r.kernel.org>, Jonathan Corbet <corbet@....net>,
<linux-doc@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>,
Randy Dunlap <rdunlap@...radead.org>,
Feng Zhou <zhoufeng.zf@...edance.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Chen Zhou <dingguo.cz@...group.com>,
"John Donnelly" <John.p.donnelly@...cle.com>
Subject: [PATCH v18 02/17] x86/setup: Move xen_pv_domain() check and insert_resource() to setup_arch()
From: Chen Zhou <chenzhou10@...wei.com>
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@...nel.org>
Signed-off-by: Chen Zhou <chenzhou10@...wei.com>
Co-developed-by: Zhen Lei <thunder.leizhen@...wei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
arch/x86/kernel/setup.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index ae8f63661363e25..acf2f2eedfe3415 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -434,7 +434,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;
}
@@ -458,11 +457,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) {
/*
@@ -508,11 +502,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)
-{
}
#endif
@@ -1120,7 +1109,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();
+#ifdef CONFIG_KEXEC_CORE
+ if (xen_pv_domain())
+ pr_info("Ignoring crashkernel for a Xen PV domain\n");
+ else {
+ reserve_crashkernel();
+ 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();
--
2.25.1
Powered by blists - more mailing lists