Skip to content

Commit b8b6e6f

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Add per-ring reset for vcn v4.0.0 use
If there is a problem requiring a reset of the VCN engine, it is better to reset the VCN engine rather than the entire GPU. Add a reset callback for the ring which will stop and start VCN if an issue happens. 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 d1a46cd commit b8b6e6f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ static int vcn_v4_0_sw_init(struct amdgpu_ip_block *ip_block)
239239
adev->vcn.inst[i].pause_dpg_mode = vcn_v4_0_pause_dpg_mode;
240240
}
241241

242-
/* TODO: Add queue reset mask when FW fully supports it */
243242
adev->vcn.supported_reset =
244243
amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
244+
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
245245

246246
if (amdgpu_sriov_vf(adev)) {
247247
r = amdgpu_virt_alloc_mm_table(adev);
@@ -1947,6 +1947,20 @@ static int vcn_v4_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
19471947
return 0;
19481948
}
19491949

1950+
static int vcn_v4_0_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)
1951+
{
1952+
struct amdgpu_device *adev = ring->adev;
1953+
struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me];
1954+
1955+
if (!(adev->vcn.supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
1956+
return -EOPNOTSUPP;
1957+
1958+
vcn_v4_0_stop(vinst);
1959+
vcn_v4_0_start(vinst);
1960+
1961+
return amdgpu_ring_test_helper(ring);
1962+
}
1963+
19501964
static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
19511965
.type = AMDGPU_RING_TYPE_VCN_ENC,
19521966
.align_mask = 0x3f,
@@ -1976,6 +1990,7 @@ static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
19761990
.emit_wreg = vcn_v2_0_enc_ring_emit_wreg,
19771991
.emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait,
19781992
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1993+
.reset = vcn_v4_0_ring_reset,
19791994
};
19801995

19811996
/**

0 commit comments

Comments
 (0)