@@ -112,6 +112,83 @@ kernel are handled by the kernel driver. Other RPC messages will be forwarded to
112112tee-supplicant without further involvement of the driver, except switching
113113shared memory buffer representation.
114114
115+ AMD-TEE driver
116+ ==============
117+
118+ The AMD-TEE driver handles the communication with AMD's TEE environment. The
119+ TEE environment is provided by AMD Secure Processor.
120+
121+ The AMD Secure Processor (formerly called Platform Security Processor or PSP)
122+ is a dedicated processor that features ARM TrustZone technology, along with a
123+ software-based Trusted Execution Environment (TEE) designed to enable
124+ third-party Trusted Applications. This feature is currently enabled only for
125+ APUs.
126+
127+ The following picture shows a high level overview of AMD-TEE::
128+
129+ |
130+ x86 |
131+ |
132+ User space (Kernel space) | AMD Secure Processor (PSP)
133+ ~~~~~~~~~~ ~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
134+ |
135+ +--------+ | +-------------+
136+ | Client | | | Trusted |
137+ +--------+ | | Application |
138+ /\ | +-------------+
139+ || | /\
140+ || | ||
141+ || | \/
142+ || | +----------+
143+ || | | TEE |
144+ || | | Internal |
145+ \/ | | API |
146+ +---------+ +-----------+---------+ +----------+
147+ | TEE | | TEE | AMD-TEE | | AMD-TEE |
148+ | Client | | subsystem | driver | | Trusted |
149+ | API | | | | | OS |
150+ +---------+-----------+----+------+---------+---------+----------+
151+ | Generic TEE API | | ASP | Mailbox |
152+ | IOCTL (TEE_IOC_*) | | driver | Register Protocol |
153+ +--------------------------+ +---------+--------------------+
154+
155+ At the lowest level (in x86), the AMD Secure Processor (ASP) driver uses the
156+ CPU to PSP mailbox regsister to submit commands to the PSP. The format of the
157+ command buffer is opaque to the ASP driver. It's role is to submit commands to
158+ the secure processor and return results to AMD-TEE driver. The interface
159+ between AMD-TEE driver and AMD Secure Processor driver can be found in [6].
160+
161+ The AMD-TEE driver packages the command buffer payload for processing in TEE.
162+ The command buffer format for the different TEE commands can be found in [7].
163+
164+ The TEE commands supported by AMD-TEE Trusted OS are:
165+ * TEE_CMD_ID_LOAD_TA - loads a Trusted Application (TA) binary into
166+ TEE environment.
167+ * TEE_CMD_ID_UNLOAD_TA - unloads TA binary from TEE environment.
168+ * TEE_CMD_ID_OPEN_SESSION - opens a session with a loaded TA.
169+ * TEE_CMD_ID_CLOSE_SESSION - closes session with loaded TA
170+ * TEE_CMD_ID_INVOKE_CMD - invokes a command with loaded TA
171+ * TEE_CMD_ID_MAP_SHARED_MEM - maps shared memory
172+ * TEE_CMD_ID_UNMAP_SHARED_MEM - unmaps shared memory
173+
174+ AMD-TEE Trusted OS is the firmware running on AMD Secure Processor.
175+
176+ The AMD-TEE driver registers itself with TEE subsystem and implements the
177+ following driver function callbacks:
178+
179+ * get_version - returns the driver implementation id and capability.
180+ * open - sets up the driver context data structure.
181+ * release - frees up driver resources.
182+ * open_session - loads the TA binary and opens session with loaded TA.
183+ * close_session - closes session with loaded TA and unloads it.
184+ * invoke_func - invokes a command with loaded TA.
185+
186+ cancel_req driver callback is not supported by AMD-TEE.
187+
188+ The GlobalPlatform TEE Client API [5] can be used by the user space (client) to
189+ talk to AMD's TEE. AMD's TEE provides a secure environment for loading, opening
190+ a session, invoking commands and clossing session with TA.
191+
115192References
116193==========
117194
@@ -125,3 +202,7 @@ References
125202
126203[5] http://www.globalplatform.org/specificationsdevice.asp look for
127204 "TEE Client API Specification v1.0" and click download.
205+
206+ [6] include/linux/psp-tee.h
207+
208+ [7] drivers/tee/amdtee/amdtee_if.h
0 commit comments