Skip to content

Commit d7767a1

Browse files
committed
drm/amdgpu/vcn3: 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 63b8c9f commit d7767a1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ static int vcn_v3_0_set_pg_state(struct amdgpu_vcn_inst *vinst,
110110
enum amd_powergating_state state);
111111
static int vcn_v3_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
112112
struct dpg_pause_state *new_state);
113+
static int vcn_v3_0_reset(struct amdgpu_vcn_inst *vinst);
113114

114115
static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring);
115116
static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring);
@@ -289,8 +290,14 @@ static int vcn_v3_0_sw_init(struct amdgpu_ip_block *ip_block)
289290

290291
if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
291292
adev->vcn.inst[i].pause_dpg_mode = vcn_v3_0_pause_dpg_mode;
293+
adev->vcn.inst[i].reset = vcn_v3_0_reset;
292294
}
293295

296+
adev->vcn.supported_reset =
297+
amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
298+
if (!amdgpu_sriov_vf(adev))
299+
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
300+
294301
if (amdgpu_sriov_vf(adev)) {
295302
r = amdgpu_virt_alloc_mm_table(adev);
296303
if (r)
@@ -306,6 +313,10 @@ static int vcn_v3_0_sw_init(struct amdgpu_ip_block *ip_block)
306313
adev->vcn.ip_dump = ptr;
307314
}
308315

316+
r = amdgpu_vcn_sysfs_reset_mask_init(adev);
317+
if (r)
318+
return r;
319+
309320
return 0;
310321
}
311322

@@ -338,6 +349,8 @@ static int vcn_v3_0_sw_fini(struct amdgpu_ip_block *ip_block)
338349
if (amdgpu_sriov_vf(adev))
339350
amdgpu_virt_free_mm_table(adev);
340351

352+
amdgpu_vcn_sysfs_reset_mask_fini(adev);
353+
341354
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
342355
r = amdgpu_vcn_suspend(adev, i);
343356
if (r)
@@ -2033,6 +2046,7 @@ static const struct amdgpu_ring_funcs vcn_v3_0_dec_ring_vm_funcs = {
20332046
.emit_wreg = vcn_v2_0_dec_ring_emit_wreg,
20342047
.emit_reg_wait = vcn_v2_0_dec_ring_emit_reg_wait,
20352048
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
2049+
.reset = amdgpu_vcn_ring_reset,
20362050
};
20372051

20382052
/**
@@ -2131,6 +2145,7 @@ static const struct amdgpu_ring_funcs vcn_v3_0_enc_ring_vm_funcs = {
21312145
.emit_wreg = vcn_v2_0_enc_ring_emit_wreg,
21322146
.emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait,
21332147
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
2148+
.reset = amdgpu_vcn_ring_reset,
21342149
};
21352150

21362151
static void vcn_v3_0_set_dec_ring_funcs(struct amdgpu_device *adev)
@@ -2164,6 +2179,18 @@ static void vcn_v3_0_set_enc_ring_funcs(struct amdgpu_device *adev)
21642179
}
21652180
}
21662181

2182+
static int vcn_v3_0_reset(struct amdgpu_vcn_inst *vinst)
2183+
{
2184+
int r;
2185+
2186+
r = vcn_v3_0_stop(vinst);
2187+
if (r)
2188+
return r;
2189+
vcn_v3_0_enable_clock_gating(vinst);
2190+
vcn_v3_0_enable_static_power_gating(vinst);
2191+
return vcn_v3_0_start(vinst);
2192+
}
2193+
21672194
static bool vcn_v3_0_is_idle(struct amdgpu_ip_block *ip_block)
21682195
{
21692196
struct amdgpu_device *adev = ip_block->adev;

0 commit comments

Comments
 (0)