Commit 334b27bf authored by Tao Zhou's avatar Tao Zhou Committed by Alex Deucher
Browse files

drm/amdgpu: try for more times if RAS bad page number is not updated



RAS info update in PMFW is time cost, wait for it.

Signed-off-by: default avatarTao Zhou <tao.zhou1@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ec49374c
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -874,13 +874,33 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)
int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *control)
{
	struct amdgpu_device *adev = to_amdgpu_device(control);
	int ret, timeout = 1000;

	if (!amdgpu_ras_smu_eeprom_supported(adev))
		return 0;

	control->ras_num_recs_old = control->ras_num_recs;
	return amdgpu_ras_smu_get_badpage_count(adev,

	do {
		ret = amdgpu_ras_smu_get_badpage_count(adev,
			&(control->ras_num_recs), 12);
		if (!ret &&
		    (control->ras_num_recs_old == control->ras_num_recs)) {
			/* record number update in PMFW needs some time */
			msleep(50);
			timeout -= 50;
		} else {
			break;
		}
	} while (timeout);

	/* no update of record number is not a real failure,
	 * don't print warning here
	 */
	if (!ret && (control->ras_num_recs_old == control->ras_num_recs))
		ret = -EINVAL;

	return ret;
}

/**