Skip to content

Commit 63b8c9f

Browse files
committed
drm/amdgpu/vcn2.5: implement ring reset
Use the new helpers to handle engine resets for VCN. Reviewed-by: Sathishkumar S <[email protected]> Tested-by: Sathishkumar S <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 64ac009 commit 63b8c9f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static int vcn_v2_5_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
102102
struct dpg_pause_state *new_state);
103103
static int vcn_v2_5_sriov_start(struct amdgpu_device *adev);
104104
static void vcn_v2_5_set_ras_funcs(struct amdgpu_device *adev);
105+
static int vcn_v2_5_reset(struct amdgpu_vcn_inst *vinst);
105106

106107
static int amdgpu_ih_clientid_vcns[] = {
107108
SOC15_IH_CLIENTID_VCN,
@@ -404,8 +405,14 @@ static int vcn_v2_5_sw_init(struct amdgpu_ip_block *ip_block)
404405

405406
if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
406407
adev->vcn.inst[j].pause_dpg_mode = vcn_v2_5_pause_dpg_mode;
408+
adev->vcn.inst[j].reset = vcn_v2_5_reset;
407409
}
408410

411+
adev->vcn.supported_reset =
412+
amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
413+
if (!amdgpu_sriov_vf(adev))
414+
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
415+
409416
if (amdgpu_sriov_vf(adev)) {
410417
r = amdgpu_virt_alloc_mm_table(adev);
411418
if (r)
@@ -425,6 +432,10 @@ static int vcn_v2_5_sw_init(struct amdgpu_ip_block *ip_block)
425432
adev->vcn.ip_dump = ptr;
426433
}
427434

435+
r = amdgpu_vcn_sysfs_reset_mask_init(adev);
436+
if (r)
437+
return r;
438+
428439
return 0;
429440
}
430441

@@ -455,6 +466,8 @@ static int vcn_v2_5_sw_fini(struct amdgpu_ip_block *ip_block)
455466
if (amdgpu_sriov_vf(adev))
456467
amdgpu_virt_free_mm_table(adev);
457468

469+
amdgpu_vcn_sysfs_reset_mask_fini(adev);
470+
458471
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
459472
r = amdgpu_vcn_suspend(adev, i);
460473
if (r)
@@ -1816,6 +1829,7 @@ static const struct amdgpu_ring_funcs vcn_v2_5_dec_ring_vm_funcs = {
18161829
.emit_wreg = vcn_v2_0_dec_ring_emit_wreg,
18171830
.emit_reg_wait = vcn_v2_0_dec_ring_emit_reg_wait,
18181831
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1832+
.reset = amdgpu_vcn_ring_reset,
18191833
};
18201834

18211835
/**
@@ -1914,6 +1928,7 @@ static const struct amdgpu_ring_funcs vcn_v2_5_enc_ring_vm_funcs = {
19141928
.emit_wreg = vcn_v2_0_enc_ring_emit_wreg,
19151929
.emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait,
19161930
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1931+
.reset = amdgpu_vcn_ring_reset,
19171932
};
19181933

19191934
static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev)
@@ -1942,6 +1957,16 @@ static void vcn_v2_5_set_enc_ring_funcs(struct amdgpu_device *adev)
19421957
}
19431958
}
19441959

1960+
static int vcn_v2_5_reset(struct amdgpu_vcn_inst *vinst)
1961+
{
1962+
int r;
1963+
1964+
r = vcn_v2_5_stop(vinst);
1965+
if (r)
1966+
return r;
1967+
return vcn_v2_5_start(vinst);
1968+
}
1969+
19451970
static bool vcn_v2_5_is_idle(struct amdgpu_ip_block *ip_block)
19461971
{
19471972
struct amdgpu_device *adev = ip_block->adev;

0 commit comments

Comments
 (0)