Skip to content

Commit 7cd7408

Browse files
author
Pingfan Liu
committed
arm64: kdump: Support crashkernel=X fall back to reserve region above DMA zones
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2112877 Upstream Status: linux tree Tested: on ampere-mtjade-altra-03.khw4.lab.eng.bos.redhat.com commit a9ae89d Author: Zhen Lei <thunder.leizhen@huawei.com> Date: Wed Nov 16 20:10:44 2022 +0800 arm64: kdump: Support crashkernel=X fall back to reserve region above DMA zones For crashkernel=X without '@offset', select a region within DMA zones first, and fall back to reserve region above DMA zones. This allows users to use the same configuration on multiple platforms. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Acked-by: Baoquan He <bhe@redhat.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20221116121044.1690-3-thunder.leizhen@huawei.com Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Pingfan Liu <piliu@redhat.com>
1 parent f840a6a commit 7cd7408

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@
789789
memory region [offset, offset + size] for that kernel
790790
image. If '@offset' is omitted, then a suitable offset
791791
is selected automatically.
792-
[KNL, X86-64] Select a region under 4G first, and
792+
[KNL, X86-64, ARM64] Select a region under 4G first, and
793793
fall back to reserve region above 4G when '@offset'
794794
hasn't been specified.
795795
See Documentation/admin-guide/kdump/kdump.rst for further details.

arch/arm64/mm/init.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static void __init reserve_crashkernel(void)
132132
unsigned long long crash_max = CRASH_ADDR_LOW_MAX;
133133
char *cmdline = boot_command_line;
134134
int ret;
135+
bool fixed_base = false;
135136

136137
if (!IS_ENABLED(CONFIG_KEXEC_CORE))
137138
return;
@@ -163,12 +164,26 @@ static void __init reserve_crashkernel(void)
163164
crash_size = PAGE_ALIGN(crash_size);
164165

165166
/* User specifies base address explicitly. */
166-
if (crash_base)
167+
if (crash_base) {
168+
fixed_base = true;
167169
crash_max = crash_base + crash_size;
170+
}
168171

172+
retry:
169173
crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN,
170174
crash_base, crash_max);
171175
if (!crash_base) {
176+
/*
177+
* If the first attempt was for low memory, fall back to
178+
* high memory, the minimum required low memory will be
179+
* reserved later.
180+
*/
181+
if (!fixed_base && (crash_max == CRASH_ADDR_LOW_MAX)) {
182+
crash_max = CRASH_ADDR_HIGH_MAX;
183+
crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
184+
goto retry;
185+
}
186+
172187
pr_warn("cannot allocate crashkernel (size:0x%llx)\n",
173188
crash_size);
174189
return;

0 commit comments

Comments
 (0)