Skip to contentSkip to conversation

EDAC/altera: Check previous DDR DBE during driver probe

PATCH Superseded [email protected] 3 participants 15 messages May 3, 2023 – Jun 15, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover EDAC/altera: Check previous DDR DBE during driver probe

From: Niravkumar L Rabara <[email protected]>

Starting from SoCFPGA Agilex7, new SDM mailbox command is introduced to read Single Event Update Error information, SEU detects both corrected and uncorrected error.

If the previous HPS reboot caused by the DDR double bit error, bit-31 is set high of boot scratch register 8. EDAC driver probe will check this bit status and sends the SMC command to Arm Trusted Firmware. Firmware will send mailbox command to SDM to get the SEU error information and pass it to EDAC driver, driver will print error count, sector address and error data for previous DDR DBE.

Niravkumar L Rabara (2):
firmware: stratix10-svc: Add command to get SEU error info EDAC/altera: Check previous DDR DBE during driver probe

 drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 firmware: stratix10-svc: Add command to get SEU error info

From: Niravkumar L Rabara <[email protected]>

Introduce a new command to get Single Event Upset Error information.

---
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
include/linux/firmware/intel/stratix10-smc.h +20 -0
index a718f853d457..7eb1799e8d8a 100644
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upsate Error information
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 143
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
 #endif
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
 drivers/edac/altera_edac.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +24 -5
index 8b31cd54bdb6..398a49a3eb89 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 #ifdef CONFIG_64BIT
 	{
 		int dberror, err_addr;
+		struct arm_smccc_res result;
 
 		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
 		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,28 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
 			    &dberror);
 		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					0, 0, 0, 0, 0, 0, &result);
+
+				if (!(int)result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+					"Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+					, (unsigned int)result.a1, (unsigned int)result.a2
+					, (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						"INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+						&err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+						"Previous Boot UE detected[0x%X] @ 0x%X\n",
+						dberror, err_addr);
+			}
 			/* Reset the sticky registers */
 			regmap_write(edac->ecc_mgr_map,
 				     S10_SYSMGR_UE_VAL_OFST, 0);
@@ -2180,6 +2198,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 				     S10_SYSMGR_UE_ADDR_OFST, 0);
 		}
 	}
+
 #else
 	edac->db_irq = platform_get_irq(pdev, 1);
 	if (edac->db_irq < 0)
Signature · 1 line
2.25.1
#3 lore raw

v2 cover EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Starting from SoCFPGA Agilex7, new SDM mailbox command is introduced to read Single Event Upset Error information, SEU can detect both corrected and uncorrected error.

If the previous HPS reboot caused by the DDR double bit error, bit-31 is set high of boot scratch register 8. EDAC driver probe will check this bit status and sends the SMC command to Arm Trusted Firmware. Firmware will send mailbox command to SDM to get the SEU error information and pass it to EDAC driver, driver will print error count, sector address and error data for previous DDR DBE.

changelog v2:
* Updated command ID for SEU error

Niravkumar L Rabara (2):
firmware: stratix10-svc: Add command to get SEU error info EDAC/altera: Check previous DDR DBE during driver probe

 drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 1/2 firmware: stratix10-svc: Add command to get SEU error info

From: Niravkumar L Rabara <[email protected]>

Introduce a new command to get Single Event Upset Error information.

---
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
include/linux/firmware/intel/stratix10-smc.h +20 -0
index a718f853d457..669e2b12be39 100644
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upsate Error information
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 153
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
 #endif
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [PATCH v2 1/2] firmware: stratix10-svc: Add command to get SEU error info

Quoted 14 lines · On 5/3/23 05:18, [email protected] wrote:

From: Niravkumar L Rabara <[email protected]>

Introduce a new command to get Single Event Upset Error information.

---
  include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
include/linux/firmware/intel/stratix10-smc.h +0 -0
index a718f853d457..669e2b12be39 100644

include/linux/firmware/intel/stratix10-smc.h INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · line 600

Quoted 6 lines
include/linux/firmware/intel/stratix10-smc.h +3 -0
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
  #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
  	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upsate Error information

s/Upsate/Upset

Quoted 18 lines
include/linux/firmware/intel/stratix10-smc.h +17 -0
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 153
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
  #endif
#6 lore raw

PATCH v2 2/2 EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
 drivers/edac/altera_edac.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +24 -5
index 8b31cd54bdb6..398a49a3eb89 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 #ifdef CONFIG_64BIT
 	{
 		int dberror, err_addr;
+		struct arm_smccc_res result;
 
 		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
 		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,28 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
 			    &dberror);
 		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					0, 0, 0, 0, 0, 0, &result);
+
+				if (!(int)result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+					"Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+					, (unsigned int)result.a1, (unsigned int)result.a2
+					, (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						"INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+						&err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+						"Previous Boot UE detected[0x%X] @ 0x%X\n",
+						dberror, err_addr);
+			}
 			/* Reset the sticky registers */
 			regmap_write(edac->ecc_mgr_map,
 				     S10_SYSMGR_UE_VAL_OFST, 0);
@@ -2180,6 +2198,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 				     S10_SYSMGR_UE_ADDR_OFST, 0);
 		}
 	}
+
 #else
 	edac->db_irq = platform_get_irq(pdev, 1);
 	if (edac->db_irq < 0)
Signature · 1 line
2.25.1
maintainer
#7 lore raw
Quoted 26 lines · On 5/3/23 05:18, [email protected] wrote:

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
  drivers/edac/altera_edac.c | 29 ++++++++++++++++++++++++-----
  1 file changed, 24 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +1 -0
index 8b31cd54bdb6..398a49a3eb89 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
  #ifdef CONFIG_64BIT
  	{
  		int dberror, err_addr;
+		struct arm_smccc_res result;
 
  		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
  		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,28 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
  		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
  			    &dberror);
  		if (dberror) {

drivers/edac/altera_edac.c static int altr_edac_a10_probe(struct platform_device *pdev) · line 2176

Quoted 10 lines
drivers/edac/altera_edac.c +5 -5
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					0, 0, 0, 0, 0, 0, &result);

Please run checkpatch --strict to align these.

drivers/edac/altera_edac.c static int altr_edac_a10_probe(struct platform_device *pdev) · line 2178

Quoted 2 lines
drivers/edac/altera_edac.c +2 -0
+
+				if (!(int)result.a0) {

Why the typecast to int?

Quoted 19 lines
drivers/edac/altera_edac.c +15 -0
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+					"Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+					, (unsigned int)result.a1, (unsigned int)result.a2
+					, (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						"INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+						&err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+						"Previous Boot UE detected[0x%X] @ 0x%X\n",
+						dberror, err_addr);
+			}
  			/* Reset the sticky registers */
  			regmap_write(edac->ecc_mgr_map,
  				     S10_SYSMGR_UE_VAL_OFST, 0);

drivers/edac/altera_edac.c static int altr_edac_a10_probe(struct platform_device *pdev) · line 2201

Quoted 4 lines
drivers/edac/altera_edac.c +1 -0
@@ -2180,6 +2198,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
  				     S10_SYSMGR_UE_ADDR_OFST, 0);
  		}
  	}
+

Stray newline.

Quoted 3 lines
drivers/edac/altera_edac.c +0 -0
  #else
  	edac->db_irq = platform_get_irq(pdev, 1);
  	if (edac->db_irq < 0)
#8 lore raw

v3 cover EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Starting from SoCFPGA Agilex7, new SDM mailbox command is introduced to read Single Event Upset Error information, SEU can detect both corrected and uncorrected error.

If the previous HPS reboot caused by the DDR double bit error, bit-31 is set high of boot scratch register 8. EDAC driver probe will check this bit status and sends the SMC command to Arm Trusted Firmware. Firmware will send mailbox command to SDM to get the SEU error information and pass it to EDAC driver, driver will print error count, sector address and error data for previous DDR DBE.

changelog v3:
* Fixed unnecessary type case, checkpatch warnings and typo

changelog v2:
* Updated command ID for SEU error

