Skip to content

Commit d9e688b

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

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,11 @@ static int vcn_v2_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)
11581158
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS),
11591159
0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
11601160

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

@@ -1343,6 +1348,11 @@ static int vcn_v2_5_start(struct amdgpu_vcn_inst *vinst)
13431348
WREG32_SOC15(VCN, i, mmUVD_RB_SIZE2, ring->ring_size / 4);
13441349
fw_shared->multi_queue.encode_lowlatency_queue_mode &= ~FW_QUEUE_RING_RESET;
13451350

1351+
/* Keeping one read-back to ensure all register writes are done,
1352+
* otherwise it may introduce race conditions.
1353+
*/
1354+
RREG32_SOC15(VCN, i, mmUVD_STATUS);
1355+
13461356
return 0;
13471357
}
13481358

@@ -1569,6 +1579,11 @@ static int vcn_v2_5_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
15691579
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), 0,
15701580
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
15711581

1582+
/* Keeping one read-back to ensure all register writes are done,
1583+
* otherwise it may introduce race conditions.
1584+
*/
1585+
RREG32_SOC15(VCN, inst_idx, mmUVD_STATUS);
1586+
15721587
return 0;
15731588
}
15741589

@@ -1635,6 +1650,10 @@ static int vcn_v2_5_stop(struct amdgpu_vcn_inst *vinst)
16351650
UVD_POWER_STATUS__UVD_POWER_STATUS_MASK,
16361651
~UVD_POWER_STATUS__UVD_POWER_STATUS_MASK);
16371652

1653+
/* Keeping one read-back to ensure all register writes are done,
1654+
* otherwise it may introduce race conditions.
1655+
*/
1656+
RREG32_SOC15(VCN, i, mmUVD_STATUS);
16381657
done:
16391658
if (adev->pm.dpm_enabled)
16401659
amdgpu_dpm_enable_vcn(adev, false, i);

0 commit comments

Comments
 (0)