Commit 26bd5f82 authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

SPM: Move initialization flag to context struct



Whether a Secure Partition is being initialized or not is something
related to that specific partition, so it should be saved with the
rest of the information related to it.

Change-Id: Ie8a780f70df83fb03ef9c01ba37960208d9b5319
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent 34c2b9c2
...@@ -29,7 +29,6 @@ static spinlock_t mem_attr_smc_lock; ...@@ -29,7 +29,6 @@ static spinlock_t mem_attr_smc_lock;
* Secure Partition context information. * Secure Partition context information.
******************************************************************************/ ******************************************************************************/
static secure_partition_context_t sp_ctx; static secure_partition_context_t sp_ctx;
unsigned int sp_init_in_progress;
/******************************************************************************* /*******************************************************************************
* Replace the S-EL1 re-entry information with S-EL0 re-entry * Replace the S-EL1 re-entry information with S-EL0 re-entry
...@@ -128,10 +127,10 @@ int32_t spm_init(void) ...@@ -128,10 +127,10 @@ int32_t spm_init(void)
/* /*
* Arrange for an entry into the secure partition. * Arrange for an entry into the secure partition.
*/ */
sp_init_in_progress = 1; sp_ctx.sp_init_in_progress = 1;
rc = spm_synchronous_sp_entry(&sp_ctx); rc = spm_synchronous_sp_entry(&sp_ctx);
assert(rc == 0); assert(rc == 0);
sp_init_in_progress = 0; sp_ctx.sp_init_in_progress = 0;
VERBOSE("SP_MEMORY_ATTRIBUTES_SET_AARCH64 availability has been revoked\n"); VERBOSE("SP_MEMORY_ATTRIBUTES_SET_AARCH64 availability has been revoked\n");
return rc; return rc;
...@@ -358,7 +357,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid, ...@@ -358,7 +357,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid,
cm_el1_sysregs_context_save(SECURE); cm_el1_sysregs_context_save(SECURE);
spm_setup_next_eret_into_sel0(handle); spm_setup_next_eret_into_sel0(handle);
if (sp_init_in_progress) { if (sp_ctx.sp_init_in_progress) {
/* /*
* SPM reports completion. The SPM must have * SPM reports completion. The SPM must have
* initiated the original request through a * initiated the original request through a
...@@ -391,7 +390,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid, ...@@ -391,7 +390,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid,
case SP_MEMORY_ATTRIBUTES_GET_AARCH64: case SP_MEMORY_ATTRIBUTES_GET_AARCH64:
INFO("Received SP_MEMORY_ATTRIBUTES_GET_AARCH64 SMC\n"); INFO("Received SP_MEMORY_ATTRIBUTES_GET_AARCH64 SMC\n");
if (!sp_init_in_progress) { if (!sp_ctx.sp_init_in_progress) {
WARN("SP_MEMORY_ATTRIBUTES_GET_AARCH64 is available at boot time only\n"); WARN("SP_MEMORY_ATTRIBUTES_GET_AARCH64 is available at boot time only\n");
SMC_RET1(handle, SPM_NOT_SUPPORTED); SMC_RET1(handle, SPM_NOT_SUPPORTED);
} }
...@@ -400,7 +399,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid, ...@@ -400,7 +399,7 @@ uint64_t spm_smc_handler(uint32_t smc_fid,
case SP_MEMORY_ATTRIBUTES_SET_AARCH64: case SP_MEMORY_ATTRIBUTES_SET_AARCH64:
INFO("Received SP_MEMORY_ATTRIBUTES_SET_AARCH64 SMC\n"); INFO("Received SP_MEMORY_ATTRIBUTES_SET_AARCH64 SMC\n");
if (!sp_init_in_progress) { if (!sp_ctx.sp_init_in_progress) {
WARN("SP_MEMORY_ATTRIBUTES_SET_AARCH64 is available at boot time only\n"); WARN("SP_MEMORY_ATTRIBUTES_SET_AARCH64 is available at boot time only\n");
SMC_RET1(handle, SPM_NOT_SUPPORTED); SMC_RET1(handle, SPM_NOT_SUPPORTED);
} }
......
...@@ -43,6 +43,7 @@ struct entry_point_info; ...@@ -43,6 +43,7 @@ struct entry_point_info;
typedef struct secure_partition_context { typedef struct secure_partition_context {
uint64_t c_rt_ctx; uint64_t c_rt_ctx;
cpu_context_t cpu_ctx; cpu_context_t cpu_ctx;
unsigned int sp_init_in_progress;
} secure_partition_context_t; } secure_partition_context_t;
uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx); uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx);
......
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