Skip to content

Commit d1a46cd

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Add per-ring reset for vcn v4.0.5 use
There is a problem occurring on VCN 4.0.5 where in some situations a job is timing out. This triggers a job timeout which then causes a GPU reset for recovery. That has exposed a number of issues with GPU reset that have since been fixed. But also a GPU reset isn't actually needed for this circumstance. Just restarting the ring is enough. Add a reset callback for the ring which will stop and start VCN if the issue happens. Link: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12528 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3909 Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 5c937b4 commit d1a46cd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ static int vcn_v4_0_5_sw_init(struct amdgpu_ip_block *ip_block)
219219
adev->vcn.inst[i].pause_dpg_mode = vcn_v4_0_5_pause_dpg_mode;
220220
}
221221

222+
adev->vcn.supported_reset = amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
223+
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
224+
225+
r = amdgpu_vcn_sysfs_reset_mask_init(adev);
226+
if (r)
227+
return r;
228+
222229
if (amdgpu_sriov_vf(adev)) {
223230
r = amdgpu_virt_alloc_mm_table(adev);
224231
if (r)
@@ -1440,6 +1447,20 @@ static void vcn_v4_0_5_unified_ring_set_wptr(struct amdgpu_ring *ring)
14401447
}
14411448
}
14421449

1450+
static int vcn_v4_0_5_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)
1451+
{
1452+
struct amdgpu_device *adev = ring->adev;
1453+
struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me];
1454+
1455+
if (!(adev->vcn.supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
1456+
return -EOPNOTSUPP;
1457+
1458+
vcn_v4_0_5_stop(vinst);
1459+
vcn_v4_0_5_start(vinst);
1460+
1461+
return amdgpu_ring_test_helper(ring);
1462+
}
1463+
14431464
static struct amdgpu_ring_funcs vcn_v4_0_5_unified_ring_vm_funcs = {
14441465
.type = AMDGPU_RING_TYPE_VCN_ENC,
14451466
.align_mask = 0x3f,
@@ -1467,6 +1488,7 @@ static struct amdgpu_ring_funcs vcn_v4_0_5_unified_ring_vm_funcs = {
14671488
.emit_wreg = vcn_v2_0_enc_ring_emit_wreg,
14681489
.emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait,
14691490
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1491+
.reset = vcn_v4_0_5_ring_reset,
14701492
};
14711493

14721494
/**

0 commit comments

Comments
 (0)