@@ -40,7 +40,7 @@ struct optee_shm_arg_entry {
40
40
};
41
41
42
42
void optee_cq_wait_init (struct optee_call_queue * cq ,
43
- struct optee_call_waiter * w )
43
+ struct optee_call_waiter * w , bool sys_thread )
44
44
{
45
45
/*
46
46
* We're preparing to make a call to secure world. In case we can't
@@ -328,7 +328,8 @@ int optee_open_session(struct tee_context *ctx,
328
328
goto out ;
329
329
}
330
330
331
- if (optee -> ops -> do_call_with_arg (ctx , shm , offs )) {
331
+ if (optee -> ops -> do_call_with_arg (ctx , shm , offs ,
332
+ sess -> use_sys_thread )) {
332
333
msg_arg -> ret = TEEC_ERROR_COMMUNICATION ;
333
334
msg_arg -> ret_origin = TEEC_ORIGIN_COMMS ;
334
335
}
@@ -360,7 +361,8 @@ int optee_open_session(struct tee_context *ctx,
360
361
return rc ;
361
362
}
362
363
363
- int optee_close_session_helper (struct tee_context * ctx , u32 session )
364
+ int optee_close_session_helper (struct tee_context * ctx , u32 session ,
365
+ bool system_thread )
364
366
{
365
367
struct optee * optee = tee_get_drvdata (ctx -> teedev );
366
368
struct optee_shm_arg_entry * entry ;
@@ -374,7 +376,7 @@ int optee_close_session_helper(struct tee_context *ctx, u32 session)
374
376
375
377
msg_arg -> cmd = OPTEE_MSG_CMD_CLOSE_SESSION ;
376
378
msg_arg -> session = session ;
377
- optee -> ops -> do_call_with_arg (ctx , shm , offs );
379
+ optee -> ops -> do_call_with_arg (ctx , shm , offs , system_thread );
378
380
379
381
optee_free_msg_arg (ctx , entry , offs );
380
382
@@ -385,6 +387,7 @@ int optee_close_session(struct tee_context *ctx, u32 session)
385
387
{
386
388
struct optee_context_data * ctxdata = ctx -> data ;
387
389
struct optee_session * sess ;
390
+ bool system_thread ;
388
391
389
392
/* Check that the session is valid and remove it from the list */
390
393
mutex_lock (& ctxdata -> mutex );
@@ -394,9 +397,10 @@ int optee_close_session(struct tee_context *ctx, u32 session)
394
397
mutex_unlock (& ctxdata -> mutex );
395
398
if (!sess )
396
399
return - EINVAL ;
400
+ system_thread = sess -> use_sys_thread ;
397
401
kfree (sess );
398
402
399
- return optee_close_session_helper (ctx , session );
403
+ return optee_close_session_helper (ctx , session , system_thread );
400
404
}
401
405
402
406
int optee_invoke_func (struct tee_context * ctx , struct tee_ioctl_invoke_arg * arg ,
@@ -408,12 +412,15 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
408
412
struct optee_msg_arg * msg_arg ;
409
413
struct optee_session * sess ;
410
414
struct tee_shm * shm ;
415
+ bool system_thread ;
411
416
u_int offs ;
412
417
int rc ;
413
418
414
419
/* Check that the session is valid */
415
420
mutex_lock (& ctxdata -> mutex );
416
421
sess = find_session (ctxdata , arg -> session );
422
+ if (sess )
423
+ system_thread = sess -> use_sys_thread ;
417
424
mutex_unlock (& ctxdata -> mutex );
418
425
if (!sess )
419
426
return - EINVAL ;
@@ -432,7 +439,7 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
432
439
if (rc )
433
440
goto out ;
434
441
435
- if (optee -> ops -> do_call_with_arg (ctx , shm , offs )) {
442
+ if (optee -> ops -> do_call_with_arg (ctx , shm , offs , system_thread )) {
436
443
msg_arg -> ret = TEEC_ERROR_COMMUNICATION ;
437
444
msg_arg -> ret_origin = TEEC_ORIGIN_COMMS ;
438
445
}
@@ -457,12 +464,15 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
457
464
struct optee_shm_arg_entry * entry ;
458
465
struct optee_msg_arg * msg_arg ;
459
466
struct optee_session * sess ;
467
+ bool system_thread ;
460
468
struct tee_shm * shm ;
461
469
u_int offs ;
462
470
463
471
/* Check that the session is valid */
464
472
mutex_lock (& ctxdata -> mutex );
465
473
sess = find_session (ctxdata , session );
474
+ if (sess )
475
+ system_thread = sess -> use_sys_thread ;
466
476
mutex_unlock (& ctxdata -> mutex );
467
477
if (!sess )
468
478
return - EINVAL ;
@@ -474,7 +484,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
474
484
msg_arg -> cmd = OPTEE_MSG_CMD_CANCEL ;
475
485
msg_arg -> session = session ;
476
486
msg_arg -> cancel_id = cancel_id ;
477
- optee -> ops -> do_call_with_arg (ctx , shm , offs );
487
+ optee -> ops -> do_call_with_arg (ctx , shm , offs , system_thread );
478
488
479
489
optee_free_msg_arg (ctx , entry , offs );
480
490
return 0 ;
0 commit comments