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 BCB1C25CC40; Mon, 1 Dec 2025 11:33:56 +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=1764588836; cv=none; b=GscwXg0VF+PRwKQFFqnlVas2/oJd9+Ux1FmBExZs2mfrk7IYw9L+bAhV75XsWAcTVaXRg4bIvPoLm7PhHqsqWSR52UxXfei/D7dCpabSgEl/paH1aduL+Q8uy1Y1tq6S40THwJRV+zLQskHY9Lx9M6h1N4SrCDBCLzDphTpBXYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764588836; c=relaxed/simple; bh=a6glI3eI74LQEV1QaOwL4S+Xf94t8uMlDoBTBRDYMHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mfeiTE/agcpdJ5D/BluxQb6DW7b6ervG9e9iZlEHialKDBkwsQkovVd6f569pr3e9PIM60hEBvhZ7Snjbf2H1so5Pu9C6Re84Fuf9CwnuhyodQ0Xc8dAbOgArB72YSkmNw6Axy4CWkli3jHH/uEM6r1OXTdo8d02vXRPsaahnWI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZWM374Al; 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="ZWM374Al" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A622C4CEF1; Mon, 1 Dec 2025 11:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764588836; bh=a6glI3eI74LQEV1QaOwL4S+Xf94t8uMlDoBTBRDYMHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWM374Al8ucZkaoIpd/lOzyQk4p41OVzMqKy+KgDZwVxxAoSjj2lNc0zq6MQ9wOWE Q3ReowctAQ30OPqMyyr8LaIgpp/A+cm51kpg0hzQZ7oLKB95/DrRjLczuZsVkgHqGV +gqfL/F38jlTgtyM2oRTFB5eRPDw3JCQWtNMOC6U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Niravkumar L Rabara , "Borislav Petkov (AMD)" , Dinh Nguyen Subject: [PATCH 5.4 156/187] EDAC/altera: Handle OCRAM ECC enable after warm reset Date: Mon, 1 Dec 2025 12:24:24 +0100 Message-ID: <20251201112246.852036321@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201112241.242614045@linuxfoundation.org> References: <20251201112241.242614045@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Niravkumar L Rabara commit fd3ecda38fe0cb713d167b5477d25f6b350f0514 upstream. The OCRAM ECC is always enabled either by the BootROM or by the Secure Device Manager (SDM) during a power-on reset on SoCFPGA. However, during a warm reset, the OCRAM content is retained to preserve data, while the control and status registers are reset to their default values. As a result, ECC must be explicitly re-enabled after a warm reset. Fixes: 17e47dc6db4f ("EDAC/altera: Add Stratix10 OCRAM ECC support") Signed-off-by: Niravkumar L Rabara Signed-off-by: Borislav Petkov (AMD) Acked-by: Dinh Nguyen Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20251111080801.1279401-1-niravkumarlaxmidas.rabara@altera.com Signed-off-by: Greg Kroah-Hartman --- drivers/edac/altera_edac.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -1247,10 +1247,22 @@ altr_check_ocram_deps_init(struct altr_e if (ret) return ret; - /* Verify OCRAM has been initialized */ + /* + * Verify that OCRAM has been initialized. + * During a warm reset, OCRAM contents are retained, but the control + * and status registers are reset to their default values. Therefore, + * ECC must be explicitly re-enabled in the control register. + * Error condition: if INITCOMPLETEA is clear and ECC_EN is already set. + */ if (!ecc_test_bits(ALTR_A10_ECC_INITCOMPLETEA, - (base + ALTR_A10_ECC_INITSTAT_OFST))) - return -ENODEV; + (base + ALTR_A10_ECC_INITSTAT_OFST))) { + if (!ecc_test_bits(ALTR_A10_ECC_EN, + (base + ALTR_A10_ECC_CTRL_OFST))) + ecc_set_bits(ALTR_A10_ECC_EN, + (base + ALTR_A10_ECC_CTRL_OFST)); + else + return -ENODEV; + } /* Enable IRQ on Single Bit Error */ writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST));