Skip to content

Commit 8c5ed7f

Browse files
davidwuAMDalexdeucher
authored andcommitted
drm/amdgpu/vcn2: read back register after written
The addition of register read-back in VCN v2.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 988b1d2 commit 8c5ed7f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,12 @@ static int vcn_v2_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)
978978
/* Unstall DPG */
979979
WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS),
980980
0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
981+
982+
/* Keeping one read-back to ensure all register writes are done,
983+
* otherwise it may introduce race conditions.
984+
*/
985+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
986+
981987
return 0;
982988
}
983989

@@ -1152,6 +1158,11 @@ static int vcn_v2_0_start(struct amdgpu_vcn_inst *vinst)
11521158
WREG32_SOC15(UVD, 0, mmUVD_RB_SIZE2, ring->ring_size / 4);
11531159
fw_shared->multi_queue.encode_lowlatency_queue_mode &= ~FW_QUEUE_RING_RESET;
11541160

1161+
/* Keeping one read-back to ensure all register writes are done,
1162+
* otherwise it may introduce race conditions.
1163+
*/
1164+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1165+
11551166
return 0;
11561167
}
11571168

@@ -1183,6 +1194,11 @@ static int vcn_v2_0_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
11831194
WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS), 0,
11841195
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
11851196

1197+
/* Keeping one read-back to ensure all register writes are done,
1198+
* otherwise it may introduce race conditions.
1199+
*/
1200+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1201+
11861202
return 0;
11871203
}
11881204

@@ -1248,6 +1264,11 @@ static int vcn_v2_0_stop(struct amdgpu_vcn_inst *vinst)
12481264
vcn_v2_0_enable_clock_gating(vinst);
12491265
vcn_v2_0_enable_static_power_gating(vinst);
12501266

1267+
/* Keeping one read-back to ensure all register writes are done,
1268+
* otherwise it may introduce race conditions.
1269+
*/
1270+
RREG32_SOC15(VCN, 0, mmUVD_STATUS);
1271+
12511272
power_off:
12521273
if (adev->pm.dpm_enabled)
12531274
amdgpu_dpm_enable_vcn(adev, false, 0);

0 commit comments

Comments
 (0)