@@ -187,6 +187,11 @@ int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops *ops)
187
187
188
188
mutex_lock (& core -> lock );
189
189
190
+ if (test_bit (0 , & inst -> core -> sys_error )) {
191
+ ret = - EIO ;
192
+ goto unlock ;
193
+ }
194
+
190
195
max = atomic_add_unless (& core -> insts_count , 1 ,
191
196
core -> max_sessions_supported );
192
197
if (!max ) {
@@ -196,6 +201,7 @@ int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops *ops)
196
201
ret = 0 ;
197
202
}
198
203
204
+ unlock :
199
205
mutex_unlock (& core -> lock );
200
206
201
207
return ret ;
@@ -263,6 +269,9 @@ int hfi_session_deinit(struct venus_inst *inst)
263
269
if (inst -> state < INST_INIT )
264
270
return - EINVAL ;
265
271
272
+ if (test_bit (0 , & inst -> core -> sys_error ))
273
+ goto done ;
274
+
266
275
reinit_completion (& inst -> done );
267
276
268
277
ret = ops -> session_end (inst );
@@ -273,6 +282,7 @@ int hfi_session_deinit(struct venus_inst *inst)
273
282
if (ret )
274
283
return ret ;
275
284
285
+ done :
276
286
inst -> state = INST_UNINIT ;
277
287
278
288
return 0 ;
@@ -284,6 +294,9 @@ int hfi_session_start(struct venus_inst *inst)
284
294
const struct hfi_ops * ops = inst -> core -> ops ;
285
295
int ret ;
286
296
297
+ if (test_bit (0 , & inst -> core -> sys_error ))
298
+ return - EIO ;
299
+
287
300
if (inst -> state != INST_LOAD_RESOURCES )
288
301
return - EINVAL ;
289
302
@@ -308,6 +321,9 @@ int hfi_session_stop(struct venus_inst *inst)
308
321
const struct hfi_ops * ops = inst -> core -> ops ;
309
322
int ret ;
310
323
324
+ if (test_bit (0 , & inst -> core -> sys_error ))
325
+ return - EIO ;
326
+
311
327
if (inst -> state != INST_START )
312
328
return - EINVAL ;
313
329
@@ -331,6 +347,9 @@ int hfi_session_continue(struct venus_inst *inst)
331
347
{
332
348
struct venus_core * core = inst -> core ;
333
349
350
+ if (test_bit (0 , & inst -> core -> sys_error ))
351
+ return - EIO ;
352
+
334
353
if (core -> res -> hfi_version == HFI_VERSION_1XX )
335
354
return 0 ;
336
355
@@ -343,6 +362,9 @@ int hfi_session_abort(struct venus_inst *inst)
343
362
const struct hfi_ops * ops = inst -> core -> ops ;
344
363
int ret ;
345
364
365
+ if (test_bit (0 , & inst -> core -> sys_error ))
366
+ return - EIO ;
367
+
346
368
reinit_completion (& inst -> done );
347
369
348
370
ret = ops -> session_abort (inst );
@@ -362,6 +384,9 @@ int hfi_session_load_res(struct venus_inst *inst)
362
384
const struct hfi_ops * ops = inst -> core -> ops ;
363
385
int ret ;
364
386
387
+ if (test_bit (0 , & inst -> core -> sys_error ))
388
+ return - EIO ;
389
+
365
390
if (inst -> state != INST_INIT )
366
391
return - EINVAL ;
367
392
@@ -385,6 +410,9 @@ int hfi_session_unload_res(struct venus_inst *inst)
385
410
const struct hfi_ops * ops = inst -> core -> ops ;
386
411
int ret ;
387
412
413
+ if (test_bit (0 , & inst -> core -> sys_error ))
414
+ return - EIO ;
415
+
388
416
if (inst -> state != INST_STOP )
389
417
return - EINVAL ;
390
418
@@ -409,6 +437,9 @@ int hfi_session_flush(struct venus_inst *inst, u32 type, bool block)
409
437
const struct hfi_ops * ops = inst -> core -> ops ;
410
438
int ret ;
411
439
440
+ if (test_bit (0 , & inst -> core -> sys_error ))
441
+ return - EIO ;
442
+
412
443
reinit_completion (& inst -> done );
413
444
414
445
ret = ops -> session_flush (inst , type );
@@ -429,6 +460,9 @@ int hfi_session_set_buffers(struct venus_inst *inst, struct hfi_buffer_desc *bd)
429
460
{
430
461
const struct hfi_ops * ops = inst -> core -> ops ;
431
462
463
+ if (test_bit (0 , & inst -> core -> sys_error ))
464
+ return - EIO ;
465
+
432
466
return ops -> session_set_buffers (inst , bd );
433
467
}
434
468
@@ -438,6 +472,9 @@ int hfi_session_unset_buffers(struct venus_inst *inst,
438
472
const struct hfi_ops * ops = inst -> core -> ops ;
439
473
int ret ;
440
474
475
+ if (test_bit (0 , & inst -> core -> sys_error ))
476
+ return - EIO ;
477
+
441
478
reinit_completion (& inst -> done );
442
479
443
480
ret = ops -> session_unset_buffers (inst , bd );
@@ -460,6 +497,9 @@ int hfi_session_get_property(struct venus_inst *inst, u32 ptype,
460
497
const struct hfi_ops * ops = inst -> core -> ops ;
461
498
int ret ;
462
499
500
+ if (test_bit (0 , & inst -> core -> sys_error ))
501
+ return - EIO ;
502
+
463
503
if (inst -> state < INST_INIT || inst -> state >= INST_STOP )
464
504
return - EINVAL ;
465
505
@@ -483,6 +523,9 @@ int hfi_session_set_property(struct venus_inst *inst, u32 ptype, void *pdata)
483
523
{
484
524
const struct hfi_ops * ops = inst -> core -> ops ;
485
525
526
+ if (test_bit (0 , & inst -> core -> sys_error ))
527
+ return - EIO ;
528
+
486
529
if (inst -> state < INST_INIT || inst -> state >= INST_STOP )
487
530
return - EINVAL ;
488
531
@@ -494,6 +537,9 @@ int hfi_session_process_buf(struct venus_inst *inst, struct hfi_frame_data *fd)
494
537
{
495
538
const struct hfi_ops * ops = inst -> core -> ops ;
496
539
540
+ if (test_bit (0 , & inst -> core -> sys_error ))
541
+ return - EIO ;
542
+
497
543
if (fd -> buffer_type == HFI_BUFFER_INPUT )
498
544
return ops -> session_etb (inst , fd );
499
545
else if (fd -> buffer_type == HFI_BUFFER_OUTPUT ||
0 commit comments