aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/machine_kexec.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-05-10 07:17:25 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-05-10 07:17:25 -0400
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)
169 169
170 crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1); 170 crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1);
171 if (!crashk_res.start) { 171 if (!crashk_res.start) {
172 crashk_res.start = lmb_alloc(crash_size, PAGE_SIZE); 172 unsigned long max = lmb_end_of_DRAM() - memory_limit;
173 crashk_res.start = __lmb_alloc_base(crash_size, PAGE_SIZE, max);
173 if (!crashk_res.start) { 174 if (!crashk_res.start) {
174 pr_err("crashkernel allocation failed\n"); 175 pr_err("crashkernel allocation failed\n");
175 goto disable; 176 goto disable;
@@ -183,15 +184,22 @@ void __init reserve_crashkernel(void)
183 } 184 }
184 } 185 }
185 186
186 pr_info("Reserving %ldMB of memory at %ldMB " 187 crashk_res.end = crashk_res.start + crash_size - 1;
188
189 /*
190 * Crash kernel trumps memory limit
191 */
192 if ((lmb_end_of_DRAM() - memory_limit) <= crashk_res.end) {
193 memory_limit = 0;
194 pr_info("Disabled memory limit for crashkernel\n");
195 }
196
197 pr_info("Reserving %ldMB of memory at 0x%08lx "
187 "for crashkernel (System RAM: %ldMB)\n", 198 "for crashkernel (System RAM: %ldMB)\n",
188 (unsigned long)(crash_size >> 20), 199 (unsigned long)(crash_size >> 20),
189 (unsigned long)(crashk_res.start >> 20), 200 (unsigned long)(crashk_res.start),
190 (unsigned long)(lmb_phys_mem_size() >> 20)); 201 (unsigned long)(lmb_phys_mem_size() >> 20));
191 202
192 crashk_res.end = crashk_res.start + crash_size - 1;
193 insert_resource(&iomem_resource, &crashk_res);
194
195 return; 203 return;
196 204
197disable: 205disable: