From: Antonio Nino Diaz Date: Tue, 30 Oct 2018 12:50:41 +0000 (+0000) Subject: SPM: Remove old SMC interfaces X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b212ca91cbbe6542ea751b4c4c09766e2665bf5d;p=project%2Fbcm63xx%2Fatf.git SPM: Remove old SMC interfaces Remove interfaces based on MM_COMMUNICATE. Change-Id: I628c884b91d9f4758269ea2c4dedc37a66bb93cf Signed-off-by: Antonio Nino Diaz --- diff --git a/include/services/mm_svc.h b/include/services/mm_svc.h index ed2b3245..e2ce90fd 100644 --- a/include/services/mm_svc.h +++ b/include/services/mm_svc.h @@ -7,6 +7,8 @@ #ifndef MM_SVC_H #define MM_SVC_H +#if SPM_DEPRECATED + #include #define MM_VERSION_MAJOR U(1) @@ -28,4 +30,6 @@ #define MM_COMMUNICATE_AARCH64 U(0xC4000041) #define MM_COMMUNICATE_AARCH32 U(0x84000041) +#endif /* SPM_DEPRECATED */ + #endif /* MM_SVC_H */ diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c index 6de4858b..c4cd8882 100644 --- a/services/std_svc/spm/spm_main.c +++ b/services/std_svc/spm/spm_main.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -200,91 +199,6 @@ int32_t spm_setup(void) return 0; } -/******************************************************************************* - * Function to perform a call to a Secure Partition. - ******************************************************************************/ -uint64_t spm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3) -{ - uint64_t rc; - sp_context_t *sp_ptr = &sp_ctx; - - /* Wait until the Secure Partition is idle and set it to busy. */ - sp_state_wait_switch(sp_ptr, SP_STATE_IDLE, SP_STATE_BUSY); - - /* Set values for registers on SP entry */ - cpu_context_t *cpu_ctx = &(sp_ptr->cpu_ctx); - - write_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X0, smc_fid); - write_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X1, x1); - write_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X2, x2); - write_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X3, x3); - - /* Jump to the Secure Partition. */ - rc = spm_sp_synchronous_entry(sp_ptr); - - /* Flag Secure Partition as idle. */ - assert(sp_ptr->state == SP_STATE_BUSY); - sp_state_set(sp_ptr, SP_STATE_IDLE); - - return rc; -} - -/******************************************************************************* - * MM_COMMUNICATE handler - ******************************************************************************/ -static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie, - uint64_t comm_buffer_address, - uint64_t comm_size_address, void *handle) -{ - uint64_t rc; - - /* Cookie. Reserved for future use. It must be zero. */ - if (mm_cookie != 0U) { - ERROR("MM_COMMUNICATE: cookie is not zero\n"); - SMC_RET1(handle, SPM_INVALID_PARAMETER); - } - - if (comm_buffer_address == 0U) { - ERROR("MM_COMMUNICATE: comm_buffer_address is zero\n"); - SMC_RET1(handle, SPM_INVALID_PARAMETER); - } - - if (comm_size_address != 0U) { - VERBOSE("MM_COMMUNICATE: comm_size_address is not 0 as recommended.\n"); - } - - /* - * The current secure partition design mandates - * - at any point, only a single core can be - * executing in the secure partiton. - * - a core cannot be preempted by an interrupt - * while executing in secure partition. - * Raise the running priority of the core to the - * interrupt level configured for secure partition - * so as to block any interrupt from preempting this - * core. - */ - ehf_activate_priority(PLAT_SP_PRI); - - /* Save the Normal world context */ - cm_el1_sysregs_context_save(NON_SECURE); - - rc = spm_sp_call(smc_fid, comm_buffer_address, comm_size_address, - plat_my_core_pos()); - - /* Restore non-secure state */ - cm_el1_sysregs_context_restore(NON_SECURE); - cm_set_next_eret_context(NON_SECURE); - - /* - * Exited from secure partition. This core can take - * interrupts now. - */ - ehf_deactivate_priority(PLAT_SP_PRI); - - SMC_RET1(handle, rc); -} - /******************************************************************************* * Secure Partition Manager SMC handler. ******************************************************************************/ @@ -316,9 +230,6 @@ uint64_t spm_smc_handler(uint32_t smc_fid, case SPM_VERSION_AARCH32: SMC_RET1(handle, SPM_VERSION_COMPILED); - case SP_EVENT_COMPLETE_AARCH64: - spm_sp_synchronous_exit(x1); - case SP_MEMORY_ATTRIBUTES_GET_AARCH64: INFO("Received SP_MEMORY_ATTRIBUTES_GET_AARCH64 SMC\n"); @@ -351,13 +262,6 @@ uint64_t spm_smc_handler(uint32_t smc_fid, switch (smc_fid) { - case MM_VERSION_AARCH32: - SMC_RET1(handle, MM_VERSION_COMPILED); - - case MM_COMMUNICATE_AARCH32: - case MM_COMMUNICATE_AARCH64: - return mm_communicate(smc_fid, x1, x2, x3, handle); - case SP_MEMORY_ATTRIBUTES_GET_AARCH64: case SP_MEMORY_ATTRIBUTES_SET_AARCH64: /* SMC interfaces reserved for secure callers. */