Skip to contentSkip to conversation

drm/amdgpu: Fix eeprom max record count

PATCH Superseded Stanley.Yang 2 participants 2 messages Jul 17, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix eeprom max record count

The eeprom table is empty before initializing, add get eeprom table version function according UMC HWIP version before initializing eeprom table.

---
 .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +18 -1
index eae0a555df3c..c30d7daab472 100644
@@ -406,6 +406,21 @@ static int amdgpu_ras_eeprom_correct_header_tag(
 	return res;
 }
 
+static uint32_t amdgpu_ras_get_eeprom_table_version(struct amdgpu_ras_eeprom_control *control)
+{
+	struct amdgpu_device *adev = to_amdgpu_device(control);
+
+	switch (amdgpu_ip_version(adev, UMC_HWIP, 0)) {
+	case IP_VERSION(8, 10, 0):
+	case IP_VERSION(12, 0, 0):
+		return RAS_TABLE_VER_V2_1;
+	default:
+		return RAS_TABLE_VER_V1;
+	}
+
+	return RAS_TABLE_VER_V1;
+}
+
 static void amdgpu_ras_set_eeprom_table_version(struct amdgpu_ras_eeprom_control *control)
 {
 	struct amdgpu_device *adev = to_amdgpu_device(control);
@@ -1011,7 +1026,9 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
 
 uint32_t amdgpu_ras_eeprom_max_record_count(struct amdgpu_ras_eeprom_control *control)
 {
-	if (control->tbl_hdr.version == RAS_TABLE_VER_V2_1)
+	uint32_t tbl_version = amdgpu_ras_get_eeprom_table_version(control);
+
+	if (tbl_version == RAS_TABLE_VER_V2_1)
 		return RAS_MAX_RECORD_COUNT_V2_1;
 	else
 		return RAS_MAX_RECORD_COUNT;
Signature · 1 line
2.25.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Shall we reuse amdgpu_ras_set_eeprom_table_version? We need to move the function to the beginning of amdgpu_ras_recovery_init, something like this.

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Stanley.Yang
Sent: Wednesday, July 17, 2024 19:20
To: [email protected]
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: Fix eeprom max record count

The eeprom table is empty before initializing, add get eeprom table version function according UMC HWIP version before initializing eeprom table.

---
 .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +15 -0
index eae0a555df3c..c30d7daab472 100644
@@ -406,6 +406,21 @@ static int amdgpu_ras_eeprom_correct_header_tag(
        return res;
 }
 
+static uint32_t amdgpu_ras_get_eeprom_table_version(struct
+amdgpu_ras_eeprom_control *control) {
+       struct amdgpu_device *adev = to_amdgpu_device(control);
+
+       switch (amdgpu_ip_version(adev, UMC_HWIP, 0)) {
+       case IP_VERSION(8, 10, 0):
+       case IP_VERSION(12, 0, 0):
+               return RAS_TABLE_VER_V2_1;
+       default:
+               return RAS_TABLE_VER_V1;
+       }
+
+       return RAS_TABLE_VER_V1;
+}
+
 static void amdgpu_ras_set_eeprom_table_version(struct amdgpu_ras_eeprom_control *control)  {
        struct amdgpu_device *adev = to_amdgpu_device(control); @@ -1011,7 +1026,9 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
 

uint32_t amdgpu_ras_eeprom_max_record_count(struct amdgpu_ras_eeprom_control *control) {
- if (control->tbl_hdr.version == RAS_TABLE_VER_V2_1)
+ uint32_t tbl_version = amdgpu_ras_get_eeprom_table_version(control);
+
+ if (tbl_version == RAS_TABLE_VER_V2_1)

                return RAS_MAX_RECORD_COUNT_V2_1;
        else
                return RAS_MAX_RECORD_COUNT;

--
2.25.1