diff options
author | Andrew Thoelke <andrew.thoelke@arm.com> | 2014-05-14 17:09:32 +0100 |
---|---|---|
committer | Andrew Thoelke <andrew.thoelke@arm.com> | 2014-06-11 12:10:16 +0100 |
commit | 08ab89d324e8d784f0d35b639b7c27b4ff3e5959 (patch) | |
tree | 72e3f55c277d2db0963ac8d27508d1e937d13dd0 /services/spd/tspd | |
parent | 977fbcd4e0842e590a961d6f40c14653caa9301a (diff) |
Provide cm_get/set_context() for current CPU
All callers of cm_get_context() pass the calling CPU MPIDR to the
function. Providing a specialised version for the current
CPU results in a reduction in code size and better readability.
The current function has been renamed to cm_get_context_by_mpidr()
and the existing name is now used for the current-CPU version.
The same treatment has been done to cm_set_context(), although
only both forms are used at present in the PSCI and TSPD code.
Change-Id: I91cb0c2f7bfcb950a045dbd9ff7595751c0c0ffb
Diffstat (limited to 'services/spd/tspd')
-rw-r--r-- | services/spd/tspd/tspd_common.c | 6 | ||||
-rw-r--r-- | services/spd/tspd/tspd_main.c | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/services/spd/tspd/tspd_common.c b/services/spd/tspd/tspd_common.c index 6b3592e..9242702 100644 --- a/services/spd/tspd/tspd_common.c +++ b/services/spd/tspd/tspd_common.c @@ -100,7 +100,7 @@ int32_t tspd_init_secure_context(uint64_t entrypoint, /* Associate this context with the cpu specified */ tsp_ctx->mpidr = mpidr; - cm_set_context(mpidr, &tsp_ctx->cpu_ctx, SECURE); + cm_set_context(&tsp_ctx->cpu_ctx, SECURE); spsr = SPSR_64(MODE_EL1, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS); cm_set_el3_eret_context(SECURE, entrypoint, spsr, scr); @@ -122,7 +122,7 @@ uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx) assert(tsp_ctx->c_rt_ctx == 0); /* Apply the Secure EL1 system register context and switch to it */ - assert(cm_get_context(read_mpidr(), SECURE) == &tsp_ctx->cpu_ctx); + assert(cm_get_context(SECURE) == &tsp_ctx->cpu_ctx); cm_el1_sysregs_context_restore(SECURE); cm_set_next_eret_context(SECURE); @@ -146,7 +146,7 @@ uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx) void tspd_synchronous_sp_exit(tsp_context_t *tsp_ctx, uint64_t ret) { /* Save the Secure EL1 system register context */ - assert(cm_get_context(read_mpidr(), SECURE) == &tsp_ctx->cpu_ctx); + assert(cm_get_context(SECURE) == &tsp_ctx->cpu_ctx); cm_el1_sysregs_context_save(SECURE); assert(tsp_ctx->c_rt_ctx != 0); diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c index 1a6913a..35bc6e2 100644 --- a/services/spd/tspd/tspd_main.c +++ b/services/spd/tspd/tspd_main.c @@ -95,7 +95,7 @@ static uint64_t tspd_sel1_interrupt_handler(uint32_t id, /* Sanity check the pointer to this cpu's context */ mpidr = read_mpidr(); - assert(handle == cm_get_context(mpidr, NON_SECURE)); + assert(handle == cm_get_context(NON_SECURE)); /* Save the non-secure context before entering the TSP */ cm_el1_sysregs_context_save(NON_SECURE); @@ -103,7 +103,7 @@ static uint64_t tspd_sel1_interrupt_handler(uint32_t id, /* Get a reference to this cpu's TSP context */ linear_id = platform_get_core_pos(mpidr); tsp_ctx = &tspd_sp_context[linear_id]; - assert(&tsp_ctx->cpu_ctx == cm_get_context(mpidr, SECURE)); + assert(&tsp_ctx->cpu_ctx == cm_get_context(SECURE)); /* * Determine if the TSP was previously preempted. Its last known @@ -275,10 +275,10 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, if (ns) SMC_RET1(handle, SMC_UNK); - assert(handle == cm_get_context(mpidr, SECURE)); + assert(handle == cm_get_context(SECURE)); cm_el1_sysregs_context_save(SECURE); /* Get a reference to the non-secure context */ - ns_cpu_context = cm_get_context(mpidr, NON_SECURE); + ns_cpu_context = cm_get_context(NON_SECURE); assert(ns_cpu_context); /* @@ -300,7 +300,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, if (ns) SMC_RET1(handle, SMC_UNK); - assert(handle == cm_get_context(mpidr, SECURE)); + assert(handle == cm_get_context(SECURE)); /* * Restore the relevant EL3 state which saved to service @@ -316,7 +316,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, } /* Get a reference to the non-secure context */ - ns_cpu_context = cm_get_context(mpidr, NON_SECURE); + ns_cpu_context = cm_get_context(NON_SECURE); assert(ns_cpu_context); /* @@ -339,7 +339,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, if (ns) SMC_RET1(handle, SMC_UNK); - assert(handle == cm_get_context(mpidr, SECURE)); + assert(handle == cm_get_context(SECURE)); /* Assert that standard SMC execution has been preempted */ assert(get_std_smc_active_flag(tsp_ctx->state)); @@ -348,7 +348,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, cm_el1_sysregs_context_save(SECURE); /* Get a reference to the non-secure context */ - ns_cpu_context = cm_get_context(mpidr, NON_SECURE); + ns_cpu_context = cm_get_context(NON_SECURE); assert(ns_cpu_context); /* Restore non-secure state */ @@ -434,7 +434,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, * registers need to be preserved, save the non-secure * state and send the request to the secure payload. */ - assert(handle == cm_get_context(mpidr, NON_SECURE)); + assert(handle == cm_get_context(NON_SECURE)); /* Check if we are already preempted */ if (get_std_smc_active_flag(tsp_ctx->state)) @@ -457,7 +457,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, * payload. Entry into S-EL1 will take place upon exit * from this function. */ - assert(&tsp_ctx->cpu_ctx == cm_get_context(mpidr, SECURE)); + assert(&tsp_ctx->cpu_ctx == cm_get_context(SECURE)); /* Set appropriate entry for SMC. * We expect the TSP to manage the PSTATE.I and PSTATE.F @@ -482,11 +482,11 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, * into the non-secure context, save the secure state * and return to the non-secure state. */ - assert(handle == cm_get_context(mpidr, SECURE)); + assert(handle == cm_get_context(SECURE)); cm_el1_sysregs_context_save(SECURE); /* Get a reference to the non-secure context */ - ns_cpu_context = cm_get_context(mpidr, NON_SECURE); + ns_cpu_context = cm_get_context(NON_SECURE); assert(ns_cpu_context); /* Restore non-secure state */ @@ -515,7 +515,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, * save the non-secure state and send the request to * the secure payload. */ - assert(handle == cm_get_context(mpidr, NON_SECURE)); + assert(handle == cm_get_context(NON_SECURE)); /* Check if we are already preempted before resume */ if (!get_std_smc_active_flag(tsp_ctx->state)) |