diff options
author | Achin Gupta <achin.gupta@arm.com> | 2019-10-28 09:03:13 +0000 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2020-06-01 15:25:18 +0100 |
commit | 0f414b743626cf1182f957163745e352af2fadd0 (patch) | |
tree | 4dc4cf4fa77ae2a3cc12bf34f0bc4b143e680684 | |
parent | b3622bf4d5b0d9b07ca67b7554f01514789a12a4 (diff) | |
download | arm-trusted-firmware-0f414b743626cf1182f957163745e352af2fadd0.tar.gz |
SPMD: [EXP] Use PSCI states to manage SPMC boot
This is a temporary solution, all secure world PSCI calls are meant to be
handled within S-EL2 which means the PSCI SPD callbacks need to be routed
to S-EL2 appropriately.
This patch replaces private states used by the SPMD to determine whether
SPMC has booted on a CPU with PSCI affinity states. This enables the SPMC
on the boot CPU to use the PSCI_CPU_ON function to begin initialisation
on secondary CPUs.
Change-Id: Ie29b31c18f1e9ede199dc2c9c506fafb13fed296
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
-rw-r--r-- | services/std_svc/spmd/spmd_main.c | 22 | ||||
-rw-r--r-- | services/std_svc/spmd/spmd_private.h | 6 |
2 files changed, 21 insertions, 7 deletions
diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c index c4ceb32c8..8bad325f8 100644 --- a/services/std_svc/spmd/spmd_main.c +++ b/services/std_svc/spmd/spmd_main.c @@ -132,19 +132,29 @@ __dead2 void spmd_spm_core_sync_exit(uint64_t rc) ******************************************************************************/ static int32_t spmd_init(void) { - spmd_spm_core_context_t *ctx = spmd_get_context(); + unsigned int linear_id = plat_my_core_pos(); + spmd_spm_core_context_t *spm_ctx = &spm_core_context[linear_id]; + uint32_t core_id = 0; uint64_t rc; VERBOSE("SPM Core init start.\n"); - ctx->state = SPMC_STATE_RESET; + spm_ctx->state = AFF_STATE_ON_PENDING; + + /* Set the SPMC context state on other CPUs to OFF */ + for (core_id = 0; core_id < PLATFORM_CORE_COUNT; core_id++) { + if (core_id != linear_id) { + spm_core_context[core_id].state = AFF_STATE_OFF; + } + } + - rc = spmd_spm_core_sync_entry(ctx); + rc = spmd_spm_core_sync_entry(spm_ctx); if (rc != 0ULL) { ERROR("SPMC initialisation failed 0x%llx\n", rc); return 0; } - ctx->state = SPMC_STATE_IDLE; + spm_ctx->state = SPMC_STATE_IDLE; VERBOSE("SPM Core init end.\n"); return 1; @@ -375,7 +385,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, * this CPU. If so, then indicate that the SPM Core initialised * unsuccessfully. */ - if (secure_origin && (ctx->state == SPMC_STATE_RESET)) { + if (secure_origin && (ctx->state == AFF_STATE_ON_PENDING)) { spmd_spm_core_sync_exit(x2); } @@ -499,7 +509,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, * this CPU from the Secure world. If so, then indicate that the * SPM Core initialised successfully. */ - if (secure_origin && (ctx->state == SPMC_STATE_RESET)) { + if (secure_origin && (ctx->state == AFF_STATE_ON_PENDING)) { spmd_spm_core_sync_exit(0); } diff --git a/services/std_svc/spmd/spmd_private.h b/services/std_svc/spmd/spmd_private.h index d5f66dde6..de63ebabc 100644 --- a/services/std_svc/spmd/spmd_private.h +++ b/services/std_svc/spmd/spmd_private.h @@ -30,6 +30,9 @@ #define SPMD_C_RT_CTX_ENTRIES (SPMD_C_RT_CTX_SIZE >> DWORD_SHIFT) #ifndef __ASSEMBLER__ +#include <lib/psci/psci.h> +#include <lib/spinlock.h> +#include <lib/utils.h> #include <services/spci_svc.h> #include <stdint.h> @@ -45,7 +48,8 @@ typedef enum spmc_state { typedef struct spmd_spm_core_context { uint64_t c_rt_ctx; cpu_context_t cpu_ctx; - spmc_state_t state; + aff_info_state_t state; + spinlock_t lock; } spmd_spm_core_context_t; /* |