[PATCH Review 1/1] drm/amdgpu: Fix eeprom max record count

Stanley.Yang Stanley.Yang at amd.com
Wed Jul 17 11:20:27 UTC 2024


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

Signed-off-by: Stanley.Yang <Stanley.Yang at amd.com>
---
 .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index eae0a555df3c..c30d7daab472 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -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



More information about the amd-gfx mailing list