Skip to content

Commit a8bce9b

Browse files
davidwuAMDalexdeucher
authored andcommitted
drm/amdgpu/vcn5: read back register after written
The addition of register read-back in VCN v5.0.0 is intended to prevent potential race conditions. Reviewed-by: Ruijing Dong <[email protected]> Signed-off-by: David (Ming Qiang) Wu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4d4275a commit a8bce9b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,11 @@ static int vcn_v5_0_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst,
794794
ring->doorbell_index << VCN_RB1_DB_CTRL__OFFSET__SHIFT |
795795
VCN_RB1_DB_CTRL__EN_MASK);
796796

797+
/* Keeping one read-back to ensure all register writes are done,
798+
* otherwise it may introduce race conditions.
799+
*/
800+
RREG32_SOC15(VCN, inst_idx, regUVD_STATUS);
801+
797802
return 0;
798803
}
799804

@@ -946,6 +951,11 @@ static int vcn_v5_0_0_start(struct amdgpu_vcn_inst *vinst)
946951
WREG32_SOC15(VCN, i, regVCN_RB_ENABLE, tmp);
947952
fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET | FW_QUEUE_DPG_HOLD_OFF);
948953

954+
/* Keeping one read-back to ensure all register writes are done,
955+
* otherwise it may introduce race conditions.
956+
*/
957+
RREG32_SOC15(VCN, i, regUVD_STATUS);
958+
949959
return 0;
950960
}
951961

@@ -977,6 +987,11 @@ static void vcn_v5_0_0_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
977987
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, regUVD_POWER_STATUS), 0,
978988
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
979989

990+
/* Keeping one read-back to ensure all register writes are done,
991+
* otherwise it may introduce race conditions.
992+
*/
993+
RREG32_SOC15(VCN, inst_idx, regUVD_STATUS);
994+
980995
return;
981996
}
982997

@@ -1058,6 +1073,11 @@ static int vcn_v5_0_0_stop(struct amdgpu_vcn_inst *vinst)
10581073
/* enable VCN power gating */
10591074
vcn_v5_0_0_enable_static_power_gating(vinst);
10601075

1076+
/* Keeping one read-back to ensure all register writes are done,
1077+
* otherwise it may introduce race conditions.
1078+
*/
1079+
RREG32_SOC15(VCN, i, regUVD_STATUS);
1080+
10611081
done:
10621082
if (adev->pm.dpm_enabled)
10631083
amdgpu_dpm_enable_vcn(adev, false, i);

0 commit comments

Comments
 (0)