amd-tee.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =============================================
  3. AMD-TEE (AMD's Trusted Execution Environment)
  4. =============================================
  5. The AMD-TEE driver handles the communication with AMD's TEE environment. The
  6. TEE environment is provided by AMD Secure Processor.
  7. The AMD Secure Processor (formerly called Platform Security Processor or PSP)
  8. is a dedicated processor that features ARM TrustZone technology, along with a
  9. software-based Trusted Execution Environment (TEE) designed to enable
  10. third-party Trusted Applications. This feature is currently enabled only for
  11. APUs.
  12. The following picture shows a high level overview of AMD-TEE::
  13. |
  14. x86 |
  15. |
  16. User space (Kernel space) | AMD Secure Processor (PSP)
  17. ~~~~~~~~~~ ~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. |
  19. +--------+ | +-------------+
  20. | Client | | | Trusted |
  21. +--------+ | | Application |
  22. /\ | +-------------+
  23. || | /\
  24. || | ||
  25. || | \/
  26. || | +----------+
  27. || | | TEE |
  28. || | | Internal |
  29. \/ | | API |
  30. +---------+ +-----------+---------+ +----------+
  31. | TEE | | TEE | AMD-TEE | | AMD-TEE |
  32. | Client | | subsystem | driver | | Trusted |
  33. | API | | | | | OS |
  34. +---------+-----------+----+------+---------+---------+----------+
  35. | Generic TEE API | | ASP | Mailbox |
  36. | IOCTL (TEE_IOC_*) | | driver | Register Protocol |
  37. +--------------------------+ +---------+--------------------+
  38. At the lowest level (in x86), the AMD Secure Processor (ASP) driver uses the
  39. CPU to PSP mailbox register to submit commands to the PSP. The format of the
  40. command buffer is opaque to the ASP driver. It's role is to submit commands to
  41. the secure processor and return results to AMD-TEE driver. The interface
  42. between AMD-TEE driver and AMD Secure Processor driver can be found in [1].
  43. The AMD-TEE driver packages the command buffer payload for processing in TEE.
  44. The command buffer format for the different TEE commands can be found in [2].
  45. The TEE commands supported by AMD-TEE Trusted OS are:
  46. * TEE_CMD_ID_LOAD_TA - loads a Trusted Application (TA) binary into
  47. TEE environment.
  48. * TEE_CMD_ID_UNLOAD_TA - unloads TA binary from TEE environment.
  49. * TEE_CMD_ID_OPEN_SESSION - opens a session with a loaded TA.
  50. * TEE_CMD_ID_CLOSE_SESSION - closes session with loaded TA
  51. * TEE_CMD_ID_INVOKE_CMD - invokes a command with loaded TA
  52. * TEE_CMD_ID_MAP_SHARED_MEM - maps shared memory
  53. * TEE_CMD_ID_UNMAP_SHARED_MEM - unmaps shared memory
  54. AMD-TEE Trusted OS is the firmware running on AMD Secure Processor.
  55. The AMD-TEE driver registers itself with TEE subsystem and implements the
  56. following driver function callbacks:
  57. * get_version - returns the driver implementation id and capability.
  58. * open - sets up the driver context data structure.
  59. * release - frees up driver resources.
  60. * open_session - loads the TA binary and opens session with loaded TA.
  61. * close_session - closes session with loaded TA and unloads it.
  62. * invoke_func - invokes a command with loaded TA.
  63. cancel_req driver callback is not supported by AMD-TEE.
  64. The GlobalPlatform TEE Client API [3] can be used by the user space (client) to
  65. talk to AMD's TEE. AMD's TEE provides a secure environment for loading, opening
  66. a session, invoking commands and closing session with TA.
  67. References
  68. ==========
  69. [1] include/linux/psp-tee.h
  70. [2] drivers/tee/amdtee/amdtee_if.h
  71. [3] http://www.globalplatform.org/specificationsdevice.asp look for
  72. "TEE Client API Specification v1.0" and click download.