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 osto run invela, such as basic modules for operations likeatomic,fs,mem, etc.server: It is used to receive and handle all requests forvela teeinitiated byvela ap, such as operations like openingopen TA,invoke TA cmd, etc.wasm: It is used to support thewasm TAspecific tovelato 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_fshost_fsis mainly used to implement theree fsoperations required byoptee os. Inoptee os, the implementation ofree fsforwards all operations related to the file system toreefor processing. This is because the support for file system operations inoptee ositself is limited, so complex file system operations need to be transferred across cores toreefor processing. However, sincevela teeis a fully functional operating system and also supports complex file system operations intee, theree fsinvela teecan be completed directly on thevela teeside. Andhost_fsis used to implement this function.
-
rpmb_fsrpmb_fsis mainly used to implement the implementation of therpmbdriver required byoptee os.vela teeitself supports therpmbdriver, and then throughrpmb_fs, therpmbdriver 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.