Skip to content

Commit b7a4842

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,11 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)
11731173
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS),
11741174
0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
11751175

1176+
/* Keeping one read-back to ensure all register writes are done,
1177+
* otherwise it may introduce race conditions.
1178+
*/
1179+
RREG32_SOC15(VCN, inst_idx, mmUVD_STATUS);
1180+
11761181
return 0;
11771182
}
11781183

@@ -1360,6 +1365,11 @@ static int vcn_v3_0_start(struct amdgpu_vcn_inst *vinst)
13601365
fw_shared->multi_queue.encode_lowlatency_queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET);
13611366
}
13621367

1368+
/* Keeping one read-back to ensure all register writes are done,
1369+
* otherwise it may introduce race conditions.
1370+
*/
1371+
RREG32_SOC15(VCN, i, mmUVD_STATUS);
1372+
13631373
return 0;
13641374
}
13651375

@@ -1602,6 +1612,11 @@ static int vcn_v3_0_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
16021612
WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), 0,
16031613
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
16041614

1615+
/* Keeping one read-back to ensure all register writes are done,
1616+
* otherwise it may introduce race conditions.
1617+
*/
1618+
RREG32_SOC15(VCN, inst_idx, mmUVD_STATUS);
1619+
16051620
return 0;
16061621
}
16071622

@@ -1674,6 +1689,11 @@ static int vcn_v3_0_stop(struct amdgpu_vcn_inst *vinst)
16741689
/* enable VCN power gating */
16751690
vcn_v3_0_enable_static_power_gating(vinst);
16761691

1692+
/* Keeping one read-back to ensure all register writes are done,
1693+
* otherwise it may introduce race conditions.
1694+
*/
1695+
RREG32_SOC15(VCN, i, mmUVD_STATUS);
1696+
16771697
done:
16781698
if (adev->pm.dpm_enabled)
16791699
amdgpu_dpm_enable_vcn(adev, false, i);

0 commit comments

Comments
 (0)