[PATCH v16 03/11] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

From: Zhen Lei
Date: Tue Nov 23 2021 - 07:49:37 EST


From: Chen Zhou <chenzhou10@xxxxxxxxxx>

To make the functions reserve_crashkernel() as generic,
replace some hard-coded numbers with macro CRASH_ADDR_LOW_MAX.

Signed-off-by: Chen Zhou <chenzhou10@xxxxxxxxxx>
Tested-by: John Donnelly <John.p.donnelly@xxxxxxxxxx>
Acked-by: Baoquan He <bhe@xxxxxxxxxx>
---
arch/x86/kernel/setup.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a31352d8c404f6c..2330dcb83e8f06a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -489,8 +489,9 @@ static void __init reserve_crashkernel(void)
if (!crash_base) {
/*
* Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
- * crashkernel=x,high reserves memory over 4G, also allocates
- * 256M extra low memory for DMA buffers and swiotlb.
+ * crashkernel=x,high reserves memory over CRASH_ADDR_LOW_MAX,
+ * also allocates 256M extra low memory for DMA buffers
+ * and swiotlb.
* But the extra memory is not required for all machines.
* So try low memory first and fall back to high memory
* unless "crashkernel=size[KMG],high" is specified.
@@ -518,7 +519,7 @@ static void __init reserve_crashkernel(void)
}
}

- if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
+ if (crash_base >= CRASH_ADDR_LOW_MAX && reserve_crashkernel_low()) {
memblock_phys_free(crash_base, crash_size);
return;
}
--
2.25.1