MIPS: kexec: add debug info about the new kexec'ed image
authorMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Wed, 23 Nov 2016 13:43:51 +0000 (14:43 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 3 Jan 2017 15:34:46 +0000 (16:34 +0100)
Print details of the new kexec image loaded.

Based on the original code from
commit 221f2c770e10d ("arm64/kexec: Add pr_debug output")

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14614/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/machine_kexec.c

index 59725204105c2b50aa476e1d0e5cb2e61d73cb7c..8b574bcd39ba8868364c7d22e355e96cd4e46d70 100644 (file)
@@ -28,9 +28,31 @@ atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
 void (*_crash_smp_send_stop)(void) = NULL;
 #endif
 
+static void kexec_image_info(const struct kimage *kimage)
+{
+       unsigned long i;
+
+       pr_debug("kexec kimage info:\n");
+       pr_debug("  type:        %d\n", kimage->type);
+       pr_debug("  start:       %lx\n", kimage->start);
+       pr_debug("  head:        %lx\n", kimage->head);
+       pr_debug("  nr_segments: %lu\n", kimage->nr_segments);
+
+       for (i = 0; i < kimage->nr_segments; i++) {
+               pr_debug("    segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n",
+                       i,
+                       kimage->segment[i].mem,
+                       kimage->segment[i].mem + kimage->segment[i].memsz,
+                       (unsigned long)kimage->segment[i].memsz,
+                       (unsigned long)kimage->segment[i].memsz /  PAGE_SIZE);
+       }
+}
+
 int
 machine_kexec_prepare(struct kimage *kimage)
 {
+       kexec_image_info(kimage);
+
        if (_machine_kexec_prepare)
                return _machine_kexec_prepare(kimage);
        return 0;