Skip to content

Commit a9ae89d

Browse files
Zhen Leiwilldeacon
authored andcommitted
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 <[email protected]> Acked-by: Baoquan He <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent a149cf0 commit a9ae89d

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
@@ -831,7 +831,7 @@
831831
memory region [offset, offset + size] for that kernel
832832
image. If '@offset' is omitted, then a suitable offset
833833
is selected automatically.
834-
[KNL, X86-64] Select a region under 4G first, and
834+
[KNL, X86-64, ARM64] Select a region under 4G first, and
835835
fall back to reserve region above 4G when '@offset'
836836
hasn't been specified.
837837
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)