Commit 40e7ed97 authored by Dennis Li's avatar Dennis Li Committed by Alex Deucher

drm/amdgpu: protect eeprom update from GPU reset

because i2c is unstable in GPU reset, driver need protect
eeprom update from GPU reset, to not miss any bad page record.
Signed-off-by: default avatarDennis Li <Dennis.Li@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a3bab325
...@@ -149,7 +149,11 @@ static int __update_table_header(struct amdgpu_ras_eeprom_control *control, ...@@ -149,7 +149,11 @@ static int __update_table_header(struct amdgpu_ras_eeprom_control *control,
msg.addr = control->i2c_address; msg.addr = control->i2c_address;
/* i2c may be unstable in gpu reset */
down_read(&adev->reset_sem);
ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1); ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1);
up_read(&adev->reset_sem);
if (ret < 1) if (ret < 1)
DRM_ERROR("Failed to write EEPROM table header, ret:%d", ret); DRM_ERROR("Failed to write EEPROM table header, ret:%d", ret);
...@@ -557,7 +561,11 @@ int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control, ...@@ -557,7 +561,11 @@ int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
control->next_addr += EEPROM_TABLE_RECORD_SIZE; control->next_addr += EEPROM_TABLE_RECORD_SIZE;
} }
/* i2c may be unstable in gpu reset */
down_read(&adev->reset_sem);
ret = i2c_transfer(&adev->pm.smu_i2c, msgs, num); ret = i2c_transfer(&adev->pm.smu_i2c, msgs, num);
up_read(&adev->reset_sem);
if (ret < 1) { if (ret < 1) {
DRM_ERROR("Failed to process EEPROM table records, ret:%d", ret); DRM_ERROR("Failed to process EEPROM table records, ret:%d", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment