From patchwork Wed Aug 8 10:53:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 1294471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A19C7DF223 for ; Wed, 8 Aug 2012 10:59:19 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sz3wa-0002xQ-DK; Wed, 08 Aug 2012 10:56:52 +0000 Received: from smtp2-v.fe.bosch.de ([139.15.237.6]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sz3wO-0002rN-JV for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2012 10:56:42 +0000 Received: from vsmta11.fe.internet.bosch.com (unknown [10.4.98.30]) by imta24.fe.bosch.de (Postfix) with ESMTP id 03009B001FF; Wed, 8 Aug 2012 12:56:37 +0200 (CEST) Received: from localhost (vsgw3.fe.internet.bosch.com [10.4.98.16]) by vsmta11.fe.internet.bosch.com (Postfix) with SMTP id E7EDF43C0479; Wed, 8 Aug 2012 12:56:36 +0200 (CEST) Received: from FE-HUB1001.de.bosch.com (10.4.103.109) by si-hub05.de.bosch.com (10.3.153.47) with Microsoft SMTP Server (TLS) id 8.3.264.0; Wed, 8 Aug 2012 12:56:34 +0200 Received: from [10.34.217.145] (10.34.217.145) by FE-HUB1001.de.bosch.com (10.4.103.109) with Microsoft SMTP Server id 14.2.309.2; Wed, 8 Aug 2012 12:56:34 +0200 Message-ID: <50224547.9020000@de.bosch.com> Date: Wed, 8 Aug 2012 12:53:59 +0200 From: Dirk Behme Organization: Robert Bosch Car Multimedia GmbH User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: "linux-arm-kernel@lists.infradead.org" Subject: Re: imx6q restart is broken References: <20120808101817.GA14718@S2101-09.ap.freescale.net> In-Reply-To: <20120808101817.GA14718@S2101-09.ap.freescale.net> X-Originating-IP: [10.34.217.145] X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [139.15.237.6 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Shawn Guo , Russell King - ARM Linux X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 08.08.2012 12:18, Shawn Guo wrote: > Thanks Dirk for reporting that imx6q restart (reboot command) is broken. > > I tracked down the issue a little bit and found imx6q_restart hangs > on the of_iomap/ioremap call. The following change, moving the call > somewhere else than imx6q_restart, will just fix the problem. > > Does that mean ioremap call is not allowed in platform restart hook? > I'm not sure about that, because I found it works just fine if I build > imx_v6_v7_defconfig with V6 (imx3) platforms excluded (IOW, build a V7 > only kernel - imx5 and imx6), which is the case how I tested imx6q > restart feature when I was adding it. > > To summarize, the imx6q_restart hangs at ioremap call on a V6 + V7 > kernel, while it works fine on a V7 only image. I need some help to > understand that. Some additional information from my debugging: a) Having a JTAG debugger attached to the i.MX6 SabreLite board I use (kernel built with imx_v6_v7_defconfig) the reboot does work. No hang. This does mean I can't debug the reboot hang with a JTAG debugger. Therefore I added some printk debugging: b) Adding some printk statements [1] in the of_iomap/ioremap call, it looks to me that the system hangs in of_iomap() -> ... -> set_pte_at() -> set_pte_ext() / cpu_v7_set_pte_ext() <= hang On our system, set_pte_ext() is translated to cpu_v7_set_pte_ext() in proc-v7-2level.S. As cpu_v7_set_pte_ext() is assembly, I can't add additional printk's, and JTAG doesn't work, so I don't have more details at the moment. From this it looks like that cpu_v7_set_pte_ext() hangs if called from within machine_restart() after machine_shutdown() was called (?). Best regards Dirk [1] To be able to add some printk's to set_pte_at() which is a inline function in pgtable.h, I copied this to ioremap.c: return 0; With this I get: # reboot -f Restarting system. => set_pte_debug #1 -- no further output, hang, 'set_pte_debug #2' missing > --8<--- > > diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c > index 5ec0608..01e7489 100644 > --- a/arch/arm/mach-imx/mach-imx6q.c > +++ b/arch/arm/mach-imx/mach-imx6q.c > @@ -37,14 +37,10 @@ > #include > #include > > +static void __iomem *wdog_base; > > void imx6q_restart(char 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; > > @@ -159,6 +155,11 @@ static void __init imx6q_usb_init(void) > > static void __init imx6q_init_machine(void) > { > + struct device_node *np; > + > + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt"); > + wdog_base = of_iomap(np, 0); > + > /* > * This should be removed when all imx6q boards have pinctrl > * states for devices defined in device tree. --- a/lib/ioremap.c +++ b/lib/ioremap.c @@ -13,6 +13,19 @@ #include #include +void set_pte_debug(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pteval) +{ + if (addr >= TASK_SIZE) { + printk("=> set_pte_debug #1\n"); + set_pte_ext(ptep, pteval, 0); + printk("=> set_pte_debug #2\n"); + } else { + __sync_icache_dcache(pteval); + set_pte_ext(ptep, pteval, PTE_EXT_NG); + } +} + static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot) { @@ -25,7 +38,7 @@ static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, return -ENOMEM; do { BUG_ON(!pte_none(*pte)); - set_pte_at(&init_mm, addr, pte, pfn_pte(pfn, prot)); + set_pte_debug(&init_mm, addr, pte, pfn_pte(pfn, prot)); pfn++; } while (pte++, addr += PAGE_SIZE, addr != end);