Commit eabd9094 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] Fix crashkernel= handling when no crashkernel= specified

Commit edd8ce67 (Use extended crashkernel
command line on ppc64), changed the logic in reserve_crashkernel()
which deals with the crashkernel= command line option.

This introduced a bug in the case when there is no crashkernel= option,
or it is incorrect.  We would fall through and calculate the crash_size
based on the existing values in crashk_res.  If both start and end are 0,
the default, we calculate the crash_size as 1 byte - which is wrong.

Rework the logic so that we use crashk_res, regardless of whether it's
set by the command line or via the device tree (see prom.c).  Then check
if we have an empty range (end == start), and if so make sure to set
both end and start to zero (this is checked in machine_kexec_64.c).  Then
we calculate the crash_size once we know we have a non-zero range.

Finally we always want to warn the user if they specify a base != 32MB,
so remove the special case for that in the command line parsing case.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 3243d874
...@@ -74,20 +74,20 @@ void __init reserve_crashkernel(void) ...@@ -74,20 +74,20 @@ void __init reserve_crashkernel(void)
ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(),
&crash_size, &crash_base); &crash_size, &crash_base);
if (ret == 0 && crash_size > 0) { if (ret == 0 && crash_size > 0) {
if (crash_base == 0)
crash_base = KDUMP_KERNELBASE;
crashk_res.start = crash_base; crashk_res.start = crash_base;
} else { crashk_res.end = crash_base + crash_size - 1;
/* handle the device tree */
crash_size = crashk_res.end - crashk_res.start + 1;
} }
if (crash_size == 0) if (crashk_res.end == crashk_res.start) {
crashk_res.start = crashk_res.end = 0;
return; return;
}
/* We might have got these values via the command line or the /* We might have got these values via the command line or the
* device tree, either way sanitise them now. */ * device tree, either way sanitise them now. */
crash_size = crashk_res.end - crashk_res.start + 1;
if (crashk_res.start != KDUMP_KERNELBASE) if (crashk_res.start != KDUMP_KERNELBASE)
printk("Crash kernel location must be 0x%x\n", printk("Crash kernel location must be 0x%x\n",
KDUMP_KERNELBASE); KDUMP_KERNELBASE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment