optee_vela
itself is used to implement an adaptation layer between Vela tee
and optee os
, enabling optee_os
to run within the Vela tee
system.
Therefore, the TA
(Trusted Application) and CA
(Client Application) programs in optee_os
can all run directly in the vela
system.
With the help of optee_vela
, we don't need to make any modifications to the optee_os
project itself to make optee_os
run completely within vela
.
The following is the position of optee_vela
itself within the entire Vela tee
system:
+-------------------------------------------------------+
| optee os |
+-------------------------------------------------------+
| optee_vela |
+-------------------------------------------------------+
| vela kernel |
+-------------------------------------------------------+
optee_vela
mainly contains three parts of functions:
compat
: It is a system module used to support the upper framework ofoptee os
to run invela
, such as basic modules for operations likeatomic
,fs
,mem
, etc.server
: It is used to receive and handle all requests forvela tee
initiated byvela ap
, such as operations like openingopen TA
,invoke TA cmd
, etc.wasm
: It is used to support thewasm TA
specific tovela
to run inoptee os
.
The following is an introduction for each part respectively:
The compat
adaptation layer mainly implements the system APIs required by the upper framework of optee os
using the system APIs of vela
, such as basic APIs like atomic
, mem
, fs
, etc.
The following is an introduction to the main replaced API modules:
- fs
The fs
module mainly consists of two parts:
-
host_fs
host_fs
is mainly used to implement theree fs
operations required byoptee os
. Inoptee os
, the implementation ofree fs
forwards all operations related to the file system toree
for processing. This is because the support for file system operations inoptee os
itself is limited, so complex file system operations need to be transferred across cores toree
for processing. However, sincevela tee
is a fully functional operating system and also supports complex file system operations intee
, theree fs
invela tee
can be completed directly on thevela tee
side. Andhost_fs
is used to implement this function.
-
rpmb_fs
rpmb_fs
is mainly used to implement the implementation of therpmb
driver required byoptee os
.vela tee
itself supports therpmb
driver, and then throughrpmb_fs
, therpmb
driver can be directly used inoptee os
.
atomic
This API module mainly replaces the atomic
and spinlock
required for the operation of optee os
with the atomic
and spinlock
interface implementations supported by the vela
system.
In vela
, the communication process between vela ap
and vela tee
is carried out through rpmsg socket
.
In this process, we can regard vela ap
as the client and vela tee
as the server.
The server
in vela tee
is implemented as an rpmsg socket server
, which is used to receive and handle requests initiated by the rpmsg socket client
.
The server
part itself is used to complete the request processing for vela tee
initiated by vela ap
.
The server
part will create an opteed
task.
Then, when the system starts, opteed
will be started in the background:
opteed &
vela tee
itself supports wasm TA
. wasm TA
means that the TA
program itself is compiled and linked in the format of wasm
bytecode, and then during runtime, it is loaded and run by the wamr framework
built into vela tee
.