Skip to content

Commit bf394d2

Browse files
davidwuAMDalexdeucher
authored andcommitted
drm/amdgpu/vcn5.0.1: read back register after written
The addition of register read-back in VCN v5.0.1 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 a8bce9b commit bf394d2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,11 @@ static int vcn_v5_0_1_start(struct amdgpu_vcn_inst *vinst)
10381038
WREG32_SOC15(VCN, vcn_inst, regVCN_RB_ENABLE, tmp);
10391039
fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET | FW_QUEUE_DPG_HOLD_OFF);
10401040

1041+
/* Keeping one read-back to ensure all register writes are done,
1042+
* otherwise it may introduce race conditions.
1043+
*/
1044+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
1045+
10411046
return 0;
10421047
}
10431048

@@ -1072,6 +1077,11 @@ static void vcn_v5_0_1_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
10721077
/* disable dynamic power gating mode */
10731078
WREG32_P(SOC15_REG_OFFSET(VCN, vcn_inst, regUVD_POWER_STATUS), 0,
10741079
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
1080+
1081+
/* Keeping one read-back to ensure all register writes are done,
1082+
* otherwise it may introduce race conditions.
1083+
*/
1084+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
10751085
}
10761086

10771087
/**
@@ -1147,6 +1157,11 @@ static int vcn_v5_0_1_stop(struct amdgpu_vcn_inst *vinst)
11471157
/* clear status */
11481158
WREG32_SOC15(VCN, vcn_inst, regUVD_STATUS, 0);
11491159

1160+
/* Keeping one read-back to ensure all register writes are done,
1161+
* otherwise it may introduce race conditions.
1162+
*/
1163+
RREG32_SOC15(VCN, vcn_inst, regUVD_STATUS);
1164+
11501165
return 0;
11511166
}
11521167

0 commit comments

Comments
 (0)