public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: geoff@infradead.org (Geoff Levand)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 6/8] arm64/kexec: Add pr_devel output
Date: Fri, 14 Nov 2014 13:12:37 -0800	[thread overview]
Message-ID: <1415999557.15847.125.camel@smoke> (raw)
In-Reply-To: <2b08174dd201077d4e7f6ec6c107650b22688723.1415926876.git.geoff@infradead.org>

To aid in debugging kexec problems or when adding new functionality to kexec add
a new routine kexec_image_info() and several inline pr_devel statements.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
v2: Format fixes - thanks Sergei

 arch/arm64/kernel/machine_kexec.c | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index b0e5d76..3d84759 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -35,6 +35,37 @@ static bool kexec_is_dtb(const void *dtb)
 }
 
 /**
+ * kexec_image_info - For debugging output.
+ */
+#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i)
+static void _kexec_image_info(const char *func, int line,
+	const struct kimage *image)
+{
+	unsigned long i;
+
+#if !defined(DEBUG)
+	return;
+#endif
+	pr_devel("%s:%d:\n", func, line);
+	pr_devel("  kexec image info:\n");
+	pr_devel("    type:        %d\n", image->type);
+	pr_devel("    start:       %lx\n", image->start);
+	pr_devel("    head:        %lx\n", image->head);
+	pr_devel("    nr_segments: %lu\n", image->nr_segments);
+
+	for (i = 0; i < image->nr_segments; i++) {
+		pr_devel("      segment[%lu]: %016lx - %016lx, %lx bytes, %lu pages%s\n",
+			i,
+			image->segment[i].mem,
+			image->segment[i].mem + image->segment[i].memsz,
+			image->segment[i].memsz,
+			image->segment[i].memsz /  PAGE_SIZE,
+			(kexec_is_dtb(image->segment[i].buf) ?
+				", dtb segment" : ""));
+	}
+}
+
+/**
  * kexec_find_dtb_seg - Helper routine to find the dtb segment.
  */
 static const struct kexec_segment *kexec_find_dtb_seg(
@@ -67,6 +98,8 @@ int machine_kexec_prepare(struct kimage *image)
 	arm64_kexec_dtb_addr = dtb_seg ? dtb_seg->mem : 0;
 	arm64_kexec_kimage_start = image->start;
 
+	kexec_image_info(image);
+
 	return 0;
 }
 
@@ -121,6 +154,27 @@ void machine_kexec(struct kimage *image)
 	reboot_code_buffer_phys = page_to_phys(image->control_code_page);
 	reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);
 
+	kexec_image_info(image);
+
+	pr_devel("%s:%d: control_code_page:        %p\n", __func__, __LINE__,
+		image->control_code_page);
+	pr_devel("%s:%d: reboot_code_buffer_phys:  %pa\n", __func__, __LINE__,
+		&reboot_code_buffer_phys);
+	pr_devel("%s:%d: reboot_code_buffer:       %p\n", __func__, __LINE__,
+		reboot_code_buffer);
+	pr_devel("%s:%d: relocate_new_kernel:      %p\n", __func__, __LINE__,
+		relocate_new_kernel);
+	pr_devel("%s:%d: relocate_new_kernel_size: 0x%lx(%lu) bytes\n",
+		__func__, __LINE__, relocate_new_kernel_size,
+		relocate_new_kernel_size);
+
+	pr_devel("%s:%d: kexec_dtb_addr:           %lx\n", __func__, __LINE__,
+		arm64_kexec_dtb_addr);
+	pr_devel("%s:%d: kexec_kimage_head:        %lx\n", __func__, __LINE__,
+		arm64_kexec_kimage_head);
+	pr_devel("%s:%d: kexec_kimage_start:       %lx\n", __func__, __LINE__,
+		arm64_kexec_kimage_start);
+
 	/*
 	 * Copy relocate_new_kernel to the reboot_code_buffer for use
 	 * after the kernel is shut down.
-- 
1.9.1

  reply	other threads:[~2014-11-14 21:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14  1:22 [PATCH 0/8] arm64 kexec kernel patches V6 Geoff Levand
2014-11-14  1:22 ` [PATCH 1/8] arm64: Convert hcalls to use ISS field Geoff Levand
2014-11-14  1:22 ` [PATCH 2/8] arm64: Add new hcall HVC_CALL_FUNC Geoff Levand
2014-11-14  1:22 ` [PATCH 8/8] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2014-11-14  1:22 ` [PATCH 4/8] arm64: Move proc-macros.S to include/asm Geoff Levand
2014-11-14  1:22 ` [PATCH 5/8] arm64/kexec: Add core kexec support Geoff Levand
2014-11-14  1:22 ` [PATCH 7/8] arm64/kexec: Add checks for KVM and EFI Geoff Levand
2014-11-14 14:42   ` Sergei Shtylyov
2014-11-14 18:28     ` [PATCH v2 " Geoff Levand
2014-11-14 18:40       ` Sergei Shtylyov
2014-11-14 21:08   ` [PATCH v3 " Geoff Levand
2014-11-14  1:22 ` [PATCH 6/8] arm64/kexec: Add pr_devel output Geoff Levand
2014-11-14 21:12   ` Geoff Levand [this message]
2014-11-14  1:22 ` [PATCH 3/8] arm64: Add EL2 switch to soft_restart Geoff Levand
2014-11-27  6:19 ` [PATCH 0/8] arm64 kexec kernel patches V6 Dave Young
2014-11-28  6:56   ` Dave Young
2014-12-02 20:26     ` Geoff Levand
2014-12-02 20:22   ` Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415999557.15847.125.camel@smoke \
    --to=geoff@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox