tee.rst 1.6 KB

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