From patchwork Fri Mar 22 11:48:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 160890 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp780122jan; Fri, 22 Mar 2019 05:56:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCcsM87kH69AMc79jQ/+qKHfZFyMLB2OW94pQ92ta94xbQ9fnfHiov0DvXpNbqCVgiYrTD X-Received: by 2002:a63:4383:: with SMTP id q125mr8236693pga.370.1553259411140; Fri, 22 Mar 2019 05:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259411; cv=none; d=google.com; s=arc-20160816; b=HKHUXSh0Fpe0FPHYIGu57f8HFMBb7FhHIqIzqtnJPmnjQ6cnhPu2R2nEYfKx8FWFfG kORuvs0107rNR03J/gnov9hIZOD6yM5fC4Vxi7l2ff+SV8Pku48WoPrl2HUACTW2UkAY 1oL3HphcdH6++d4acQ+j8GAAQFhVGYNZMUl9GEGFDY1SPBqgm2EofgqpOgKT9MksZVX7 Fdv++F1sXv98XvD8Ul4KlKwG08qp3qvD3fazsdAR8L4iNjontUjfni+3nzmXdpbHpTTb uH71eAt6G01672lMnCTPvWtep28zNXhMsaqKXqewY/K23pkKAHMBbV+0W/e5cnnU0KKu az7A== 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:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=cgIGtXARntSbIVJbyqMEgOABYwp4NPWddeKDz7YfvEI=; b=N8JDZw3vgfDegwlt7LOG04+LYsv4+vXw+rvi2rgrxulFJrMemi4bdd0ZM799Di5s3L vdD7nKAI/iXDUQds45neJ35npVFfzVzqzrG2K306lq5FO73h5+ddhYQsvozJuQk9I+w5 RmEgxTGrOMt78fIJmlaxRB7heCUPD+ggnosmPabyR01bLFWah/Uw2eE+NwPIxNWsWZPb SlEjOvhJHYd9nbewYhA40hWoM6+2DhUF3Jo1nMvyRLCKLTtmzgmHvLnyR/+IwLPFcs/o o00mSIe03zZ367q4T3rrj3rswM2Z/ngeLAlY+2Dnn9VYfX88hWOqIXZkHLE9ivNkmP4T PWpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=epTOyPJY; 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 b13si5301036pgl.331.2019.03.22.05.56.50; Fri, 22 Mar 2019 05:56:51 -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=epTOyPJY; 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 S1731629AbfCVM4u (ORCPT + 3 others); Fri, 22 Mar 2019 08:56:50 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51575 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732040AbfCVLsr (ORCPT ); Fri, 22 Mar 2019 07:48:47 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190322114846euoutp012206d8e096eb79bf29693aff9e416497~ORX1mmx2n2784327843euoutp01Z; Fri, 22 Mar 2019 11:48:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190322114846euoutp012206d8e096eb79bf29693aff9e416497~ORX1mmx2n2784327843euoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553255326; bh=cgIGtXARntSbIVJbyqMEgOABYwp4NPWddeKDz7YfvEI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=epTOyPJYxBvOSStN+24CYxoLDixUWfnkSWgqw2ml3JHN6Xnz1mICaEnOiHbaeiM7F 5qAwYMAhPZQNNkM9491/Qu5ekom1Mu3TlXCa+onFnLHVAsmG90G+zWE090QbZ3Wo7O aovkt9RKTSrVKneoZ58W6kn9wvnJUKxcESOL+yHE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190322114845eucas1p1a9cce7d22637fb4d1ee8c520d6b3e09b~ORX1O7Glr0330203302eucas1p1Q; Fri, 22 Mar 2019 11:48:45 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 62.4E.04441.D9BC49C5; Fri, 22 Mar 2019 11:48:45 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190322114845eucas1p11a8303a61da33992cd0590291770b2c6~ORX0evLvg2278522785eucas1p1b; Fri, 22 Mar 2019 11:48:45 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-83-5c94cb9d484f Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 91.76.04128.D9BC49C5; Fri, 22 Mar 2019 11:48:45 +0000 (GMT) Received: from AMDC2765.digital.local ([106.120.51.73]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POR007ESNH2J220@eusync3.samsung.com>; Fri, 22 Mar 2019 11:48:45 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 3/3] ARM: exynos: Fix infinite loops on CPU powerup failure Date: Fri, 22 Mar 2019 12:48:33 +0100 Message-id: <20190322114833.12686-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190322114833.12686-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeLIzCtJLcpLzFFi42LZduznOd25p6fEGOxYrm6xccZ6Vovz5zew W8w4v4/JYu2Ru+wOLB6bVnWyefRtWcXo8XmTXABzFJdNSmpOZllqkb5dAlfGmt6ogj0CFZu2 FzYw9vF2MXJySAiYSBx8eYIJxBYSWMEosfuHcBcjF5D9mVHiWMd2FpiizbeeM0IkljFK3O5Y zw7h/GeU2NS/jhmkik3AUKLrbRcbiC0ioCrxuW0BWBGzQB+jxPW9c8GKhAW8JVY+2Q02lgWo qOP2e7AGXgFbideL7rBBrJOXWL3hAFg9p4CdxPaNB9hABkkI3GWV2DV1KdRNLhJ/v35kh7Bl JC5P7maBKGpmlHh4bi07hNPDKHG5aQYjRJW1xOHjF1lBbGYBPolJ26YDreAAivNKdLQJQZR4 SEy7MAfq0YlAj955zzSBUWIBI8MqRvHU0uLc9NRiw7zUcr3ixNzi0rx0veT83E2MwLg5/e/4 px2MXy8lHWIU4GBU4uHV6J0cI8SaWFZcmXuIUYKDWUmEd1c0UIg3JbGyKrUoP76oNCe1+BCj NAeLkjhvNcODaCGB9MSS1OzU1ILUIpgsEwenFDCqWg60t3McKctlb3jftmdOZmi6gLhesdHz n3k3aj9eelaatOXBqi0XfFv+cdyJ/Xj+lVufYJH2zvfHvVRF5/ZE3P5cuICJI29+3h21JzdX 7bHKnvTH9PqWl56cK0Ujxdza1kb/kdkdWbLVPdcsfrJPhvsqwVtTplfoHdtS0/osNkRs35tq vWNKLMUZiYZazEXFiQB1RARclwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLJMWRmVeSWpSXmKPExsVy+t/xq7pzT0+JMdg4mcti44z1rBbnz29g t5hxfh+Txdojd9kdWDw2repk8+jbsorR4/MmuQDmKC6blNSczLLUIn27BK6MNb1RBXsEKjZt L2xg7OPtYuTkkBAwkdh86zljFyMXh5DAEkaJKz8/MEE4jUwS/zecZAOpYhMwlOh62wVmiwio SnxuW8AOUsQsMIFRYvXCWawgCWEBb4mVT3azgNgsQEUdt9+DNfAK2Eq8XnSHDWKdvMTqDQeY QWxOATuJ7RsPgMWFgGoe7VzMOoGRZwEjwypGkdTS4tz03GIjveLE3OLSvHS95PzcTYzAQNh2 7OeWHYxd74IPMQpwMCrx8J5onhwjxJpYVlyZe4hRgoNZSYR3VzRQiDclsbIqtSg/vqg0J7X4 EKM0B4uSOO95g8ooIYH0xJLU7NTUgtQimCwTB6dUA2PXxan6hvt2//nUfLu3ddfPN/s3Jsaa FB8/xHTFlDkuJt3d71rtobNCM94arBf/9JVb7WJZSdjsty3Lm+fNKyu1aZNz3W1z5tmmnS88 PrGbFW/VKpLpVEyvbLBbEnPiSrnYFME2vwteS6q+ZpWe4M1/t++nhPjJszqFtmFn+tYnn2aW XdD/drESS3FGoqEWc1FxIgB0pb55AAIAAA== X-CMS-MailID: 20190322114845eucas1p11a8303a61da33992cd0590291770b2c6 CMS-TYPE: 201P X-CMS-RootMailID: 20190322114845eucas1p11a8303a61da33992cd0590291770b2c6 References: <20190322114833.12686-1-m.szyprowski@samsung.com> 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 | 11 ++++++++++- arch/arm/mach-exynos/platsmp.c | 9 ++++++++- 2 files changed, 18 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..43d6f7755842 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -75,14 +75,23 @@ 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 %d cluster %d powerup failed\n", + cpu, cluster); + 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 d5d48fbdab17..c01e2f7ba1ec 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 (!soc_is_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 %d restart failed\n", core_id); + return; + } udelay(10); val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));