Skip to content

Commit b6e79cb

Browse files
davidwuAMDjfvogel
authored andcommitted
drm/amdgpu: read back register after written for VCN v4.0.5
commit ee7360f upstream. On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. Adding register read-back after written at function end is to ensure all register writes are done before they can be used. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12528 Signed-off-by: David (Ming Qiang) Wu <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Tested-by: Mario Limonciello <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Ruijing Dong <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 07c9db090b86e5211188e1b351303fbc673378cf) Cc: [email protected] (cherry picked from commit ee7360f) Hand modified for contextual changes where there is a for loop in 6.12 that was dropped later on. Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit cef081c8231b52b4a652bbd022e03d80441118be) Signed-off-by: Jack Vogel <[email protected]>
1 parent 4ec85e6 commit b6e79cb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b
985985
ring->doorbell_index << VCN_RB1_DB_CTRL__OFFSET__SHIFT |
986986
VCN_RB1_DB_CTRL__EN_MASK);
987987

988+
/* Keeping one read-back to ensure all register writes are done, otherwise
989+
* it may introduce race conditions */
990+
RREG32_SOC15(VCN, inst_idx, regVCN_RB1_DB_CTRL);
991+
988992
return 0;
989993
}
990994

@@ -1167,6 +1171,10 @@ static int vcn_v4_0_5_start(struct amdgpu_device *adev)
11671171
tmp |= VCN_RB_ENABLE__RB1_EN_MASK;
11681172
WREG32_SOC15(VCN, i, regVCN_RB_ENABLE, tmp);
11691173
fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET | FW_QUEUE_DPG_HOLD_OFF);
1174+
1175+
/* Keeping one read-back to ensure all register writes are done, otherwise
1176+
* it may introduce race conditions */
1177+
RREG32_SOC15(VCN, i, regVCN_RB_ENABLE);
11701178
}
11711179

11721180
return 0;

0 commit comments

Comments
 (0)