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: 161223 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5259420jan; Tue, 26 Mar 2019 07:04:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoTdkbTfsVO74mvpScFCDrs8OtrQJiDWStAikJpSBSqlmqLjCwXTrfEmB42XYxP5Rh9gl9 X-Received: by 2002:a63:408:: with SMTP id 8mr23558938pge.334.1553609047753; Tue, 26 Mar 2019 07:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553609047; cv=none; d=google.com; s=arc-20160816; b=U2njlyF0fS/owx3UoT3Vtz9EINtyQb55mUx9dPuTzd9lw02vhkV6pPcv4OndRakVUn lrxg6Nr06L1oGTb26tLo5Elwk+uN6QIYIw9LPu0al0aPrirUHll6G+oZwpNsts4/Foqz 0UHFn/jgw282ks4dvs/khZnZizDGQHzWsqDzox0N+jVi+oaRVOvo6y82ykX+XzlqMagQ c6Zk7KU2yFU7VHQo+dF4i28rvzJkt0/e8I7sbwLkEpTxu4po0WelfGtn8JugO3ULglCl EgKmbouYixgYPaGITshC9FDDkagwMjgRWIR4YJeyCXq1IHnfOLFGkD4wnSR48IOEWEu1 E8/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=lwzhTs/ZuYSnLSHhEEcnyMIqd4q9U5GBPaPxKHsOYWM=; b=j/MWXK6H9R5W1/Q5ZugEny9VYWw0fzU8iHfVaz8kxVYb3e3yZErHil98QA67PgQY1E 36takGqqYvdJmu4vK28Fqrvdw/SD8SR8MU0ZZmbI4/1dhntvofcfnoGMPZvRRMC28YFV Q355hCnRnRDfTtQQe9H3/U6FZdpyy1pZwVawZSc+Fd0hvicDBVjyyh5L+H3LSP6Gwa1F qlUY3ACQYv3RtoEOQAQqGcVLJhuEQCG79Hv1OnmxVBHeP70nlZ4stQ7nY/1vgkVnByYb vK8S0wjw9Pn8rWOZOj76iUJTG4YAUT6G3DtTFWXX94x1fdNOQ6rTeiAkYE0DDO6biJb+ rv4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=t20qunFb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si15186786pgr.112.2019.03.26.07.04.07; Tue, 26 Mar 2019 07:04:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=t20qunFb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731374AbfCZOEH (ORCPT + 3 others); 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 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(-) -- 2.17.1 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));