Skip to content

Commit dc70445

Browse files
Jie1zhangalexdeucher
authored andcommitted
drm/amdgpu: Add ring reset support for VCN v5.0.1
Implement the ring reset callback for VCN v5.0.1 to properly handle hardware recovery when encountering GPU hangs. The new functionality: 1. Adds vcn_v5_0_1_ring_reset() function that: - Prepares for reset using amdgpu_ring_reset_helper_begin() - Performs VCN instance reset via amdgpu_dpm_reset_vcn() - Re-initializes hardware through vcn_v5_0_1_hw_init_inst() - Restarts DPG mode with vcn_v5_0_1_start_dpg_mode() - Completes reset with amdgpu_ring_reset_helper_end() 2. Hooks the reset function into the unified ring functions via: - Adding .reset = vcn_v5_0_1_ring_reset to vcn_v5_0_1_unified_ring_vm_funcs 3. Maintains existing behavior for SR-IOV VF cases by checking RRMT status This provides proper hardware recovery capabilities for VCN 5.0.1 IP block during fault conditions, matching functionality available in other VCN versions. v2: Remove the RRMT_ENABLED cap setting in the reset function and replace adev->vcn.inst[ring->me].indirect_sram with vinst->indirect_sram (Lijo) Reviewed-by: Sonny Jiang <sonny.jiang@amd.com> Suggested-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Signed-off-by: Ruili Ji <ruiliji2@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent eb6910c commit dc70445

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,31 @@ static void vcn_v5_0_1_unified_ring_set_wptr(struct amdgpu_ring *ring)
12841284
}
12851285
}
12861286

1287+
static int vcn_v5_0_1_ring_reset(struct amdgpu_ring *ring,
1288+
unsigned int vmid,
1289+
struct amdgpu_fence *timedout_fence)
1290+
{
1291+
int r = 0;
1292+
int vcn_inst;
1293+
struct amdgpu_device *adev = ring->adev;
1294+
struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me];
1295+
1296+
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
1297+
1298+
vcn_inst = GET_INST(VCN, ring->me);
1299+
r = amdgpu_dpm_reset_vcn(adev, 1 << vcn_inst);
1300+
1301+
if (r) {
1302+
DRM_DEV_ERROR(adev->dev, "VCN reset fail : %d\n", r);
1303+
return r;
1304+
}
1305+
1306+
vcn_v5_0_1_hw_init_inst(adev, ring->me);
1307+
vcn_v5_0_1_start_dpg_mode(vinst, vinst->indirect_sram);
1308+
1309+
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
1310+
}
1311+
12871312
static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = {
12881313
.type = AMDGPU_RING_TYPE_VCN_ENC,
12891314
.align_mask = 0x3f,
@@ -1312,6 +1337,7 @@ static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = {
13121337
.emit_wreg = vcn_v4_0_3_enc_ring_emit_wreg,
13131338
.emit_reg_wait = vcn_v4_0_3_enc_ring_emit_reg_wait,
13141339
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1340+
.reset = vcn_v5_0_1_ring_reset,
13151341
};
13161342

13171343
/**

0 commit comments

Comments
 (0)