Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Non-secure OS Schedules OP-TEE Question #1183
Now I'm trying to understand how does the both secure and non-secure tasks schedule together.
I think I once read the document which says that OPTEE-OS doesn't have a scheduler by itself so I think it's the non-secure OS takes responsibility for schedule both OS's tasks.
In my opinion, the non-secure OS could either takes entire secure OS as an entity to schedule or takes every Trusted Application as a separate entity so I want to know which way is the current implementation, thank you.
@SimonWan, the NS OS usually reschedules its active tasks (threads) based on non-secure timer notifications. OP-TEE is designed to relay such non-secure events when they occur while CPU executes in the secure world (OP-TEE).
When a CA 'opens', invokes' and 'closes' a session, it does this sequentially.
First CA calls "open session": a NS OS thread (thread A) invokes OP-TEE.
While NS OS handles the exception, the NS OS thread A (see above) is halted in linux optee driver. Since exception (scheduler timer event?), NS OS may decide to reschedule tasks, thread A might be freezed. When NS OS will decide to schedule back thread A, the linux optee driver will invoke back OP-TEE and resume initial "open" request.
OP-TEE will return to CA only upon completion of the initial "open session" request, with status info.
The "invoke TA command" request it called by CA only after completion of the "open session" request. Same, the "close session" request from CA will be called only once CA has completed "open" and "invoke" requests. Each is sequential. NS OS timer interrupts may occur at any time leading to NS OS rescheduling its active threads.