summaryrefslogtreecommitdiff
path: root/arch/sh/kernel/machine_kexec.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-05-10 20:17:25 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-05-10 20:17:25 +0900
commit5e2ff328c0668794ff408a4632f5b8a62827571f (patch)
tree53a35de722c44c6739541d6b9ae74970520191f9 /arch/sh/kernel/machine_kexec.c
parent19d8f84f86af867abee174be8bf1e4941a59143d (diff)
sh: rework memory limits to work with LMB.
This reworks the memory limit handling to tie in through the available LMB infrastructure. This requires a bit of reordering as we need to have all of the LMB reservations taken care of prior to establishing the limits. While we're at it, the crash kernel reservation semantics are reworked so that we allocate from the bottom up and reduce the risk of having to disable the memory limit due to a clash with the crash kernel reservation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/machine_kexec.c')
-rw-r--r--arch/sh/kernel/machine_kexec.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index f0f049caa6e2..7f68fc0e89e8 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -169,7 +169,8 @@ void __init reserve_crashkernel(void)
crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1);
if (!crashk_res.start) {
- crashk_res.start = lmb_alloc(crash_size, PAGE_SIZE);
+ unsigned long max = lmb_end_of_DRAM() - memory_limit;
+ crashk_res.start = __lmb_alloc_base(crash_size, PAGE_SIZE, max);
if (!crashk_res.start) {
pr_err("crashkernel allocation failed\n");
goto disable;
@@ -183,15 +184,22 @@ void __init reserve_crashkernel(void)
}
}
- pr_info("Reserving %ldMB of memory at %ldMB "
+ crashk_res.end = crashk_res.start + crash_size - 1;
+
+ /*
+ * Crash kernel trumps memory limit
+ */
+ if ((lmb_end_of_DRAM() - memory_limit) <= crashk_res.end) {
+ memory_limit = 0;
+ pr_info("Disabled memory limit for crashkernel\n");
+ }
+
+ pr_info("Reserving %ldMB of memory at 0x%08lx "
"for crashkernel (System RAM: %ldMB)\n",
(unsigned long)(crash_size >> 20),
- (unsigned long)(crashk_res.start >> 20),
+ (unsigned long)(crashk_res.start),
(unsigned long)(lmb_phys_mem_size() >> 20));
- crashk_res.end = crashk_res.start + crash_size - 1;
- insert_resource(&iomem_resource, &crashk_res);
-
return;
disable: