Skip to content

Commit 64ac009

Browse files
committed
drm/amdgpu/vcn2: 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 7b6cde7 commit 64ac009

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ static int vcn_v2_0_set_pg_state(struct amdgpu_vcn_inst *vinst,
9898
static int vcn_v2_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
9999
struct dpg_pause_state *new_state);
100100
static int vcn_v2_0_start_sriov(struct amdgpu_device *adev);
101+
static int vcn_v2_0_reset(struct amdgpu_vcn_inst *vinst);
102+
101103
/**
102104
* vcn_v2_0_early_init - set function pointers and load microcode
103105
*
@@ -213,6 +215,12 @@ static int vcn_v2_0_sw_init(struct amdgpu_ip_block *ip_block)
213215
}
214216

215217
adev->vcn.inst[0].pause_dpg_mode = vcn_v2_0_pause_dpg_mode;
218+
adev->vcn.inst[0].reset = vcn_v2_0_reset;
219+
220+
adev->vcn.supported_reset =
221+
amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
222+
if (!amdgpu_sriov_vf(adev))
223+
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
216224

217225
r = amdgpu_virt_alloc_mm_table(adev);
218226
if (r)
@@ -233,6 +241,10 @@ static int vcn_v2_0_sw_init(struct amdgpu_ip_block *ip_block)
233241
adev->vcn.ip_dump = ptr;
234242
}
235243

244+
r = amdgpu_vcn_sysfs_reset_mask_init(adev);
245+
if (r)
246+
return r;
247+
236248
return 0;
237249
}
238250

@@ -260,6 +272,8 @@ static int vcn_v2_0_sw_fini(struct amdgpu_ip_block *ip_block)
260272
if (r)
261273
return r;
262274

275+
amdgpu_vcn_sysfs_reset_mask_fini(adev);
276+
263277
r = amdgpu_vcn_sw_fini(adev, 0);
264278

265279
kfree(adev->vcn.ip_dump);
@@ -1355,6 +1369,16 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
13551369
return 0;
13561370
}
13571371

1372+
static int vcn_v2_0_reset(struct amdgpu_vcn_inst *vinst)
1373+
{
1374+
int r;
1375+
1376+
r = vcn_v2_0_stop(vinst);
1377+
if (r)
1378+
return r;
1379+
return vcn_v2_0_start(vinst);
1380+
}
1381+
13581382
static bool vcn_v2_0_is_idle(struct amdgpu_ip_block *ip_block)
13591383
{
13601384
struct amdgpu_device *adev = ip_block->adev;
@@ -2176,6 +2200,7 @@ static const struct amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = {
21762200
.emit_wreg = vcn_v2_0_dec_ring_emit_wreg,
21772201
.emit_reg_wait = vcn_v2_0_dec_ring_emit_reg_wait,
21782202
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
2203+
.reset = amdgpu_vcn_ring_reset,
21792204
};
21802205

21812206
static const struct amdgpu_ring_funcs vcn_v2_0_enc_ring_vm_funcs = {
@@ -2205,6 +2230,7 @@ static const struct amdgpu_ring_funcs vcn_v2_0_enc_ring_vm_funcs = {
22052230
.emit_wreg = vcn_v2_0_enc_ring_emit_wreg,
22062231
.emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait,
22072232
.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
2233+
.reset = amdgpu_vcn_ring_reset,
22082234
};
22092235

22102236
static void vcn_v2_0_set_dec_ring_funcs(struct amdgpu_device *adev)

0 commit comments

Comments
 (0)