Commit 6693962c authored by Varun Wadekar's avatar Varun Wadekar
Browse files

Open/Close TA sessions, send commands/events to TAs



This patch adds support to open/close secure sessions with Trusted
Apps and later send commands/events. Modify TLK_NUM_FID to indicate
the total number of FIDs available to the NS world.

Change-Id: I3f1153dfa5510bd44fc25f1fee85cae475b1abf1
Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent f9d25054
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
* Generate function IDs for the Trusted OS/Apps * Generate function IDs for the Trusted OS/Apps
*/ */
#define TLK_TOS_STD_FID(fid) ((fid) | 0x72000000 | (0 << 31)) #define TLK_TOS_STD_FID(fid) ((fid) | 0x72000000 | (0 << 31))
#define TLK_TA_STD_FID(fid) ((fid) | 0x70000000 | (0 << 31))
/* /*
* Trusted OS specific function IDs * Trusted OS specific function IDs
...@@ -53,10 +54,18 @@ ...@@ -53,10 +54,18 @@
#define TLK_VA_TRANSLATE (0x32000004 | (1 << 31)) #define TLK_VA_TRANSLATE (0x32000004 | (1 << 31))
#define TLK_FID_SHARED_MEMBUF (0x32000005 | (1 << 31)) #define TLK_FID_SHARED_MEMBUF (0x32000005 | (1 << 31))
/*
* Trusted Application specific function IDs
*/
#define TLK_OPEN_TA_SESSION TLK_TA_STD_FID(0x1)
#define TLK_CLOSE_TA_SESSION TLK_TA_STD_FID(0x2)
#define TLK_TA_LAUNCH_OP TLK_TA_STD_FID(0x3)
#define TLK_TA_SEND_EVENT TLK_TA_STD_FID(0x4)
/* /*
* Total number of function IDs implemented for services offered to NS clients. * Total number of function IDs implemented for services offered to NS clients.
*/ */
#define TLK_NUM_FID 0 #define TLK_NUM_FID 7
/* TLK implementation version numbers */ /* TLK implementation version numbers */
#define TLK_VERSION_MAJOR 0x0 /* Major version */ #define TLK_VERSION_MAJOR 0x0 /* Major version */
......
...@@ -193,6 +193,10 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid, ...@@ -193,6 +193,10 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
/* Passing a NULL context is a critical programming error */ /* Passing a NULL context is a critical programming error */
assert(handle); assert(handle);
/* These SMCs are only supported by CPU0 */
if ((read_mpidr() & MPIDR_CPU_MASK) != 0)
SMC_RET1(handle, SMC_UNK);
/* Determine which security state this SMC originated from */ /* Determine which security state this SMC originated from */
ns = is_caller_non_secure(flags); ns = is_caller_non_secure(flags);
...@@ -267,9 +271,16 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid, ...@@ -267,9 +271,16 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
* b. register shared memory with the SP for passing args * b. register shared memory with the SP for passing args
* required for maintaining sessions with the Trusted * required for maintaining sessions with the Trusted
* Applications. * Applications.
* c. open/close sessions
* d. issue commands to the Trusted Apps
*/ */
case TLK_REGISTER_LOGBUF: case TLK_REGISTER_LOGBUF:
case TLK_REGISTER_REQBUF: case TLK_REGISTER_REQBUF:
case TLK_OPEN_TA_SESSION:
case TLK_CLOSE_TA_SESSION:
case TLK_TA_LAUNCH_OP:
case TLK_TA_SEND_EVENT:
if (!ns || !tlk_args_results_buf) if (!ns || !tlk_args_results_buf)
SMC_RET1(handle, SMC_UNK); SMC_RET1(handle, SMC_UNK);
...@@ -442,3 +453,25 @@ DECLARE_RT_SVC( ...@@ -442,3 +453,25 @@ DECLARE_RT_SVC(
NULL, NULL,
tlkd_smc_handler tlkd_smc_handler
); );
/* Define a SPD runtime service descriptor for fast SMC calls */
DECLARE_RT_SVC(
tlkd_tap_fast,
OEN_TAP_START,
OEN_TAP_END,
SMC_TYPE_FAST,
NULL,
tlkd_smc_handler
);
/* Define a SPD runtime service descriptor for standard SMC calls */
DECLARE_RT_SVC(
tlkd_tap_std,
OEN_TAP_START,
OEN_TAP_END,
SMC_TYPE_STD,
NULL,
tlkd_smc_handler
);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment