mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ARM: exynos: Fix infinite loops on CPU powerup failure
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>
This commit is contained in:
		
							parent
							
								
									629266bf72
								
							
						
					
					
						commit
						98a3308ea8
					
				
					 2 changed files with 20 additions and 2 deletions
				
			
		| 
						 | 
					@ -75,14 +75,25 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (cluster &&
 | 
							if (cluster &&
 | 
				
			||||||
		    cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
 | 
							    cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
 | 
				
			||||||
 | 
								unsigned int timeout = 16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * Before we reset the Little cores, we should wait
 | 
								 * Before we reset the Little cores, we should wait
 | 
				
			||||||
			 * the SPARE2 register is set to 1 because the init
 | 
								 * the SPARE2 register is set to 1 because the init
 | 
				
			||||||
			 * codes of the iROM will set the register after
 | 
								 * codes of the iROM will set the register after
 | 
				
			||||||
			 * initialization.
 | 
								 * initialization.
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			while (!pmu_raw_readl(S5P_PMU_SPARE2))
 | 
								while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) {
 | 
				
			||||||
 | 
									timeout--;
 | 
				
			||||||
				udelay(10);
 | 
									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),
 | 
								pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
 | 
				
			||||||
					EXYNOS_SWRESET);
 | 
										EXYNOS_SWRESET);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -214,13 +214,20 @@ static inline void __iomem *cpu_boot_reg(int cpu)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void exynos_core_restart(u32 core_id)
 | 
					void exynos_core_restart(u32 core_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						unsigned int timeout = 16;
 | 
				
			||||||
	u32 val;
 | 
						u32 val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!of_machine_is_compatible("samsung,exynos3250"))
 | 
						if (!of_machine_is_compatible("samsung,exynos3250"))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (!pmu_raw_readl(S5P_PMU_SPARE2))
 | 
						while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) {
 | 
				
			||||||
 | 
							timeout--;
 | 
				
			||||||
		udelay(10);
 | 
							udelay(10);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (timeout == 0) {
 | 
				
			||||||
 | 
							pr_err("cpu core %u restart failed\n", core_id);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	udelay(10);
 | 
						udelay(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
 | 
						val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue