Skip to contentSkip to conversation

Stratix10 EDAC Improvements

PATCH Superseded [email protected] 2 participants 7 messages Jan 16, 2019 – Jan 17, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Stratix10 EDAC Improvements

From: Thor Thayer <[email protected]>

This patch series includes a fix, an improvement and the addition of OCRAM EDAC for Stratix10 SOCFPGA.

Thor Thayer (4):
EDAC, altera: Fix S10 persistent register offset EDAC, altera: Less Intrusive Error Injection EDAC, altera: Add Stratix10 OCRAM ECC support
arm64: dts: stratix10: Add OCRAM EDAC node

 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi |  7 +++
 drivers/edac/altera_edac.c                        | 52 ++++++++++++++---------
 drivers/edac/altera_edac.h                        |  6 +--
 3 files changed, 43 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 EDAC, altera: Fix S10 persistent register offset

From: Thor Thayer <[email protected]>

Correct the persistent register offset where address and status are stored.

Fixes 08f08bfb7b4c ("EDAC, altera: Merge Stratix10 into the Arria10 SDRAM

probe routine")

---
 drivers/edac/altera_edac.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/altera_edac.h +2 -2
index 4213cb0bb2a7..f8664bac9fa8 100644
@@ -295,8 +295,8 @@ struct altr_sdram_mc_data {
 #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST  0xA0
 
 /* Sticky registers for Uncorrected Errors */
-#define S10_SYSMGR_UE_VAL_OFST            0x120
-#define S10_SYSMGR_UE_ADDR_OFST           0x124
+#define S10_SYSMGR_UE_VAL_OFST            0x220
+#define S10_SYSMGR_UE_ADDR_OFST           0x224
 
 #define S10_DDR0_IRQ_MASK                 BIT(16)
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/4 EDAC, altera: Less Intrusive Error Injection

In reply to [email protected]

From: Thor Thayer <[email protected]>

Improve the Arria10 and Stratix10 error injection routines by reading the data and changing just 1 bit before writing back out. Previous routine would set the first bytes to 0 then change to 1 but this method is less intrusive.

---
 drivers/edac/altera_edac.c | 30 +++++++++++++-----------------
 drivers/edac/altera_edac.h |  2 +-
 2 files changed, 14 insertions(+), 18 deletions(-)
drivers/edac/altera_edac.c +13 -17
index c89d82aa2776..56af98d18645 100644
@@ -1756,28 +1756,24 @@ static ssize_t altr_edac_a10_device_trig2(struct file *file,
 	if (trig_type == ALTR_UE_TRIGGER_CHAR) {
 		writel(priv->ue_set_mask, set_addr);
 	} else {
-		/* Setup write of 0 to first 4 bytes */
-		writel(0x0, drvdata->base + ECC_BLK_WDATA0_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA1_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA2_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA3_OFST);
-		/* Setup write of 4 bytes */
+		/* Setup read/write of 4 bytes */
 		writel(ECC_WORD_WRITE, drvdata->base + ECC_BLK_DBYTECTRL_OFST);
 		/* Setup Address to 0 */
-		writel(0x0, drvdata->base + ECC_BLK_ADDRESS_OFST);
-		/* Setup accctrl to write & data override */
-		writel(ECC_WRITE_DOVR, drvdata->base + ECC_BLK_ACCCTRL_OFST);
-		/* Kick it. */
-		writel(ECC_XACT_KICK, drvdata->base + ECC_BLK_STARTACC_OFST);
-		/* Setup accctrl to read & ecc override */
-		writel(ECC_READ_EOVR, drvdata->base + ECC_BLK_ACCCTRL_OFST);
+		writel(0, drvdata->base + ECC_BLK_ADDRESS_OFST);
+		/* Setup accctrl to read & ecc & data override */
+		writel(ECC_READ_EDOVR, drvdata->base + ECC_BLK_ACCCTRL_OFST);
 		/* Kick it. */
 		writel(ECC_XACT_KICK, drvdata->base + ECC_BLK_STARTACC_OFST);
 		/* Setup write for single bit change */
-		writel(0x1, drvdata->base + ECC_BLK_WDATA0_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA1_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA2_OFST);
-		writel(0x0, drvdata->base + ECC_BLK_WDATA3_OFST);
+		writel(readl(drvdata->base + ECC_BLK_RDATA0_OFST) ^ 0x1,
+		       drvdata->base + ECC_BLK_WDATA0_OFST);
+		writel(readl(drvdata->base + ECC_BLK_RDATA1_OFST),
+		       drvdata->base + ECC_BLK_WDATA1_OFST);
+		writel(readl(drvdata->base + ECC_BLK_RDATA2_OFST),
+		       drvdata->base + ECC_BLK_WDATA2_OFST);
+		writel(readl(drvdata->base + ECC_BLK_RDATA3_OFST),
+		       drvdata->base + ECC_BLK_WDATA3_OFST);
+
 		/* Copy Read ECC to Write ECC */
 		writel(readl(drvdata->base + ECC_BLK_RECC0_OFST),
 		       drvdata->base + ECC_BLK_WECC0_OFST);
drivers/edac/altera_edac.h +1 -1
index f8664bac9fa8..a1acca99c50b 100644
@@ -319,7 +319,7 @@ struct altr_sdram_mc_data {
 #define ECC_BLK_STARTACC_OFST             0x7C
 
 #define ECC_XACT_KICK                     0x10000
-#define ECC_WORD_WRITE                    0xF
+#define ECC_WORD_WRITE                    0xFF
 #define ECC_WRITE_DOVR                    0x101
 #define ECC_WRITE_EDOVR                   0x103
 #define ECC_READ_EOVR                     0x2
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/4 EDAC, altera: Add Stratix10 OCRAM ECC support

In reply to [email protected]

From: Thor Thayer <[email protected]>

Use the newer ECC error injection method for Arria10 and Stratix10 OCRAM.
OCRAM can't call the common peripheral init routine since OCRAM is being used. An OCRAM specific init routine ensures the OCRAM ECC is setup without clearing memory.

---
 drivers/edac/altera_edac.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/edac/altera_edac.c +20 -2
index 56af98d18645..6a8993e6a278 100644
@@ -1216,8 +1216,26 @@ static const struct edac_device_prv_data ocramecc_data = {
 	.inject_fops = &altr_edac_device_inject_fops,
 };
 
+static int __maybe_unused
+altr_a10_check_ecc_deps_init(struct altr_edac_device_dev *device)
+{
+	void __iomem  *base = device->base;
+	int ret;
+
+	ret = altr_check_ecc_deps(device);
+	if (ret)
+		return ret;
+
+	/* Enable IRQ on Single Bit Error */
+	writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST));
+	/* Ensure all writes complete */
+	wmb();
+
+	return 0;
+}
+
 static const struct edac_device_prv_data a10_ocramecc_data = {
-	.setup = altr_check_ecc_deps,
+	.setup = altr_a10_check_ecc_deps_init,
 	.ce_clear_mask = ALTR_A10_ECC_SERRPENA,
 	.ue_clear_mask = ALTR_A10_ECC_DERRPENA,
 	.irq_status_mask = A10_SYSMGR_ECC_INTSTAT_OCRAM,
@@ -1227,7 +1245,7 @@ static const struct edac_device_prv_data a10_ocramecc_data = {
 	.ue_set_mask = ALTR_A10_ECC_TDERRA,
 	.set_err_ofst = ALTR_A10_ECC_INTTEST_OFST,
 	.ecc_irq_handler = altr_edac_a10_ecc_irq,
-	.inject_fops = &altr_edac_a10_device_inject_fops,
+	.inject_fops = &altr_edac_a10_device_inject2_fops,
 	/*
 	 * OCRAM panic on uncorrectable error because sleep/resume
 	 * functions and FPGA contents are stored in OCRAM. Prefer
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/4 arm64: dts: stratix10: Add OCRAM EDAC node

In reply to [email protected]

From: Thor Thayer <[email protected]>

Add the OCRAM ECC node following the Arria10 format.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +7 -0
index 8253a1a9e985..a625dc472b91 100644
@@ -494,6 +494,13 @@
 				interrupts = <16 4>, <48 4>;
 			};
 
+			ocram-ecc@ff8cc000 {
+				compatible = "altr,socfpga-a10-ocram-ecc";
+				reg = <0xff8cc000 0x100>;
+				interrupts = <1 4>,
+					     <33 4>;
+			};
+
 			usb0-ecc@ff8c4000 {
 				compatible = "altr,socfpga-usb-ecc";
 				reg = <0xff8c4000 0x100>;
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 1/4] EDAC, altera: Fix S10 persistent register offset

In reply to [email protected]
Quoted 7 lines · On 1/16/19 5:11 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Correct the persistent register offset where address and status are stored.

Fixes 08f08bfb7b4c ("EDAC, altera: Merge Stratix10 into the Arria10 SDRAM

probe routine")

The "Fixes" line should be all on one line. I recently got dinged for this.

Quoted 1 line

From Documentation/process/submitting-patches.rst"

"If your patch fixes a bug in a specific commit, e.g. you found an issue using
``git bisect``, please use the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and the one line summary. For example::

Fixes e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")"

Dinh

#3 lore raw

Re: [PATCH 1/4] EDAC, altera: Fix S10 persistent register offset

Quoted 24 lines · Dinh Nguyen
Quoted 7 lines · On 1/16/19 5:11 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Correct the persistent register offset where address and status are stored.

Fixes 08f08bfb7b4c ("EDAC, altera: Merge Stratix10 into the Arria10 SDRAM

probe routine")

The "Fixes" line should be all on one line. I recently got dinged for this.

Quoted 1 line
Quoted 1 line

From Documentation/process/submitting-patches.rst"

"If your patch fixes a bug in a specific commit, e.g. you found an issue using
``git bisect``, please use the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and the one line summary. For example::

Fixes e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")"

Dinh
I'll fix that and send out another patchset. Thanks Dinh.