diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-05-13 04:48:05 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-13 04:48:05 -0400 |
commit | ef4ed97d6bd91aa41907181e80a7feaf2721719a (patch) | |
tree | adc44e858c150c41ebf1dd7c6ee2f6bcbac75502 /arch/sh/kernel/machine_kexec.c | |
parent | c5eb5b372e7ea18a5eeb6b5192a6369967cb1afe (diff) | |
parent | 21823259a70b7a2a21eea1d48c25a6f38896dd11 (diff) |
Merge branch 'sh/lmb'
Conflicts:
arch/sh/kernel/setup.c
Diffstat (limited to 'arch/sh/kernel/machine_kexec.c')
-rw-r--r-- | arch/sh/kernel/machine_kexec.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index 0e90c7f9564..5a559e666eb 100644 --- a/arch/sh/kernel/machine_kexec.c +++ b/arch/sh/kernel/machine_kexec.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * This source code is licensed under the GNU General Public License, | 8 | * This source code is licensed under the GNU General Public License, |
9 | * Version 2. See the file COPYING for more details. | 9 | * Version 2. See the file COPYING for more details. |
10 | */ | 10 | */ |
11 | |||
12 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
13 | #include <linux/kexec.h> | 12 | #include <linux/kexec.h> |
14 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
@@ -16,6 +15,7 @@ | |||
16 | #include <linux/numa.h> | 15 | #include <linux/numa.h> |
17 | #include <linux/ftrace.h> | 16 | #include <linux/ftrace.h> |
18 | #include <linux/suspend.h> | 17 | #include <linux/suspend.h> |
18 | #include <linux/lmb.h> | ||
19 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
20 | #include <asm/pgalloc.h> | 20 | #include <asm/pgalloc.h> |
21 | #include <asm/mmu_context.h> | 21 | #include <asm/mmu_context.h> |
@@ -151,3 +151,60 @@ void arch_crash_save_vmcoreinfo(void) | |||
151 | VMCOREINFO_CONFIG(X2TLB); | 151 | VMCOREINFO_CONFIG(X2TLB); |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | |||
155 | void __init reserve_crashkernel(void) | ||
156 | { | ||
157 | unsigned long long crash_size, crash_base; | ||
158 | int ret; | ||
159 | |||
160 | /* this is necessary because of lmb_phys_mem_size() */ | ||
161 | lmb_analyze(); | ||
162 | |||
163 | ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), | ||
164 | &crash_size, &crash_base); | ||
165 | if (ret == 0 && crash_size > 0) { | ||
166 | crashk_res.start = crash_base; | ||
167 | crashk_res.end = crash_base + crash_size - 1; | ||
168 | } | ||
169 | |||
170 | if (crashk_res.end == crashk_res.start) | ||
171 | goto disable; | ||
172 | |||
173 | crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1); | ||
174 | if (!crashk_res.start) { | ||
175 | unsigned long max = lmb_end_of_DRAM() - memory_limit; | ||
176 | crashk_res.start = __lmb_alloc_base(crash_size, PAGE_SIZE, max); | ||
177 | if (!crashk_res.start) { | ||
178 | pr_err("crashkernel allocation failed\n"); | ||
179 | goto disable; | ||
180 | } | ||
181 | } else { | ||
182 | ret = lmb_reserve(crashk_res.start, crash_size); | ||
183 | if (unlikely(ret < 0)) { | ||
184 | pr_err("crashkernel reservation failed - " | ||
185 | "memory is in use\n"); | ||
186 | goto disable; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | crashk_res.end = crashk_res.start + crash_size - 1; | ||
191 | |||
192 | /* | ||
193 | * Crash kernel trumps memory limit | ||
194 | */ | ||
195 | if ((lmb_end_of_DRAM() - memory_limit) <= crashk_res.end) { | ||
196 | memory_limit = 0; | ||
197 | pr_info("Disabled memory limit for crashkernel\n"); | ||
198 | } | ||
199 | |||
200 | pr_info("Reserving %ldMB of memory at 0x%08lx " | ||
201 | "for crashkernel (System RAM: %ldMB)\n", | ||
202 | (unsigned long)(crash_size >> 20), | ||
203 | (unsigned long)(crashk_res.start), | ||
204 | (unsigned long)(lmb_phys_mem_size() >> 20)); | ||
205 | |||
206 | return; | ||
207 | |||
208 | disable: | ||
209 | crashk_res.start = crashk_res.end = 0; | ||
210 | } | ||