Skip to content

Commit 5414140

Browse files
Tao Zhoualexdeucher
authored andcommitted
drm/amdgpu: skip writing eeprom when PMFW manages RAS data
Only update bad page number in legacy eeprom write path. v2: add null pointer check for con. Signed-off-by: Tao Zhou <tao.zhou1@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 62320fb commit 5414140

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,18 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)
871871
return res;
872872
}
873873

874+
int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *control)
875+
{
876+
struct amdgpu_device *adev = to_amdgpu_device(control);
877+
878+
if (!amdgpu_ras_smu_eeprom_supported(adev))
879+
return 0;
880+
881+
control->ras_num_recs_old = control->ras_num_recs;
882+
return amdgpu_ras_smu_get_badpage_count(adev,
883+
&(control->ras_num_recs), 12);
884+
}
885+
874886
/**
875887
* amdgpu_ras_eeprom_append -- append records to the EEPROM RAS table
876888
* @control: pointer to control structure
@@ -889,12 +901,18 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
889901
const u32 num)
890902
{
891903
struct amdgpu_device *adev = to_amdgpu_device(control);
904+
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
892905
int res, i;
893906
uint64_t nps = AMDGPU_NPS1_PARTITION_MODE;
894907

895-
if (!__is_ras_eeprom_supported(adev))
908+
if (!__is_ras_eeprom_supported(adev) || !con)
896909
return 0;
897910

911+
if (amdgpu_ras_smu_eeprom_supported(adev)) {
912+
control->ras_num_bad_pages = con->bad_page_num;
913+
return 0;
914+
}
915+
898916
if (num == 0) {
899917
dev_err(adev->dev, "will not append 0 records\n");
900918
return -EINVAL;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct amdgpu_ras_eeprom_control {
8282
/* Number of records in the table.
8383
*/
8484
u32 ras_num_recs;
85+
u32 ras_num_recs_old;
8586

8687
/* the bad page number is ras_num_recs or
8788
* ras_num_recs * umc.retire_unit
@@ -190,6 +191,8 @@ int amdgpu_ras_eeprom_read_idx(struct amdgpu_ras_eeprom_control *control,
190191
struct eeprom_table_record *record, u32 rec_idx,
191192
const u32 num);
192193

194+
int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *control);
195+
193196
extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;
194197
extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops;
195198

0 commit comments

Comments
 (0)