From patchwork Tue Mar 26 14:03:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10871229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60BE3922 for ; Tue, 26 Mar 2019 14:04:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D1BE28EC1 for ; Tue, 26 Mar 2019 14:04:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4117728F7C; Tue, 26 Mar 2019 14:04:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A16828ED4 for ; Tue, 26 Mar 2019 14:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731374AbfCZOEH (ORCPT ); Tue, 26 Mar 2019 10:04:07 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:44831 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfCZOEG (ORCPT ); Tue, 26 Mar 2019 10:04:06 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190326140405euoutp0159e1217c02635b9df9cc7c5e316565ca~PhzIBarm52462424624euoutp01p; Tue, 26 Mar 2019 14:04:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190326140405euoutp0159e1217c02635b9df9cc7c5e316565ca~PhzIBarm52462424624euoutp01p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553609045; bh=lwzhTs/ZuYSnLSHhEEcnyMIqd4q9U5GBPaPxKHsOYWM=; h=From:To:Cc:Subject:Date:References:From; b=t20qunFbofFCD547gYTQnvku1uuLAGLVO8Ny7ASo6TD1EyWfNUFL083/OmLIkBPo4 UKzBrgDhorhzIJWEl778ebzH+M006t/qqASTsJl+sEfIDPt3A82gbTeKLAAGsaGocH hPqG8fu3vRq7efA8q9UqqQm1G9NaAY8x88icU4PM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190326140404eucas1p2771e0ba7ba1d1d337a813e2026921dd3~PhzHqC7D-2107521075eucas1p2G; Tue, 26 Mar 2019 14:04:04 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 12.84.04298.4513A9C5; Tue, 26 Mar 2019 14:04:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190326140404eucas1p149c869800bd0d8d85b7623bd6c3716f9~PhzG5bNYK2962529625eucas1p1j; Tue, 26 Mar 2019 14:04:04 +0000 (GMT) X-AuditID: cbfec7f2-f2dff700000010ca-9e-5c9a3154cfdf Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E8.F2.04140.3513A9C5; Tue, 26 Mar 2019 14:04:03 +0000 (GMT) Received: from AMDC2765.DIGITAL.local ([106.120.51.73]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POZ00L9K8EOS240@eusync4.samsung.com>; Tue, 26 Mar 2019 14:04:03 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v2] ARM: exynos: Fix infinite loops on CPU powerup failure Date: Tue, 26 Mar 2019 15:03:59 +0100 Message-id: <20190326140359.4927-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRmVeSWpSXmKPExsWy7djPc7ohhrNiDFp+qFlsnLGe1eL8+Q3s FjPO72OyWHvkLrsDi8emVZ1sHn1bVjF6fN4kF8AcxWWTkpqTWZZapG+XwJUxYflB1oIGwYrH W84zNTCe4u1i5OSQEDCRuLiyj6mLkYtDSGAFo8SuI5eZQRJCAp8ZJSbMcoEpWvp0GgtE0TJG iVl7DzBCOP8ZJXY0b2MFqWITMJToetvFBmKLCKhKfG5bwA5SxCzQxyhxfe9coLEcHMICXhIn P0WB1LAA1Vz5soAFxOYVsJFYdb+DGWKbvMTqDQeYQXolBE6ySiw+NIMRIuEi0XpzNhuELSNx eXI3C0RRM6PEw3Nr2SGcHkaJy00wHdYSh49fBDuPWYBPYtK26WBXSAjwSnS0CUGUeEhsvrKM HeLnWIkz31vZJzCKL2BkWMUonlpanJueWmyYl1quV5yYW1yal66XnJ+7iREYH6f/Hf+0g/Hr paRDjAIcjEo8vB7Ss2KEWBPLiitzDzFKcDArifA+EZ0RI8SbklhZlVqUH19UmpNafIhRmoNF SZy3muFBtJBAemJJanZqakFqEUyWiYNTqoGxIf580vEln6Yl+87R7Xzv9+ZH8MVZFct+7eP0 LIg4tu/eX9m9F863vDeK4gn+Jp8eKLp+eVL89bI9WxjkIr98nbbgjfWeeOZ3XLwPPaz7t1p0 2RyvErdh1VjeudSPQ+z9nzBVz+Aunum/lRbw8k15V/A1K+lp58zfb1eduTDJdlvuwXuvHYKZ lFiKMxINtZiLihMBz9CCFYsCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGJMWRmVeSWpSXmKPExsVy+t/xa7rBhrNiDH4uNLLYOGM9q8X58xvY LWac38dksfbIXXYHFo9NqzrZPPq2rGL0+LxJLoA5issmJTUnsyy1SN8ugStjwvKDrAUNghWP t5xnamA8xdvFyMkhIWAisfTpNJYuRi4OIYEljBLPJ/ayQjiNTBJPlv9jBqliEzCU6HrbxQZi iwioSnxuW8AOUsQsMIFRYvXCWUAdHBzCAl4SJz9FgdSwANVc+bKABcTmFbCRWHW/gxlim7zE 6g0HmCcwci1gZFjFKJJaWpybnltspFecmFtcmpeul5yfu4kR6Nttx35u2cHY9S74EKMAB6MS D6+H9KwYIdbEsuLK3EOMEhzMSiK8T0RnxAjxpiRWVqUW5ccXleakFh9ilOZgURLnPW9QGSUk kJ5YkpqdmlqQWgSTZeLglGpgvHJ3Vmdt88WJ4bOTN0pdd7/eouWwrdts6WeFvNIpK32MNQt/ 3tzW/mTZfLtp8QFcr+eJLUpmeakxqbqQ/Wt1RO3FgDXZa85NkHNff73f5sf2hTlzc0R5dntP LVyjdXR1ZK133p9pPLv0j8k5n93wfF1XwHZpD+24LQ6BD7gdlb/y1j7q7nPvVWIpzkg01GIu Kk4EABMq6uTpAQAA X-CMS-MailID: 20190326140404eucas1p149c869800bd0d8d85b7623bd6c3716f9 CMS-TYPE: 201P X-CMS-RootMailID: 20190326140404eucas1p149c869800bd0d8d85b7623bd6c3716f9 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add timeout to infinite loops during the CPU powerup procedures. It is better to report an error instead of busylooping for infinite time in case of failure. Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/mcpm-exynos.c | 13 ++++++++++++- arch/arm/mach-exynos/platsmp.c | 9 ++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 72bc035bedbe..9a681b421ae1 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -75,14 +75,25 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster) */ if (cluster && cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) { + unsigned int timeout = 16; + /* * Before we reset the Little cores, we should wait * the SPARE2 register is set to 1 because the init * codes of the iROM will set the register after * initialization. */ - while (!pmu_raw_readl(S5P_PMU_SPARE2)) + while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) { + timeout--; udelay(10); + } + + if (timeout == 0) { + pr_err("cpu %u cluster %u powerup failed\n", + cpu, cluster); + exynos_cpu_power_down(cpunr); + return -ETIMEDOUT; + } pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu), EXYNOS_SWRESET); diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index abcac6164233..0cbbae8bf1f8 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -214,13 +214,20 @@ static inline void __iomem *cpu_boot_reg(int cpu) */ void exynos_core_restart(u32 core_id) { + unsigned int timeout = 16; u32 val; if (!of_machine_is_compatible("samsung,exynos3250")) return; - while (!pmu_raw_readl(S5P_PMU_SPARE2)) + while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) { + timeout--; udelay(10); + } + if (timeout == 0) { + pr_err("cpu core %u restart failed\n", core_id); + return; + } udelay(10); val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));