aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/machine_kexec_64.c
diff options
context:
space:
mode:
authorMohan Kumar M <mohan@in.ibm.com>2008-10-21 13:38:10 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-22 00:01:22 -0400
commit54622f10a6aabb8bb2bdacf3dd070046f03dc246 (patch)
tree73eb5ad4eeb7174b8c0ae1904bbe80602c5e295d /arch/powerpc/kernel/machine_kexec_64.c
parent4792adbac9eb41cea77a45ab76258ea10d411173 (diff)
powerpc: Support for relocatable kdump kernel
This adds relocatable kernel support for kdump. With this one can use the same regular kernel to capture the kdump. A signature (0xfeed1234) is passed in r6 from panic code to the next kernel through kexec_sequence and purgatory code. The signature is used to differentiate between kdump kernel and non-kdump kernels. The purgatory code compares the signature and sets the __kdump_flag in head_64.S. During the boot up, kernel code checks __kdump_flag and if it is set, the kernel will behave as relocatable kdump kernel. This kernel will boot at the address where it was loaded by kexec-tools ie. at the address reserved through crashkernel boot parameter. CONFIG_CRASH_DUMP depends on CONFIG_RELOCATABLE option to build kdump kernel as relocatable. So the same kernel can be used as production and kdump kernel. This patch incorporates the changes suggested by Paul Mackerras to avoid GOT use and to avoid two copies of the code. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Mohan Kumar M <mohan@in.ibm.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/machine_kexec_64.c')
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 4bd8b4f5e70d..e6efec788c4d 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -255,11 +255,14 @@ static union thread_union kexec_stack
255/* Our assembly helper, in kexec_stub.S */ 255/* Our assembly helper, in kexec_stub.S */
256extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start, 256extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
257 void *image, void *control, 257 void *image, void *control,
258 void (*clear_all)(void)) ATTRIB_NORET; 258 void (*clear_all)(void),
259 unsigned long kdump_flag) ATTRIB_NORET;
259 260
260/* too late to fail here */ 261/* too late to fail here */
261void default_machine_kexec(struct kimage *image) 262void default_machine_kexec(struct kimage *image)
262{ 263{
264 unsigned long kdump_flag = 0;
265
263 /* prepare control code if any */ 266 /* prepare control code if any */
264 267
265 /* 268 /*
@@ -270,8 +273,10 @@ void default_machine_kexec(struct kimage *image)
270 * using debugger IPI. 273 * using debugger IPI.
271 */ 274 */
272 275
273 if (crashing_cpu == -1) 276 if (crashing_cpu == -1)
274 kexec_prepare_cpus(); 277 kexec_prepare_cpus();
278 else
279 kdump_flag = KDUMP_SIGNATURE;
275 280
276 /* switch to a staticly allocated stack. Based on irq stack code. 281 /* switch to a staticly allocated stack. Based on irq stack code.
277 * XXX: the task struct will likely be invalid once we do the copy! 282 * XXX: the task struct will likely be invalid once we do the copy!
@@ -284,7 +289,7 @@ void default_machine_kexec(struct kimage *image)
284 */ 289 */
285 kexec_sequence(&kexec_stack, image->start, image, 290 kexec_sequence(&kexec_stack, image->start, image,
286 page_address(image->control_code_page), 291 page_address(image->control_code_page),
287 ppc_md.hpte_clear_all); 292 ppc_md.hpte_clear_all, kdump_flag);
288 /* NOTREACHED */ 293 /* NOTREACHED */
289} 294}
290 295