1.. SPDX-License-Identifier: GPL-2.0
2.. tee:
3
4==================================================
5TEE (Trusted Execution Environment) Userspace API
6==================================================
7
8include/uapi/linux/tee.h defines the generic interface to a TEE.
9
10User space (the client) connects to the driver by opening /dev/tee[0-9]* or
11/dev/teepriv[0-9]*.
12
13- TEE_IOC_SHM_ALLOC allocates shared memory and returns a file descriptor
14  which user space can mmap. When user space doesn't need the file
15  descriptor any more, it should be closed. When shared memory isn't needed
16  any longer it should be unmapped with munmap() to allow the reuse of
17  memory.
18
19- TEE_IOC_VERSION lets user space know which TEE this driver handles and
20  its capabilities.
21
22- TEE_IOC_OPEN_SESSION opens a new session to a Trusted Application.
23
24- TEE_IOC_INVOKE invokes a function in a Trusted Application.
25
26- TEE_IOC_CANCEL may cancel an ongoing TEE_IOC_OPEN_SESSION or TEE_IOC_INVOKE.
27
28- TEE_IOC_CLOSE_SESSION closes a session to a Trusted Application.
29
30There are two classes of clients, normal clients and supplicants. The latter is
31a helper process for the TEE to access resources in Linux, for example file
32system access. A normal client opens /dev/tee[0-9]* and a supplicant opens
33/dev/teepriv[0-9].
34
35Much of the communication between clients and the TEE is opaque to the
36driver. The main job for the driver is to receive requests from the
37clients, forward them to the TEE and send back the results. In the case of
38supplicants the communication goes in the other direction, the TEE sends
39requests to the supplicant which then sends back the result.
40