Skip to content

Commit 0ef2803

Browse files
davidwuAMDalexdeucher
authored andcommitted
drm/amdgpu/vcn1: read back register after written
V3: drop changes where readbacks have implemented. This patch set is to add readbacks only. V2: use common register UVD_STATUS for readback (standard PCI MMIO behavior, i.e. readback post all writes to let the writes hit the hardware) add readback in ..._stop() for more coverage. Similar to the changes made for VCN v4.0.5 where readback to post the writes to avoid race with the doorbell, the addition of register readback support in other VCN versions 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. The overhead introduced is negligible. Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 040585d commit 0ef2803

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,11 @@ static int vcn_v1_0_start_spg_mode(struct amdgpu_vcn_inst *vinst)
10091009

10101010
jpeg_v1_0_start(adev, 0);
10111011

1012+
/* Keeping one read-back to ensure all register writes are done,
1013+
* otherwise it may introduce race conditions.
1014+
*/
1015+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1016+
10121017
return 0;
10131018
}
10141019

@@ -1154,6 +1159,11 @@ static int vcn_v1_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst)
11541159

11551160
jpeg_v1_0_start(adev, 1);
11561161

1162+
/* Keeping one read-back to ensure all register writes are done,
1163+
* otherwise it may introduce race conditions.
1164+
*/
1165+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1166+
11571167
return 0;
11581168
}
11591169

@@ -1216,6 +1226,12 @@ static int vcn_v1_0_stop_spg_mode(struct amdgpu_vcn_inst *vinst)
12161226

12171227
vcn_v1_0_enable_clock_gating(vinst);
12181228
vcn_1_0_enable_static_power_gating(vinst);
1229+
1230+
/* Keeping one read-back to ensure all register writes are done,
1231+
* otherwise it may introduce race conditions.
1232+
*/
1233+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1234+
12191235
return 0;
12201236
}
12211237

@@ -1250,6 +1266,11 @@ static int vcn_v1_0_stop_dpg_mode(struct amdgpu_vcn_inst *vinst)
12501266
WREG32_P(SOC15_REG_OFFSET(UVD, 0, mmUVD_POWER_STATUS), 0,
12511267
~UVD_POWER_STATUS__UVD_PG_MODE_MASK);
12521268

1269+
/* Keeping one read-back to ensure all register writes are done,
1270+
* otherwise it may introduce race conditions.
1271+
*/
1272+
RREG32_SOC15(UVD, 0, mmUVD_STATUS);
1273+
12531274
return 0;
12541275
}
12551276

0 commit comments

Comments
 (0)