Niravkumar L Rabara (2):
firmware: stratix10-svc: Add command to get SEU error info EDAC/altera: Check previous DDR DBE during driver probe

 drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#9 lore raw

PATCH v3 1/2 firmware: stratix10-svc: Add command to get SEU error info

From: Niravkumar L Rabara <[email protected]>

Introduce a new command to get Single Event Upset Error information.

---
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
include/linux/firmware/intel/stratix10-smc.h +20 -0
index a718f853d457..48810c39f612 100644
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upset Error information
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 153
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
 #endif
Signature · 1 line
2.25.1
#10 lore raw

PATCH v3 2/2 EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
 drivers/edac/altera_edac.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +24 -5
index 8b31cd54bdb6..04c0675adc8c 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 #ifdef CONFIG_64BIT
 	{
 		int dberror, err_addr;
+		struct arm_smccc_res result;
 
 		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
 		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,29 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
 			    &dberror);
 		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					      0, 0, 0, 0, 0, 0, &result);
+
+				if (!result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+						    , (unsigned int)result.a1
+						    , (unsigned int)result.a2
+						    , (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+					    &err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+					    "Previous Boot UE detected[0x%X] @ 0x%X\n",
+					    dberror, err_addr);
+			}
 			/* Reset the sticky registers */
 			regmap_write(edac->ecc_mgr_map,
 				     S10_SYSMGR_UE_VAL_OFST, 0);
Signature · 1 line
2.25.1
#11 lore raw

Hi,

Quoted 58 lines

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
 drivers/edac/altera_edac.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +1 -0
index 8b31cd54bdb6..04c0675adc8c 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct
 platform_device *pdev)
 #ifdef CONFIG_64BIT
 	{
 		int dberror, err_addr;
+		struct arm_smccc_res result;
 
 		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
drivers/edac/altera_edac.c +23 -5
 		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,29 @@ static int altr_edac_a10_probe(struct
 platform_device *pdev)
 		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
 			    &dberror);
 		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					      0, 0, 0, 0, 0, 0, &result);
+
+				if (!result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+						    , (unsigned int)result.a1
+						    , (unsigned int)result.a2
+						    , (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+					    &err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+					    "Previous Boot UE detected[0x%X] @ 0x%X\n",
+					    dberror, err_addr);
+			}
 			/* Reset the sticky registers */
 			regmap_write(edac->ecc_mgr_map,
Quoted 5 lines

S10_SYSMGR_UE_VAL_OFST, 0);
--
2.25.1

I think it would make sense if you combined the 1st patch. This patch cannot survive on its own without the defines.

Dinh

#12 lore raw

v4 cover EDAC/altera: Check previous DDR DBE during driver probe

In reply to [email protected]

From: Niravkumar L Rabara <[email protected]>

Starting from SoCFPGA Agilex7, new SDM mailbox command is introduced to read Single Event Upset Error information, SEU can detect both corrected and uncorrected error.

If the previous HPS reboot caused by the DDR double bit error, bit-31 is set high of boot scratch register 8. EDAC driver probe will check this bit status and sends the SMC command to Arm Trusted Firmware. Firmware will send mailbox command to SDM to get the SEU error information and pass it to EDAC driver, driver will print error count, sector address and error data for previous DDR DBE.

Introduce a new command to get Single Event Upset Error information.

changelog v4:
* Combined both the patch as per last review comment.

changelog v3:
* Fixed unnecessary type case, checkpatch warnings and typo

changelog v2:
* Updated command ID for SEU error

Niravkumar L Rabara (1):
EDAC/altera: Check previous DDR DBE during driver probe

 drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#13 lore raw

PATCH v4 1/1 EDAC/altera: Check previous DDR DBE during driver probe

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
 drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
 include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +24 -5
index 8b31cd54bdb6..04c0675adc8c 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 #ifdef CONFIG_64BIT
 	{
 		int dberror, err_addr;
+		struct arm_smccc_res result;
 
 		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
 		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,29 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
 			    &dberror);
 		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					      0, 0, 0, 0, 0, 0, &result);
