summaryrefslogtreecommitdiff
path: root/bl32/tsp/tsp_main.c
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2014-05-09 20:49:17 +0100
committerAndrew Thoelke <andrew.thoelke@arm.com>2014-05-23 08:46:21 +0100
commit239b04fa31647100c537852b4a3fc8bd47e33aa6 (patch)
tree3b2c73b2d39ed0a460375b42f1f3143703646fbc /bl32/tsp/tsp_main.c
parenta20a81e5b4a19969673f672523b946647f5d545d (diff)
Non-Secure Interrupt support during Standard SMC processing in TSP
Implements support for Non Secure Interrupts preempting the Standard SMC call in EL1. Whenever an IRQ is trapped in the Secure world we securely handover to the Normal world to process the interrupt. The normal world then issues "resume" smc call to resume the previous interrupted SMC call. Fixes ARM-software/tf-issues#105 Change-Id: I72b760617dee27438754cdfc9fe9bcf4cc024858
Diffstat (limited to 'bl32/tsp/tsp_main.c')
-rw-r--r--bl32/tsp/tsp_main.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/bl32/tsp/tsp_main.c b/bl32/tsp/tsp_main.c
index ec74db4..1c3f3b9 100644
--- a/bl32/tsp/tsp_main.c
+++ b/bl32/tsp/tsp_main.c
@@ -66,6 +66,7 @@ work_statistics_t tsp_stats[PLATFORM_CORE_COUNT];
* to change.
******************************************************************************/
static const entry_info_t tsp_entry_info = {
+ tsp_std_smc_entry,
tsp_fast_smc_entry,
tsp_cpu_on_entry,
tsp_cpu_off_entry,
@@ -309,9 +310,9 @@ tsp_args_t *tsp_cpu_resume_main(uint64_t suspend_level,
* TSP fast smc handler. The secure monitor jumps to this function by
* doing the ERET after populating X0-X7 registers. The arguments are received
* in the function arguments in order. Once the service is rendered, this
- * function returns to Secure Monitor by raising SMC
+ * function returns to Secure Monitor by raising SMC.
******************************************************************************/
-tsp_args_t *tsp_fast_smc_handler(uint64_t func,
+tsp_args_t *tsp_smc_handler(uint64_t func,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
@@ -324,18 +325,20 @@ tsp_args_t *tsp_fast_smc_handler(uint64_t func,
uint64_t service_args[2];
uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr);
+ const char *smc_type;
/* Update this cpu's statistics */
tsp_stats[linear_id].smc_count++;
tsp_stats[linear_id].eret_count++;
- printf("SP: cpu 0x%x received fast smc 0x%x\n", read_mpidr(), func);
+ smc_type = ((func >> 31) & 1) == 1 ? "fast" : "standard";
+
+ printf("SP: cpu 0x%x received %s smc 0x%x\n", read_mpidr(), smc_type, func);
INFO("cpu 0x%x: %d smcs, %d erets\n", mpidr,
tsp_stats[linear_id].smc_count,
tsp_stats[linear_id].eret_count);
/* Render secure services and obtain results here */
-
results[0] = arg1;
results[1] = arg2;
@@ -346,20 +349,20 @@ tsp_args_t *tsp_fast_smc_handler(uint64_t func,
tsp_get_magic(service_args);
/* Determine the function to perform based on the function ID */
- switch (func) {
- case TSP_FID_ADD:
+ switch (TSP_BARE_FID(func)) {
+ case TSP_ADD:
results[0] += service_args[0];
results[1] += service_args[1];
break;
- case TSP_FID_SUB:
+ case TSP_SUB:
results[0] -= service_args[0];
results[1] -= service_args[1];
break;
- case TSP_FID_MUL:
+ case TSP_MUL:
results[0] *= service_args[0];
results[1] *= service_args[1];
break;
- case TSP_FID_DIV:
+ case TSP_DIV:
results[0] /= service_args[0] ? service_args[0] : 1;
results[1] /= service_args[1] ? service_args[1] : 1;
break;
@@ -367,9 +370,9 @@ tsp_args_t *tsp_fast_smc_handler(uint64_t func,
break;
}
- return set_smc_args(func,
+ return set_smc_args(func, 0,
results[0],
results[1],
- 0, 0, 0, 0, 0);
+ 0, 0, 0, 0);
}