TrustZone: Scheduling processes from the two worlds

故事扮演 提交于 2019-12-11 11:18:28

问题


If I have a single core CPU on a TZ-enabled device and there are two processes running: one in the secure world and one in the non-secure world, is it possible to have the scheduler manage them in an pre-emptive way, such that each process gets assigned a certain time slice?


回答1:


Actually, it is possible, but only in a round about way. You can't use a single scheduler to handle the two separate tasks as they execute in completely separate execution environments. What you can do though is use the FIQ to do the time slicing for you. If you setup the FIQ to be SW exception, you can set it to trigger on a periodic basis, for instance, every 50ms. When this happens, execution will be forced into the SW and your process can run there. You can then have the process run for a specified period and then relinquish control back to the NW, resetting the FIQ timer before leaving. The NW can then run until the FIQ triggers again.

As stated, this is NOT a single scheduler handling both SW and NW processes, but it is a potential way to do what you are attempting to do. You would still need to consider other interrupts though, so bear that in mind.




回答2:


TZ normally Execute in single thread so whenever there is a request from the non secure side to run some secure application. It will go through the monitor mode and then context switch will happen from non -secure to secure world and then secure application will start execution in the secure world in one thread. So that core will be running in the secure world for that time but if any interrupt from the no sec world then execution will stop and context will switch from secure to non secure to handle the interrupt , after handling it will again switch to secure world and this time secure world can be schedule to another core.

So as answer to your question it is not possible. As of now implementation TZ runs in single core and only one core can execute that at one time.

just to more clarify if secure application need to perform some file operation (as TZ doesn't have the file system it uses some listener to non secure side to perform that action then again context switch will happen)



来源:https://stackoverflow.com/questions/26469419/trustzone-scheduling-processes-from-the-two-worlds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!