From patchwork Thu Oct 3 20:32:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Lynch X-Patchwork-Id: 280421 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8F5E22C00D0 for ; Fri, 4 Oct 2013 06:38:08 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRpel-0007Dq-9x; Thu, 03 Oct 2013 20:37:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRpZs-000848-UC; Thu, 03 Oct 2013 20:32:52 +0000 Received: from relay1.mentorg.com ([192.94.38.131]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRpZq-00082y-0M for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2013 20:32:50 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VRpZQ-0004ht-Pf from Nathan_Lynch@mentor.com ; Thu, 03 Oct 2013 13:32:24 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 3 Oct 2013 13:32:24 -0700 Received: from localhost.mentorg.com ([172.30.5.214]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Oct 2013 13:32:24 -0700 From: Nathan Lynch To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] imx6q: fix emergency restart Date: Thu, 3 Oct 2013 15:32:17 -0500 Message-Id: <1380832337-4637-1-git-send-email-nathan_lynch@mentor.com> X-Mailer: git-send-email 1.8.3.1 X-OriginalArrivalTime: 03 Oct 2013 20:32:24.0119 (UTC) FILETIME=[AAE66470:01CEC077] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131003_163250_108099_8EE0BD94 X-CRM114-Status: GOOD ( 13.15 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: shawn.guo@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Emergency restart (e.g. sysrq-b) BUGs and panics on i.MX6Q SABRE Lite: kernel BUG at mm/vmalloc.c:1305! Internal error: Oops - BUG: 0 [#1] SMP ARM CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.12.0-rc3-00059-g522d6d3-dirty #29 task: c0cf15d8 ti: c0ce6000 task.ti: c0ce6000 PC is at __get_vm_area_node.isra.36+0xe8/0xf8 LR is at get_vm_area_caller+0x40/0x48 pc : [] lr : [] psr: 20000193 sp : c0ce7db8 ip : c0ce6000 fp : 00004000 r10: c0cf2ab0 r9 : 020bc000 r8 : f0000000 r7 : 00000001 r6 : 000000d0 r5 : 00000001 r4 : c0ce7db8 r3 : 00010000 r2 : 00000001 r1 : 00000001 r0 : 00004000 Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 3eec404a DAC: 00000015 Process swapper/0 (pid: 0, stack limit = 0xc0ce6240) ... [] (__get_vm_area_node.isra.36+0xe8/0xf8) from [] (get_vm_area_caller+0x40/0x48) [] (get_vm_area_caller+0x40/0x48) from [] (__arm_ioremap_pfn_caller+0x118/0x198) [] (__arm_ioremap_pfn_caller+0x118/0x198) from [] (__arm_ioremap_caller+0x54/0x5c) [] (__arm_ioremap_caller+0x54/0x5c) from [] (__arm_ioremap+0x18/0x1c) [] (__arm_ioremap+0x18/0x1c) from [] (of_iomap+0x2c/0x34) [] (of_iomap+0x2c/0x34) from [] (imx6q_restart+0x24/0xa4) [] (imx6q_restart+0x24/0xa4) from [] (machine_restart+0x38/0x68) [] (machine_restart+0x38/0x68) from [] (__handle_sysrq+0xb0/0x17c) [] (__handle_sysrq+0xb0/0x17c) from [] (imx_rxint+0x1f4/0x264) [] (imx_rxint+0x1f4/0x264) from [] (imx_int+0x114/0x184) [] (imx_int+0x114/0x184) from [] (handle_irq_event_percpu+0x54/0x194) [] (handle_irq_event_percpu+0x54/0x194) from [] (handle_irq_event+0x44/0x64) [] (handle_irq_event+0x44/0x64) from [] (handle_fasteoi_irq+0x80/0x148) [] (handle_fasteoi_irq+0x80/0x148) from [] (generic_handle_irq+0x20/0x30) [] (generic_handle_irq+0x20/0x30) from [] (handle_IRQ+0x40/0x90) [] (handle_IRQ+0x40/0x90) from [] (gic_handle_irq+0x2c/0x5c) [] (gic_handle_irq+0x2c/0x5c) from [] (__irq_svc+0x40/0x50) Exception stack(0xc0ce7f78 to 0xc0ce7fc0) 7f60: c181f858 00000000 7f80: 00001760 c0019b60 c0ce6000 c0d799d5 c0cee480 c04a65f4 00000001 c0cee408 7fa0: c0d799d5 00000000 00000000 c0ce7fc0 c000f7ac c000f7b0 60000013 ffffffff [] (__irq_svc+0x40/0x50) from [] (arch_cpu_idle+0x38/0x3c) [] (arch_cpu_idle+0x38/0x3c) from [] (cpu_startup_entry+0x6c/0x134) [] (cpu_startup_entry+0x6c/0x134) from [] (start_kernel+0x328/0x334) Code: e1a07713 eaffffd7 e3a04000 eafffff1 (e7f001f2) ---[ end trace 532bdf165bd117ce ]--- Kernel panic - not syncing: Fatal exception in interrupt Mapping the watchdog via of_iomap() in imx6q_restart() is okay during normal shutdown, but this code runs in interrupt context in response to sysrq-b, which triggers the BUG_ON in __get_vm_area_node(). Fix this by mapping the watchdog in imx6q_init_machine() and caching the pointer for use by imx6q_restart(). Signed-off-by: Nathan Lynch --- arch/arm/mach-imx/mach-imx6q.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 90372a2..e16b723 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -41,6 +41,7 @@ #include "hardware.h" static u32 chip_revision; +static void __iomem *wdog_base; int imx6q_revision(void) { @@ -70,11 +71,6 @@ static void __init imx6q_init_revision(void) static void imx6q_restart(enum reboot_mode mode, const char *cmd) { - struct device_node *np; - void __iomem *wdog_base; - - np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt"); - wdog_base = of_iomap(np, 0); if (!wdog_base) goto soft; @@ -192,8 +188,15 @@ static void __init imx6q_1588_init(void) static void __init imx6q_init_machine(void) { + struct device_node *np; + imx6q_enet_phy_init(); + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt"); + if (np) + wdog_base = of_iomap(np, 0); + pr_info("%s: wdog_base = %p\n", __func__, wdog_base); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); imx_anatop_init();