~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/psp-tee.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: MIT */
  2 /*
  3  * AMD Trusted Execution Environment (TEE) interface
  4  *
  5  * Author: Rijo Thomas <Rijo-john.Thomas@amd.com>
  6  *
  7  * Copyright 2019 Advanced Micro Devices, Inc.
  8  *
  9  */
 10 
 11 #ifndef __PSP_TEE_H_
 12 #define __PSP_TEE_H_
 13 
 14 #include <linux/types.h>
 15 #include <linux/errno.h>
 16 
 17 /* This file defines the Trusted Execution Environment (TEE) interface commands
 18  * and the API exported by AMD Secure Processor driver to communicate with
 19  * AMD-TEE Trusted OS.
 20  */
 21 
 22 /**
 23  * enum tee_cmd_id - TEE Interface Command IDs
 24  * @TEE_CMD_ID_LOAD_TA:          Load Trusted Application (TA) binary into
 25  *                               TEE environment
 26  * @TEE_CMD_ID_UNLOAD_TA:        Unload TA binary from TEE environment
 27  * @TEE_CMD_ID_OPEN_SESSION:     Open session with loaded TA
 28  * @TEE_CMD_ID_CLOSE_SESSION:    Close session with loaded TA
 29  * @TEE_CMD_ID_INVOKE_CMD:       Invoke a command with loaded TA
 30  * @TEE_CMD_ID_MAP_SHARED_MEM:   Map shared memory
 31  * @TEE_CMD_ID_UNMAP_SHARED_MEM: Unmap shared memory
 32  */
 33 enum tee_cmd_id {
 34         TEE_CMD_ID_LOAD_TA = 1,
 35         TEE_CMD_ID_UNLOAD_TA,
 36         TEE_CMD_ID_OPEN_SESSION,
 37         TEE_CMD_ID_CLOSE_SESSION,
 38         TEE_CMD_ID_INVOKE_CMD,
 39         TEE_CMD_ID_MAP_SHARED_MEM,
 40         TEE_CMD_ID_UNMAP_SHARED_MEM,
 41 };
 42 
 43 #ifdef CONFIG_CRYPTO_DEV_SP_PSP
 44 /**
 45  * psp_tee_process_cmd() - Process command in Trusted Execution Environment
 46  * @cmd_id:     TEE command ID (&enum tee_cmd_id)
 47  * @buf:        Command buffer for TEE processing. On success, is updated
 48  *              with the response
 49  * @len:        Length of command buffer in bytes
 50  * @status:     On success, holds the TEE command execution status
 51  *
 52  * This function submits a command to the Trusted OS for processing in the
 53  * TEE environment and waits for a response or until the command times out.
 54  *
 55  * Returns:
 56  * 0 if TEE successfully processed the command
 57  * -%ENODEV    if PSP device not available
 58  * -%EINVAL    if invalid input
 59  * -%ETIMEDOUT if TEE command timed out
 60  * -%EBUSY     if PSP device is not responsive
 61  */
 62 int psp_tee_process_cmd(enum tee_cmd_id cmd_id, void *buf, size_t len,
 63                         u32 *status);
 64 
 65 /**
 66  * psp_check_tee_status() - Checks whether there is a TEE which a driver can
 67  * talk to.
 68  *
 69  * This function can be used by AMD-TEE driver to query if there is TEE with
 70  * which it can communicate.
 71  *
 72  * Returns:
 73  * 0          if the device has TEE
 74  * -%ENODEV   if there is no TEE available
 75  */
 76 int psp_check_tee_status(void);
 77 
 78 #else /* !CONFIG_CRYPTO_DEV_SP_PSP */
 79 
 80 static inline int psp_tee_process_cmd(enum tee_cmd_id cmd_id, void *buf,
 81                                       size_t len, u32 *status)
 82 {
 83         return -ENODEV;
 84 }
 85 
 86 static inline int psp_check_tee_status(void)
 87 {
 88         return -ENODEV;
 89 }
 90 #endif /* CONFIG_CRYPTO_DEV_SP_PSP */
 91 #endif /* __PSP_TEE_H_ */
 92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php