Skip to content

Commit 5b4c641

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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,11 @@ static int vcn_v4_0_3_start_dpg_mode(struct amdgpu_vcn_inst *vinst,
977977
/*resetting done, fw can check RB ring */
978978
fw_shared->sq.queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET);
979979

980+
/* Keeping one read-back to ensure all register writes are done,
981+
* otherwise it may introduce race conditions.
982+
*/
983+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
984+
980985
return 0;
981986
}
982987

@@ -1370,6 +1375,12 @@ static int vcn_v4_0_3_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
13701375
/* disable dynamic power gating mode */
13711376
WREG32_P(SOC15_REG_OFFSET(VCN, vcn_inst, regUVD_POWER_STATUS), 0,
13721377
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
1378+
1379+
/* Keeping one read-back to ensure all register writes are done,
1380+
* otherwise it may introduce race conditions.
1381+
*/
1382+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
1383+
13731384
return 0;
13741385
}
13751386

@@ -1453,6 +1464,11 @@ static int vcn_v4_0_3_stop(struct amdgpu_vcn_inst *vinst)
14531464
/* apply HW clock gating */
14541465
vcn_v4_0_3_enable_clock_gating(vinst);
14551466

1467+
/* Keeping one read-back to ensure all register writes are done,
1468+
* otherwise it may introduce race conditions.
1469+
*/
1470+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
1471+
14561472
Done:
14571473
return 0;
14581474
}

0 commit comments

Comments
 (0)