Test: Add SST test partition
Adds an SST test partition, which can be used to call the
sst_system_prepare() function from the SST test partition's
context.
Change-Id: Ib07a88e5f05fc181da2b9276279e57618fb059e4
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 6a56a05..6cc8d6c 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -222,6 +222,12 @@
embedded_set_target_link_defines(TARGET ${EXE_NAME} DEFINES "TFM_PARTITION_TEST_SECURE_SERVICES")
endif()
+ if (NOT DEFINED TFM_PARTITION_TEST_SST)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined.")
+ elseif (TFM_PARTITION_TEST_SST)
+ embedded_set_target_link_defines(TARGET ${EXE_NAME} DEFINES "TFM_PARTITION_TEST_SST")
+ endif()
+
if (NOT DEFINED TEST_FRAMEWORK_S)
message(FATAL_ERROR "Incomplete build configuration: TEST_FRAMEWORK_S is undefined.")
elseif (TEST_FRAMEWORK_S)
diff --git a/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc b/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
index 2451b22..e600056 100644
--- a/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
+++ b/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
@@ -19,6 +19,7 @@
#include "test/test_services/tfm_ipc_service/psa_manifest/tfm_ipc_service_partition.h"
#include "test/test_services/tfm_ipc_client/psa_manifest/tfm_ipc_client_partition.h"
#include "test/test_services/tfm_irq_test_service_1/psa_manifest/tfm_irq_test_service_1.h"
+#include "test/test_services/tfm_sst_test_service/psa_manifest/tfm_sst_test_service.h"
#include "cmsis_compiler.h"
/* Definitions of the signals of the IRQs (if any) */
diff --git a/secure_fw/core/tfm_secure_irq_handlers.inc b/secure_fw/core/tfm_secure_irq_handlers.inc
index 4c60c38..9b78b95 100644
--- a/secure_fw/core/tfm_secure_irq_handlers.inc
+++ b/secure_fw/core/tfm_secure_irq_handlers.inc
@@ -19,6 +19,7 @@
#include "test/test_services/tfm_ipc_service/psa_manifest/tfm_ipc_service_partition.h"
#include "test/test_services/tfm_ipc_client/psa_manifest/tfm_ipc_client_partition.h"
#include "test/test_services/tfm_irq_test_service_1/psa_manifest/tfm_irq_test_service_1.h"
+#include "test/test_services/tfm_sst_test_service/psa_manifest/tfm_sst_test_service.h"
#include "psa_manifest/pid.h"
/* Definitions of the signals of the IRQs */
diff --git a/secure_fw/ns_callable/tfm_veneers.c b/secure_fw/ns_callable/tfm_veneers.c
index 8f527e2..bc7ee6f 100644
--- a/secure_fw/ns_callable/tfm_veneers.c
+++ b/secure_fw/ns_callable/tfm_veneers.c
@@ -125,6 +125,11 @@
psa_status_t spm_irq_test_1_execute_test_scenario(psa_invec *, size_t, psa_outvec *, size_t);
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+/******** TFM_SP_SST_TEST ********/
+psa_status_t tfm_sst_test_prepare(psa_invec *, size_t, psa_outvec *, size_t);
+#endif /* TFM_PARTITION_TEST_SST */
+
#define TFM_VENEER_FUNCTION(partition_name, sfn_name) \
__tfm_secure_gateway_attributes__ \
@@ -253,3 +258,8 @@
TFM_VENEER_FUNCTION(TFM_IRQ_TEST_1, spm_irq_test_1_execute_test_scenario)
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+/******** TFM_SP_SST_TEST ********/
+TFM_VENEER_FUNCTION(TFM_SP_SST_TEST, tfm_sst_test_prepare)
+#endif /* TFM_PARTITION_TEST_SST */
+
diff --git a/secure_fw/services/tfm_service_list.inc b/secure_fw/services/tfm_service_list.inc
index afbb59c..9767f85 100644
--- a/secure_fw/services/tfm_service_list.inc
+++ b/secure_fw/services/tfm_service_list.inc
@@ -22,6 +22,7 @@
#include "test/test_services/tfm_ipc_service/psa_manifest/tfm_ipc_service_partition.h"
#include "test/test_services/tfm_ipc_client/psa_manifest/tfm_ipc_client_partition.h"
#include "test/test_services/tfm_irq_test_service_1/psa_manifest/tfm_irq_test_service_1.h"
+#include "test/test_services/tfm_sst_test_service/psa_manifest/tfm_sst_test_service.h"
const struct tfm_spm_service_db_t service_db[] =
{
@@ -435,6 +436,19 @@
},
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ /******** TFM_SP_SST_TEST ********/
+ {
+ .name = "TFM_SST_TEST_PREPARE",
+ .partition_id = TFM_SP_SST_TEST,
+ .signal = TFM_SST_TEST_PREPARE_SIGNAL,
+ .sid = 0x0000F0C0,
+ .non_secure_client = false,
+ .version = 1,
+ .version_policy = TFM_VERSION_POLICY_STRICT
+ },
+#endif /* TFM_PARTITION_TEST_SST */
+
};
/**************************************************************************/
@@ -768,6 +782,17 @@
},
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ /******** TFM_SP_SST_TEST ********/
+ {
+ .service_db = NULL,
+ .partition = NULL,
+ .handle_list = {0},
+ .msg_queue = {0},
+ .list = {0},
+ },
+#endif /* TFM_PARTITION_TEST_SST */
+
};
#endif /* __TFM_SERVICE_LIST_INC__ */
diff --git a/secure_fw/spm/tfm_spm_db.inc b/secure_fw/spm/tfm_spm_db.inc
index 2ac6176..6302cd3 100644
--- a/secure_fw/spm/tfm_spm_db.inc
+++ b/secure_fw/spm/tfm_spm_db.inc
@@ -55,6 +55,10 @@
#define TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT 1
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+#define TFM_PARTITION_TFM_SP_SST_TEST_IRQ_COUNT 0
+#endif /* TFM_PARTITION_TEST_SST */
+
/**************************************************************************/
/** Declarations of partition init functions */
/**************************************************************************/
@@ -102,6 +106,10 @@
extern void tfm_irq_test_1_init(void);
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+extern void tfm_sst_test_init(void);
+#endif /* TFM_PARTITION_TEST_SST */
+
/**************************************************************************/
/** Memory region declarations */
/**************************************************************************/
@@ -257,6 +265,19 @@
REGION_DECLARE(Image$$, TFM_IRQ_TEST_1_LINKER, _STACK$$ZI$$Limit);
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, $$Base);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, $$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, $$RO$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, $$RO$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _DATA$$RW$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _DATA$$RW$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _DATA$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _DATA$$ZI$$Limit);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _STACK$$ZI$$Base);
+REGION_DECLARE(Image$$, TFM_SP_SST_TEST_LINKER, _STACK$$ZI$$Limit);
+#endif /* TFM_PARTITION_TEST_SST */
+
#endif /* defined(TFM_PSA_API) */
#ifndef TFM_PSA_API
@@ -378,6 +399,15 @@
)) / sizeof(uint32_t)];
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+static uint32_t ctx_stack_TFM_SP_SST_TEST[
+ (sizeof(struct interrupted_ctx_stack_frame_t) +
+ (TFM_PARTITION_TFM_SP_SST_TEST_IRQ_COUNT) * (
+ sizeof(struct interrupted_ctx_stack_frame_t) +
+ sizeof(struct handler_ctx_stack_frame_t)
+ )) / sizeof(uint32_t)];
+#endif /* TFM_PARTITION_TEST_SST */
+
uint32_t *ctx_stack_list[] =
{
@@ -411,6 +441,9 @@
#ifdef TFM_ENABLE_IRQ_TEST
ctx_stack_TFM_IRQ_TEST_1,
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ ctx_stack_TFM_SP_SST_TEST,
+#endif /* TFM_PARTITION_TEST_SST */
};
#endif /* !defined(TFM_PSA_API) */
@@ -604,6 +637,20 @@
},
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ {
+#ifdef TFM_PSA_API
+ .psa_framework_version = 0x0100,
+#endif /* defined(TFM_PSA_API) */
+ .partition_id = TFM_SP_SST_TEST,
+ .partition_flags = SPM_PART_FLAG_IPC
+ | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+ ,
+ .partition_priority = TFM_PRIORITY(NORMAL),
+ .partition_init = tfm_sst_test_init,
+ },
+#endif /* TFM_PARTITION_TEST_SST */
+
};
/**************************************************************************/
@@ -665,6 +712,10 @@
TFM_PERIPHERAL_TIMER0,
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ NULL,
+#endif /* TFM_PARTITION_TEST_SST */
+
};
/**************************************************************************/
@@ -850,6 +901,21 @@
},
#endif /* TFM_ENABLE_IRQ_TEST */
+#ifdef TFM_PARTITION_TEST_SST
+ {
+ .code_start = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, $$Base),
+ .code_limit = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, $$Limit),
+ .ro_start = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, $$RO$$Base),
+ .ro_limit = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, $$RO$$Limit),
+ .rw_start = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _DATA$$RW$$Base),
+ .rw_limit = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _DATA$$RW$$Limit),
+ .zi_start = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _DATA$$ZI$$Base),
+ .zi_limit = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _DATA$$ZI$$Limit),
+ .stack_bottom = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _STACK$$ZI$$Base),
+ .stack_top = PART_REGION_ADDR(TFM_SP_SST_TEST_LINKER, _STACK$$ZI$$Limit),
+ },
+#endif /* TFM_PARTITION_TEST_SST */
+
};
#endif /* defined(TFM_PSA_API) */
@@ -1011,6 +1077,19 @@
},
#endif /* TFM_ENABLE_IRQ_TEST */
+ /* -----------------------------------------------------------------------*/
+ /* - Partition DB record for TFM_SP_SST_TEST */
+ /* -----------------------------------------------------------------------*/
+#ifdef TFM_PARTITION_TEST_SST
+ {
+ /* Runtime data */
+ .runtime_data = {},
+ .static_data = NULL,
+ .platform_data = NULL,
+
+ },
+#endif /* TFM_PARTITION_TEST_SST */
+
};
struct spm_partition_db_t g_spm_partition_db = {