From patchwork Thu Aug 8 06:16:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Kilari X-Patchwork-Id: 2840769 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7A8EB9F487 for ; Thu, 8 Aug 2013 06:16:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79A67202CF for ; Thu, 8 Aug 2013 06:16:34 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EAE6202CA for ; Thu, 8 Aug 2013 06:16:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7JWQ-0002X3-GI; Thu, 08 Aug 2013 06:16:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7JWO-0007OB-Ac; Thu, 08 Aug 2013 06:16:28 +0000 Received: from mail-ie0-x230.google.com ([2607:f8b0:4001:c03::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7JWL-0007Nk-57 for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 06:16:26 +0000 Received: by mail-ie0-f176.google.com with SMTP id 9so1190376iec.21 for ; Wed, 07 Aug 2013 23:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Y0SITfEPSJky6RX2lDG3Z89XXXT6Y5dq662vs39PeqQ=; b=Pxbm2bvtBq8kqPNlTQRBgTxALBly9ucgzsTYfoNSYAyUFdRXQqzHJLq044LhHFNgJ2 f66LX8qk6Blcv2T38+4cKbGLToUIdiPwd5y7ccZ3Mp6wrXlitUwFqAB1berYYKArDCJ1 oazHG0t1f7ceRneyuanp37CUB3oRq4ntnzlKOa2INWb3pV+g3Wd9IxASyxx0LaxxmF6D 3JW0UWbHRLI1dsTyTtNBq6CF1kbGjkUEatpBD6faheiz3D1V8BWd+kkgtgBBc/sao5ZJ SalsfWFz7VcoH78KQ1Di8RXB34VQmWEonz9xq7dL8JmGZRjvM2k05bzvfgC0LZwLjJ7v TKAA== MIME-Version: 1.0 X-Received: by 10.50.25.129 with SMTP id c1mr1435500igg.23.1375942563825; Wed, 07 Aug 2013 23:16:03 -0700 (PDT) Received: by 10.64.48.101 with HTTP; Wed, 7 Aug 2013 23:16:03 -0700 (PDT) In-Reply-To: <51FFC490.5090907@codethink.co.uk> References: <51FFC490.5090907@codethink.co.uk> Date: Thu, 8 Aug 2013 11:46:03 +0530 Message-ID: Subject: Re: Kexec: BE kernel on ARM VE TC2 From: Vijay Kilari To: Ben Dooks X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130808_021625_277482_A36441B6 X-CRM114-Status: GOOD ( 21.37 ) X-Spam-Score: -2.0 (--) Cc: Will Deacon , "linux@arm.linux.org.uk" , Russell King , "linux-arm-kernel@lists.infradead.org" , Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 On Mon, Aug 5, 2013 at 8:58 PM, Ben Dooks wrote: > On 05/08/13 13:12, Vijay Kilari wrote: >> >> Hi Will, >> >> I am trying to make kexec work on BE kernel on ARM VE TC2. >> >> First, to make KEXEC work with SMP on ARM VE TC2 board, >> I set nr_cpus=2 (i.e boot only A15's) this works with LE kernel. >> >> However, I made below changes to make KEXEC work for BE kernel. >> my question is: why delay is required for board to reboot with kexec?. >> Is it platform issue?. >> >> diff --git a/arch/arm/kernel /machine_kexec.c >> b/arch/arm/kernel/machine_kexec.c >> index 4fb074c..0fb0ff9 100644 >> --- a/arch/arm/kernel/machine_kexec.c >> +++ b/arch/arm/kernel/machine_kexec.c >> @@ -123,6 +123,18 @@ void machine_crash_shutdown(struct pt_regs *regs) >> printk(KERN_INFO "Loading crashdump kernel...\n"); >> } >> >> +static void byte_copy_relocate_kernel(void *dst, const void *src, int >> size) >> +{ >> + char *d, *s; >> + d = (char *) dst; >> + s = (char *) src; >> + while (size> 0) >> + { >> + *d++ = *s++; >> + size--; >> + } >> +} >> + >> /* >> * Function pointer to optional machine-specific reinitialization >> */ >> @@ -155,9 +167,8 @@ void machine_kexec(struct kimage *image) >> >> >> /* copy our kernel relocation code to the control code page */ >> - memcpy(reboot_code_buffer, >> - relocate_new_kernel, relocate_new_kernel_size); >> - >> + byte_copy_relocate_kernel(reboot_code_buffer, >> + relocate_new_kernel, relocate_new_kernel_size); > > > you should be able to use memcpy() here, as it shouldn't change the > endian-ness of the data being copied. > Yes, you are right. I see that memcpy() works. However I see strange issue with Kexec on BE kernel. If I put debug print in arch/arm/kernel/head.S code before turning on MMU, KEXEC works. if I remove the debug print kexec boot hangs. So I could not relate how calling printascii is solving the problem Any suggestion? If printascii is called after turning on mmu, kexec hangs. Below is my debug code > -- > Ben Dooks http://www.codethink.co.uk/ > Senior Engineer Codethink - Providing Genius diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 5b391a6..15d4504 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S @@ -175,6 +175,15 @@ __lookup_processor_type_data: .long __proc_info_end .size __lookup_processor_type_data, . - __lookup_processor_type_data +__print_debug: + stmfd sp!, {r0 - r6, r9, lr} + adr r0, str_p3 + bl printascii + ldmfd sp!, {r0 - r6, r9, pc} +str_p3: .asciz "\nHere" + .align +ENDPROC(__print_debug) + __error_p: #ifdef CONFIG_DEBUG_LL adr r0, str_p1 diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index d509995..a19147c 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -114,7 +114,7 @@ ENTRY(stext) #else ldr r8, =PHYS_OFFSET @ always constant in this case #endif - + bl __print_debug /* * r1 = machine no, r2 = atags or dtb, * r8 = phys_offset, r9 = cpuid, r10 = procinfo