diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2018-01-16 10:04:16 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2018-01-22 14:49:46 +0000 |
commit | 992788147ff7461b37eb52f17ad962ef21fc372f (patch) | |
tree | 595d0856f8984e4c6a6c6172167ef78277a84cd5 /cactus | |
parent | a3077f97cf34e827bfa57d856d395ee98493f1d2 (diff) |
FVP: Add support for comm. buffer in MM_COMMUNICATE
The MM_COMMUNICATE SMC interface supports passing a communication
buffer for additional payload data from normal world to the secure
partition. This commit adds support to use it.
On the TFTF side, the memory mappings have been changed to map this
memory buffer area. This allows TFTF tests to fill in this buffer to
pass data associated to secure service requests. The number of
translation tables had to be increased to map this new memory region.
On Cactus' side, the secure services loop has been modified to read
the communication buffer for MM_COMMUNICATE messages.
A common data structure has been defined, that corresponds to the
type of information that TFTF and Cactus will exchange through
MM_COMMUNICATE messages. The structure might evolve in the future
as we get a better idea of the kind of data that need to be passed
for secure services requests.
The existing MM_COMMUNICATE tests in TFTF have been modified to
pass a valid communication buffer address with a dummy ID.
Change-Id: I2df80a3e64f77eb229783802201a01008d3f9c2f
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Diffstat (limited to 'cactus')
-rw-r--r-- | cactus/cactus_main.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/cactus/cactus_main.c b/cactus/cactus_main.c index f04b1b4..3dd5009 100644 --- a/cactus/cactus_main.c +++ b/cactus/cactus_main.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include <assert.h> #include <console.h> #include <debug.h> #include <mm_svc.h> @@ -57,6 +58,9 @@ static void cactus_print_memory_layout(const secure_partition_boot_info_t *boot_ (void *) boot_info->sp_ns_comm_buf_base, (void *)(boot_info->sp_ns_comm_buf_base + boot_info->sp_ns_comm_buf_size)); + assert(boot_info->sp_ns_comm_buf_base == ARM_SECURE_SERVICE_BUFFER_BASE); + assert(boot_info->sp_ns_comm_buf_size == ARM_SECURE_SERVICE_BUFFER_SIZE); + NOTICE(" Stacks region (%u CPUS) : %p - %p\n", boot_info->num_cpus, (void *) boot_info->sp_stack_base, @@ -72,6 +76,8 @@ static void cactus_print_memory_layout(const secure_partition_boot_info_t *boot_ } + + static __dead2 void secure_services_loop(void) { int32_t event_status_code; @@ -92,18 +98,56 @@ static __dead2 void secure_services_loop(void) switch (event_id) { case MM_COMMUNICATE_AARCH64: + { + uint64_t ctx_addr = svc_values.arg1; + uint32_t ctx_size = svc_values.arg2; + uint64_t cookie = svc_values.arg3; + + NOTICE("Cactus: Received MM_COMMUNICATE_AARCH64 call\n"); + NOTICE("Cactus: Context address: 0x%lx\n", ctx_addr); + NOTICE("Cactus: Context size : %u\n", ctx_size); + NOTICE("Cactus: Cookie : 0x%lx\n", cookie); + + if (ctx_addr == 0) { + ERROR("Context address is invalid\n"); + event_status_code = SPM_INVALID_PARAMETER; + continue; + } + + secure_partition_request_info_t *sps = (void *)(uintptr_t) ctx_addr; + NOTICE("Received fast secure service request with ID #%u\n", + sps->id); + event_status_code = SPM_SUCCESS; + break; + } + case MM_COMMUNICATE_AARCH32: - NOTICE("Cactus: Received MM_COMMUNICATE call on CPU #%lu\n", - svc_values.arg3); - NOTICE("Cactus: Context address: %p\n", (void *) svc_values.arg1); - NOTICE("Cactus: Context size : %lu\n", svc_values.arg2); - NOTICE("Cactus: Cookie : 0x%lx\n", svc_values.arg3); + { + uint32_t ctx_addr = svc_values.arg1; + uint32_t ctx_size = svc_values.arg2; + uint32_t cookie = svc_values.arg3; + + NOTICE("Cactus: Received MM_COMMUNICATE_AARCH32 call\n"); + NOTICE("Cactus: Context address: 0x%x\n", ctx_addr); + NOTICE("Cactus: Context size : %u\n", ctx_size); + NOTICE("Cactus: Cookie : 0x%x\n", cookie); + + if (ctx_addr == 0) { + ERROR("Context address is invalid\n"); + event_status_code = SPM_INVALID_PARAMETER; + continue; + } + + secure_partition_request_info_t *sps = (void *)(uintptr_t) ctx_addr; + NOTICE("Received fast secure service request with ID #%u\n", + sps->id); event_status_code = SPM_SUCCESS; break; + } default: NOTICE("Unhandled Service ID 0x%x\n", event_id); - event_status_code = -1; + event_status_code = SPM_NOT_SUPPORTED; break; } } |