Skip to contentSkip to conversation

drm/amdgpu: return error when eeprom checksum failed

PATCH In review Jinzhou Su 2 participants 3 messages Dec 2, 2024

Subsystems (2)
lore
Share & tools
lore

Jinzhou Su

author
#0 lore raw

PATCH 1/1 drm/amdgpu: return error when eeprom checksum failed

Return eeprom table checksum error result, otherwise it might be overwritten by next call.

V2: replace DRM_ERROR with dev_err

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -2
index f4a9e15389ae..bd8acb55f76f 100644
@@ -1412,9 +1412,11 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
 		}
 
 		res = __verify_ras_table_checksum(control);
-		if (res)
-			DRM_ERROR("RAS Table incorrect checksum or error:%d\n",
+		if (res) {
+			dev_err(adev->dev, "RAS Table incorrect checksum or error:%d\n",
 				  res);
+			return -EINVAL;
+		}
 		if (ras->bad_page_cnt_threshold > control->ras_num_recs) {
 			/* This means that, the threshold was increased since
 			 * the last time the system was booted, and now,
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Su, Joe <[email protected]>
Sent: Monday, December 2, 2024 13:30
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>
Subject: [PATCH] drm/amdgpu: return error when eeprom checksum failed

Return eeprom table checksum error result, otherwise it might be overwritten by next call.

V2: replace DRM_ERROR with dev_err

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -2
index f4a9e15389ae..bd8acb55f76f 100644
@@ -1412,9 +1412,11 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
                }
 
                res = __verify_ras_table_checksum(control);
-               if (res)
-                       DRM_ERROR("RAS Table incorrect checksum or error:%d\n",
+               if (res) {
+                       dev_err(adev->dev, "RAS Table incorrect checksum or error:%d\n",
                                  res);
+                       return -EINVAL;
+               }
                if (ras->bad_page_cnt_threshold > control->ras_num_recs) {
                        /* This means that, the threshold was increased since
                         * the last time the system was booted, and now,

--
2.43.0

Reviewed-by
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Ah, hold on please. I assume even the BADG is written to headers. There are still valid eeprom record available in the eeprom, right?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Zhang, Hawking
Sent: Monday, December 2, 2024 1:54 PM
To: Su, Joe <[email protected]>; [email protected]
Cc: Yang, Stanley <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: return error when eeprom checksum failed

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Su, Joe <[email protected]>
Sent: Monday, December 2, 2024 13:30
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>
Subject: [PATCH] drm/amdgpu: return error when eeprom checksum failed

Return eeprom table checksum error result, otherwise it might be overwritten by next call.

V2: replace DRM_ERROR with dev_err

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -2
index f4a9e15389ae..bd8acb55f76f 100644
@@ -1412,9 +1412,11 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
                }
 
                res = __verify_ras_table_checksum(control);
-               if (res)
-                       DRM_ERROR("RAS Table incorrect checksum or error:%d\n",
+               if (res) {
+                       dev_err(adev->dev, "RAS Table incorrect checksum or error:%d\n",
                                  res);
+                       return -EINVAL;
+               }
                if (ras->bad_page_cnt_threshold > control->ras_num_recs) {
                        /* This means that, the threshold was increased since
                         * the last time the system was booted, and now,

--
2.43.0