Skip to content

Commit a3810a5

Browse files
davidwuAMDalexdeucher
authored andcommitted
drm/amdgpu/vcn4: read back register after written
The addition of register read-back in VCN v4.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 b7a4842 commit a3810a5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,11 @@ static int vcn_v4_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)
11221122
ring->doorbell_index << VCN_RB1_DB_CTRL__OFFSET__SHIFT |
11231123
VCN_RB1_DB_CTRL__EN_MASK);
11241124

1125+
/* Keeping one read-back to ensure all register writes are done,
1126+
* otherwise it may introduce race conditions.
1127+
*/
1128+
RREG32_SOC15(VCN, inst_idx, regUVD_STATUS);
1129+
11251130
return 0;
11261131
}
11271132

@@ -1303,6 +1308,11 @@ static int vcn_v4_0_start(struct amdgpu_vcn_inst *vinst)
13031308
WREG32_SOC15(VCN, i, regVCN_RB_ENABLE, tmp);
13041309
fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET | FW_QUEUE_DPG_HOLD_OFF);
13051310

1311+
/* Keeping one read-back to ensure all register writes are done,
1312+
* otherwise it may introduce race conditions.
1313+
*/
1314+
RREG32_SOC15(VCN, i, regUVD_STATUS);
1315+
13061316
return 0;
13071317
}
13081318

@@ -1583,6 +1593,11 @@ static void vcn_v4_0_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
15831593
/* disable dynamic power gating mode */
15841594
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, regUVD_POWER_STATUS), 0,
15851595
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
1596+
1597+
/* Keeping one read-back to ensure all register writes are done,
1598+
* otherwise it may introduce race conditions.
1599+
*/
1600+
RREG32_SOC15(VCN, inst_idx, regUVD_STATUS);
15861601
}
15871602

15881603
/**
@@ -1666,6 +1681,11 @@ static int vcn_v4_0_stop(struct amdgpu_vcn_inst *vinst)
16661681
/* enable VCN power gating */
16671682
vcn_v4_0_enable_static_power_gating(vinst);
16681683

1684+
/* Keeping one read-back to ensure all register writes are done,
1685+
* otherwise it may introduce race conditions.
1686+
*/
1687+
RREG32_SOC15(VCN, i, regUVD_STATUS);
1688+
16691689
done:
16701690
if (adev->pm.dpm_enabled)
16711691
amdgpu_dpm_enable_vcn(adev, false, i);

0 commit comments

Comments
 (0)