diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-05-07 01:54:55 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-07 01:54:55 -0400 |
commit | a5ec39507129a086d8838228ac1ca0a2eab38f91 (patch) | |
tree | 01c3cfa2f80aa3144b16c87e2cf769b605c7c889 /arch/sh/kernel/machine_kexec.c | |
parent | 9b7a37853a8cd69829eb1d9715a6c09aae01eeec (diff) |
sh: convert kexec crash kernel management to LMB.
This migrates the crash kernel handling off of bootmem and over to LMB.
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.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index 7672141c841b..f0f049caa6e2 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> |
@@ -148,3 +148,52 @@ void arch_crash_save_vmcoreinfo(void) | |||
148 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); | 148 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); |
149 | #endif | 149 | #endif |
150 | } | 150 | } |
151 | |||
152 | void __init reserve_crashkernel(void) | ||
153 | { | ||
154 | unsigned long long crash_size, crash_base; | ||
155 | int ret; | ||
156 | |||
157 | /* this is necessary because of lmb_phys_mem_size() */ | ||
158 | lmb_analyze(); | ||
159 | |||
160 | ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), | ||
161 | &crash_size, &crash_base); | ||
162 | if (ret == 0 && crash_size > 0) { | ||
163 | crashk_res.start = crash_base; | ||
164 | crashk_res.end = crash_base + crash_size - 1; | ||
165 | } | ||
166 | |||
167 | if (crashk_res.end == crashk_res.start) | ||
168 | goto disable; | ||
169 | |||
170 | crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1); | ||
171 | if (!crashk_res.start) { | ||
172 | crashk_res.start = lmb_alloc(crash_size, PAGE_SIZE); | ||
173 | if (!crashk_res.start) { | ||
174 | pr_err("crashkernel allocation failed\n"); | ||
175 | goto disable; | ||
176 | } | ||
177 | } else { | ||
178 | ret = lmb_reserve(crashk_res.start, crash_size); | ||
179 | if (unlikely(ret < 0)) { | ||
180 | pr_err("crashkernel reservation failed - " | ||
181 | "memory is in use\n"); | ||
182 | goto disable; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | pr_info("Reserving %ldMB of memory at %ldMB " | ||
187 | "for crashkernel (System RAM: %ldMB)\n", | ||
188 | (unsigned long)(crash_size >> 20), | ||
189 | (unsigned long)(crashk_res.start >> 20), | ||
190 | (unsigned long)(lmb_phys_mem_size() >> 20)); | ||
191 | |||
192 | crashk_res.end = crashk_res.start + crash_size - 1; | ||
193 | insert_resource(&iomem_resource, &crashk_res); | ||
194 | |||
195 | return; | ||
196 | |||
197 | disable: | ||
198 | crashk_res.start = crashk_res.end = 0; | ||
199 | } | ||