]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ARM: exynos: Fix infinite loops on CPU powerup failure
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 26 Mar 2019 14:03:59 +0000 (15:03 +0100)
committerKrzysztof Kozlowski <krzk@kernel.org>
Tue, 9 Apr 2019 13:07:33 +0000 (15:07 +0200)
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 <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
arch/arm/mach-exynos/mcpm-exynos.c
arch/arm/mach-exynos/platsmp.c

index 72bc035bedbe2702b08a866f1bfc5973a48e9879..9a681b421ae119887dc8abf90de2cf889489b389 100644 (file)
@@ -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);
index abcac616423319bf0634bce260a85c3fe9134b60..0cbbae8bf1f85ef4dcf4dc245c12760fdd0c4e6a 100644 (file)
@@ -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));