Skip to content

Commit a4b6e99

Browse files
ganglxiealexdeucher
authored andcommitted
drm/amdgpu: Save PA of bad pages for old asics
for old asics that do not support mca translating, we just save PA for them Signed-off-by: ganglxie <ganglxie@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2da3af5 commit a4b6e99

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,13 @@ static int __amdgpu_ras_convert_rec_array_from_rom(struct amdgpu_device *adev,
28362836

28372837
save_nps = (bps[0].retired_page >> UMC_NPS_SHIFT) & UMC_NPS_MASK;
28382838

2839+
/*old asics just have pa in eeprom*/
2840+
if (IP_VERSION_MAJ(amdgpu_ip_version(adev, UMC_HWIP, 0)) < 12) {
2841+
memcpy(err_data->err_addr, bps,
2842+
sizeof(struct eeprom_table_record) * adev->umc.retire_unit);
2843+
goto out;
2844+
}
2845+
28392846
for (i = 0; i < adev->umc.retire_unit; i++)
28402847
bps[i].retired_page &= ~(UMC_NPS_MASK << UMC_NPS_SHIFT);
28412848

@@ -2858,6 +2865,7 @@ static int __amdgpu_ras_convert_rec_array_from_rom(struct amdgpu_device *adev,
28582865
}
28592866
}
28602867

2868+
out:
28612869
return __amdgpu_ras_restore_bad_pages(adev, err_data->err_addr, adev->umc.retire_unit);
28622870
}
28632871

@@ -2981,14 +2989,24 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev,
29812989

29822990
/* only new entries are saved */
29832991
if (save_count > 0) {
2984-
for (i = 0; i < unit_num; i++) {
2992+
/*old asics only save pa to eeprom like before*/
2993+
if (IP_VERSION_MAJ(amdgpu_ip_version(adev, UMC_HWIP, 0)) < 12) {
29852994
if (amdgpu_ras_eeprom_append(control,
2986-
&data->bps[bad_page_num + i * adev->umc.retire_unit],
2987-
1)) {
2995+
&data->bps[bad_page_num], save_count)) {
29882996
dev_err(adev->dev, "Failed to save EEPROM table data!");
29892997
return -EIO;
29902998
}
2999+
} else {
3000+
for (i = 0; i < unit_num; i++) {
3001+
if (amdgpu_ras_eeprom_append(control,
3002+
&data->bps[bad_page_num +
3003+
i * adev->umc.retire_unit], 1)) {
3004+
dev_err(adev->dev, "Failed to save EEPROM table data!");
3005+
return -EIO;
3006+
}
3007+
}
29913008
}
3009+
29923010
dev_info(adev->dev, "Saved %d pages to EEPROM table.\n", save_count);
29933011
}
29943012

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,14 @@ amdgpu_ras_eeprom_append_table(struct amdgpu_ras_eeprom_control *control,
727727
- control->ras_fri)
728728
% control->ras_max_record_count;
729729

730-
control->ras_num_mca_recs += num;
731-
control->ras_num_bad_pages += num * adev->umc.retire_unit;
730+
/*old asics only save pa to eeprom like before*/
731+
if (IP_VERSION_MAJ(amdgpu_ip_version(adev, UMC_HWIP, 0)) < 12)
732+
control->ras_num_pa_recs += num;
733+
else
734+
control->ras_num_mca_recs += num;
732735

736+
control->ras_num_bad_pages = control->ras_num_pa_recs +
737+
control->ras_num_mca_recs * adev->umc.retire_unit;
733738
Out:
734739
kfree(buf);
735740
return res;

0 commit comments

Comments
 (0)