From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1677334F48D; Tue, 26 Aug 2025 13:51:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216277; cv=none; b=i1h8LtP3sY8vgQR+iNvDzQ8di40lJ+5HROpC3facJTD3x2XE1QlrxXIH2fpgQF3PXoy24XhyO+kgnPhtJEoPtdAR9NzWFx962uuOBKhy6KNZ86tBIi9Hy20jiZ4r+6lD2Dff6vfhpEcAOYYJU4MuNtkeG3aZr84Yp4deVTNrNIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216277; c=relaxed/simple; bh=uYryhlWsEqysnaAi+AFpbKQPNVmBUTm460B3tCDSNiY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J67+u0blNqkJHFWsUrgX2wvsrs8EfnOekkGmdMiXaH5B9hg5611OnVo6FclyFd+eZuhKFdfcUj2xKDGFCvSTm3OqacUgIgC37S6U5xQue+5ICtesGb8uBHHVM4tE2hiOaRy6u32QtKZc7MAy/ipn/Fk5avHoBtQmWQnjbAJV0rE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xHVOCvPm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xHVOCvPm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40806C4CEF1; Tue, 26 Aug 2025 13:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756216276; bh=uYryhlWsEqysnaAi+AFpbKQPNVmBUTm460B3tCDSNiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xHVOCvPm8wtgzmnEXEwzH82ty18BMZRSiG5SQpPJckfusPu210a1Hqxj8fZFbIXxZ 9Yf1Z9zUqLIDjsITOvbHvKQMl7FLgLM3wBKUIVkqWeYbNoDixqaJ8uQy8rk5RDyXnr q0H3aDbSyJz5KVJ0UFOyAa1Dkck2pYhqAM57myqQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexander Kochetkov , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 304/644] ARM: rockchip: fix kernel hang during smp initialization Date: Tue, 26 Aug 2025 13:06:35 +0200 Message-ID: <20250826110953.916971011@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110946.507083938@linuxfoundation.org> References: <20250826110946.507083938@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Kochetkov [ Upstream commit 7cdb433bb44cdc87dc5260cdf15bf03cc1cd1814 ] In order to bring up secondary CPUs main CPU write trampoline code to SRAM. The trampoline code is written while secondary CPUs are powered on (at least that true for RK3188 CPU). Sometimes that leads to kernel hang. Probably because secondary CPU execute trampoline code while kernel doesn't expect. The patch moves SRAM initialization step to the point where all secondary CPUs are powered down. That fixes rarely hangs on RK3188: [ 0.091568] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.091996] rockchip_smp_prepare_cpus: ncores 4 Signed-off-by: Alexander Kochetkov Link: https://lore.kernel.org/r/20250703140453.1273027-1-al.kochet@gmail.com Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin --- arch/arm/mach-rockchip/platsmp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index d60856898d97..17aee4701e81 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -279,11 +279,6 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) } if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { - if (rockchip_smp_prepare_sram(node)) { - of_node_put(node); - return; - } - /* enable the SCU power domain */ pmu_set_power_domain(PMU_PWRDN_SCU, true); @@ -316,11 +311,19 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); ncores = ((l2ctlr >> 24) & 0x3) + 1; } - of_node_put(node); /* Make sure that all cores except the first are really off */ for (i = 1; i < ncores; i++) pmu_set_power_domain(0 + i, false); + + if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { + if (rockchip_smp_prepare_sram(node)) { + of_node_put(node); + return; + } + } + + of_node_put(node); } static void __init rk3036_smp_prepare_cpus(unsigned int max_cpus) -- 2.39.5