+
+				if (!result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+						    , (unsigned int)result.a1
+						    , (unsigned int)result.a2
+						    , (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+					    &err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+					    "Previous Boot UE detected[0x%X] @ 0x%X\n",
+					    dberror, err_addr);
+			}
 			/* Reset the sticky registers */
 			regmap_write(edac->ecc_mgr_map,
 				     S10_SYSMGR_UE_VAL_OFST, 0);
include/linux/firmware/intel/stratix10-smc.h +20 -0
index a718f853d457..48810c39f612 100644
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upset Error information
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 153
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
 #endif
Signature · 1 line
2.25.1
maintainer Acked-by on v4 1/1
#14 lore raw
Quoted 77 lines · On 6/14/23 21:25, [email protected] wrote:

From: Niravkumar L Rabara <[email protected]>

Add DDR DBE check during driver probe to notify user if previous reboot cause by DDR DBE and print DBE error related information.

---
  drivers/edac/altera_edac.c                   | 29 ++++++++++++++++----
  include/linux/firmware/intel/stratix10-smc.h | 20 ++++++++++++++
  2 files changed, 44 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +24 -5
index 8b31cd54bdb6..04c0675adc8c 100644
@@ -2159,6 +2159,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
  #ifdef CONFIG_64BIT
  	{
  		int dberror, err_addr;
+		struct arm_smccc_res result;
 
  		edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
  		atomic_notifier_chain_register(&panic_notifier_list,
@@ -2168,11 +2169,29 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
  		regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST,
  			    &dberror);
  		if (dberror) {
-			regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
-				    &err_addr);
-			edac_printk(KERN_ERR, EDAC_DEVICE,
-				    "Previous Boot UE detected[0x%X] @ 0x%X\n",
-				    dberror, err_addr);
+			/* Bit-31 is set if previous DDR UE happened */
+			if (dberror & (1 << 31)) {
+				/* Read previous DDR UE info */
+				arm_smccc_smc(INTEL_SIP_SMC_READ_SEU_ERR, 0,
+					      0, 0, 0, 0, 0, 0, &result);
+
+				if (!result.a0) {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "Previous DDR UE:Count=0x%X,Address=0x%X,ErrorData=0x%X\n"
+						    , (unsigned int)result.a1
+						    , (unsigned int)result.a2
+						    , (unsigned int)result.a3);
+				} else {
+					edac_printk(KERN_ERR, EDAC_DEVICE,
+						    "INTEL_SIP_SMC_SEU_ERR_STATUS failed\n");
+				}
+			} else {
+				regmap_read(edac->ecc_mgr_map, S10_SYSMGR_UE_ADDR_OFST,
+					    &err_addr);
+				edac_printk(KERN_ERR, EDAC_DEVICE,
+					    "Previous Boot UE detected[0x%X] @ 0x%X\n",
+					    dberror, err_addr);
+			}
  			/* Reset the sticky registers */
  			regmap_write(edac->ecc_mgr_map,
  				     S10_SYSMGR_UE_VAL_OFST, 0);
include/linux/firmware/intel/stratix10-smc.h +11 -0
index a718f853d457..48810c39f612 100644
@@ -595,4 +595,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
  #define INTEL_SIP_SMC_FCS_GET_PROVISION_DATA \
  	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA)
 
+/**
+ * Request INTEL_SIP_SMC_READ_SEU_ERR
+ * Sync call to get Single Event Upset Error information
+ * SEU detects both corrected and uncorrected error
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_READ_SEU_ERR
+ * a1-7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_NOT_SUPPORTED or

include/linux/firmware/intel/stratix10-smc.h INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · line 618

Quoted 10 lines
include/linux/firmware/intel/stratix10-smc.h +9 -0
+ *    INTEL_SIP_SMC_STATUS_ERROR
+ * a1 error count of response data
+ * a2 sector address of response data
+ * a3 error data
+ */
+#define INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS 153
+#define INTEL_SIP_SMC_READ_SEU_ERR \
+		INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_SEU_ERR_STATUS)
+
  #endif