Skip to contentSkip to conversation

drm/amdgpu: read back register after written for VCN v4.0.5

PATCH In review Mario Limonciello 2 participants 2 messages Jun 19, 2025 – Jun 21, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: read back register after written for VCN v4.0.5

From: "David (Ming Qiang) Wu" <[email protected]>

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.

Hand modified for contextual changes where there is a for loop in 6.12 that was dropped later on.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +8 -0
index e0b02bf1c563..3d114ea7049f 100644
@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b
 			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;
 }
 
@@ -1167,6 +1171,10 @@ static int vcn_v4_0_5_start(struct amdgpu_device *adev)
 		tmp |= VCN_RB_ENABLE__RB1_EN_MASK;
 		WREG32_SOC15(VCN, i, regVCN_RB_ENABLE, tmp);
 		fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET | FW_QUEUE_DPG_HOLD_OFF);
+
+		/* Keeping one read-back to ensure all register writes are done, otherwise
+		 * it may introduce race conditions */
+		RREG32_SOC15(VCN, i, regVCN_RB_ENABLE);
 	}
 
 	return 0;
Signature · 1 line
2.43.0
maintainer
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: ee7360fc27d6045510f8fe459b5649b2af27811a

WARNING: Author mismatch between patch and found commit:
Backport author: Mario Limonciello<[email protected]> Commit author: David (Ming Qiang) Wu<[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---

1:  ee7360fc27d60 < -:  ------------- drm/amdgpu: read back register after written for VCN v4.0.5
-:  ------------- > 1:  8e72224fa5965 drm/amdgpu: read back register after written for VCN v4.0.5

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |