@@ -98,6 +98,8 @@ static int vcn_v2_0_set_pg_state(struct amdgpu_vcn_inst *vinst,
9898static int vcn_v2_0_pause_dpg_mode (struct amdgpu_vcn_inst * vinst ,
9999 struct dpg_pause_state * new_state );
100100static 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+
13581382static 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
21812206static 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
22102236static void vcn_v2_0_set_dec_ring_funcs (struct amdgpu_device * adev )
0 commit comments