drm/amdgpu: read back register after written for VCN v4.0.5
Subsystems (3)
PATCH v3 1/3 drm/amdgpu: read back register after written for VCN v4.0.5
V2: not to add extra read-back in vcn_v4_0_5_start as there is a
read-back already. New comment for better understanding.
On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. The read-back of regVCN_RB1_DB_CTRL register after written is to ensure the doorbell_index is updated before it can work properly.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4 -0
@@ -1034,6 +1034,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst, ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
Signature · 1 line
2.34.1
PATCH v3 2/3 drm/amdgpu: read back register after written for VCN v4.0.0
V3: patch for VCN v4.0.0 only
Similar to the previous changes made for VCN v4.0.5, the addition of register read-back support in VCN v4.0.0 is intended to prevent potential race conditions, even though such issues have not been observed yet. This change ensures consistency across different VCN variants and helps avoid similar issues on newer or closely related GPUs. The overhead introduced by this read-back is negligible.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +4 -0
@@ -1122,6 +1122,10 @@ static int vcn_v4_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect) ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
Signature · 1 line
2.34.1
PATCH v3 3/3 drm/amdgpu: read back register after written for VCN v5.0.0
In reply to David (Ming Qiang) WuV3: patch for VCN v5.0.0 only
Similar to the previous changes made for VCN v4.0.5, the addition of register read-back support in VCN v5.0.0 is intended to prevent potential race conditions, even though such issues have not been observed yet. This change ensures consistency across different VCN variants and helps avoid similar issues on newer or closely related GPUs. The overhead introduced by this read-back is negligible.
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +4 -0
@@ -794,6 +794,10 @@ static int vcn_v5_0_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
Signature · 1 line
2.34.1
RE: [PATCH v3 3/3] drm/amdgpu: read back register after written for VCN v5.0.0
[AMD Official Use Only - AMD Internal Distribution Only]
The series is
-----Original Message-----
From: Wu, David <[email protected]>
Sent: Tuesday, May 13, 2025 3:22 PM
To: [email protected]; Koenig, Christian <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Liu, Leo <[email protected]>; Jiang, Sonny <[email protected]>; Dong, Ruijing <[email protected]>; Limonciello, Mario <[email protected]>
Subject: [PATCH v3 3/3] drm/amdgpu: read back register after written for VCN v5.0.0
V3: patch for VCN v5.0.0 only
Similar to the previous changes made for VCN v4.0.5, the addition of register read-back support in VCN v5.0.0 is intended to prevent potential race conditions, even though such issues have not been observed yet. This change ensures consistency across different VCN variants and helps avoid similar issues on newer or closely related GPUs. The overhead introduced by this read-back is negligible.
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +4 -0
@@ -794,6 +794,10 @@ static int vcn_v5_0_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
--
2.34.1