From patchwork Fri Nov 14 21:12:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 5309461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB5CEC11AC for ; Fri, 14 Nov 2014 21:14:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1411F20131 for ; Fri, 14 Nov 2014 21:14:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2684B2012E for ; Fri, 14 Nov 2014 21:14:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpOAm-0007nP-Ln; Fri, 14 Nov 2014 21:12:52 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpOAd-0007b5-PD; Fri, 14 Nov 2014 21:12:43 +0000 Received: from 107-1-141-74-ip-static.hfc.comcastbusiness.net ([107.1.141.74] helo=[192.168.252.189]) by casper.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpOAa-0001hV-UT; Fri, 14 Nov 2014 21:12:41 +0000 Message-ID: <1415999557.15847.125.camel@smoke> Subject: [PATCH v2 6/8] arm64/kexec: Add pr_devel output From: Geoff Levand To: Catalin Marinas Date: Fri, 14 Nov 2014 13:12:37 -0800 In-Reply-To: <2b08174dd201077d4e7f6ec6c107650b22688723.1415926876.git.geoff@infradead.org> References: <2b08174dd201077d4e7f6ec6c107650b22688723.1415926876.git.geoff@infradead.org> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Cc: marc.zyngier@arm.com, kexec@lists.infradead.org, Will Deacon , linux-arm-kernel@lists.infradead.org, Grant Likely , christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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.