Add event log parameter handling in SP
A generic publish/subscribe mechanism is implemented to allow
boot information such as the TPM event log to be passed to
specific SPs, based on subscriptions specified in the SP
manifest. This change implements the in-SP handling
for the initialization parameters. The env_test has
been extended to include tests that check that the
event log is being passed and stored in the config store.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I89211ebffd9e2d1768eaf5736e6b28dceafb0a02
diff --git a/deployments/env-test/env_test.cmake b/deployments/env-test/env_test.cmake
index 12089a1..9c0926b 100644
--- a/deployments/env-test/env_test.cmake
+++ b/deployments/env-test/env_test.cmake
@@ -16,7 +16,7 @@
#
#-------------------------------------------------------------------------------
add_components(
- TARGET "env_test"
+ TARGET "env-test"
BASE_DIR ${TS_ROOT}
COMPONENTS
"components/common/tlv"
@@ -45,4 +45,4 @@
# Mbed TLS provides libmbedcrypto
include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake)
-target_link_libraries(env_test PRIVATE mbedcrypto)
+target_link_libraries(env-test PRIVATE mbedcrypto)
diff --git a/deployments/env-test/opteesp/CMakeLists.txt b/deployments/env-test/opteesp/CMakeLists.txt
index 3149ecd..044fae0 100644
--- a/deployments/env-test/opteesp/CMakeLists.txt
+++ b/deployments/env-test/opteesp/CMakeLists.txt
@@ -16,8 +16,8 @@
#-------------------------------------------------------------------------------
include(${TS_ROOT}/environments/opteesp/env.cmake)
project(trusted-services LANGUAGES C ASM)
-add_executable(env_test)
-target_include_directories(env_test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
+add_executable(env-test)
+target_include_directories(env-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
set(SP_UUID "33c75baf-ac6a-4fe4-8ac7-e9909bee2d17")
@@ -25,14 +25,14 @@
set(SP_DEV_KIT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})
list(APPEND CMAKE_MODULE_PATH "${TS_ROOT}/external/Spdevkit")
find_package(Spdevkit REQUIRED)
-sp_dev_kit_configure_linking(TARGET env_test DEFINES ARM64=1)
-target_link_libraries(env_test PRIVATE ${SP_DEV_KIT_LIBRARIES})
+sp_dev_kit_configure_linking(TARGET env-test DEFINES ARM64=1)
+target_link_libraries(env-test PRIVATE ${SP_DEV_KIT_LIBRARIES})
#-------------------------------------------------------------------------------
-# Components that are env_testecific to deployment in the opteesp
+# Components that are env-test specific to deployment in the opteesp
# environment.
#-------------------------------------------------------------------------------
-add_components(TARGET "env_test"
+add_components(TARGET "env-test"
BASE_DIR ${TS_ROOT}
COMPONENTS
"components/config/loader/sp"
@@ -44,7 +44,7 @@
#-------------------------------------------------------------------------------
# Extend with components that are common across all deployments of
-# env_test
+# env-test
#
#-------------------------------------------------------------------------------
include(../env_test.cmake REQUIRED)
@@ -52,7 +52,7 @@
#-------------------------------------------------------------------------------
# Deployment specific source files
#-------------------------------------------------------------------------------
-target_sources(env_test PRIVATE
+target_sources(env-test PRIVATE
env_test.c
env_test_tests.c
)
@@ -64,26 +64,26 @@
# temporarily force platform - remove when external builder updated
set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Overridden" FORCE)
-add_platform(TARGET "env_test")
+add_platform(TARGET "env-test")
if(CMAKE_CROSSCOMPILING)
- target_link_libraries(env_test PRIVATE stdc++ gcc m)
+ target_link_libraries(env-test PRIVATE stdc++ gcc m)
endif()
#################################################################
-target_compile_definitions(env_test PRIVATE
+target_compile_definitions(env-test PRIVATE
ARM64=1
)
-target_include_directories(env_test PRIVATE
+target_include_directories(env-test PRIVATE
${TS_ROOT}
${TS_ROOT}/components
${TS_ROOT}/deployments/env-test/opteesp
)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_compile_options(env_test PRIVATE
+ target_compile_options(env-test PRIVATE
-fdiagnostics-show-option
-fpic
-gdwarf-2
@@ -94,7 +94,7 @@
)
# Options for GCC that control linking
- target_link_options(env_test PRIVATE
+ target_link_options(env-test PRIVATE
-e __sp_entry
-fno-lto
-nostdlib
@@ -102,25 +102,30 @@
-zmax-page-size=4096
)
# Options directly for LD, these are not understood by GCC
- target_link_options(env_test PRIVATE
+ target_link_options(env-test PRIVATE
-Wl,--as-needed
-Wl,--sort-section=alignment
# -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
)
endif()
-compiler_generate_stripped_elf(TARGET env_test NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
+compiler_generate_stripped_elf(TARGET env-test NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
######################################## install
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
endif()
#TODO: api headers
-install(TARGETS env_test
- PUBLIC_HEADER DESTINATION include
- RUNTIME DESTINATION bin
+
+install(TARGETS env-test
+ PUBLIC_HEADER DESTINATION ${TS_ENV}/include
+ RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION bin)
+install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
+
+get_property(_PROTO_FILES TARGET env-test PROPERTY PROTOBUF_FILES)
+install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
+
set(EXPORT_SP_NAME "env-test")
set(EXPORT_SP_UUID ${SP_UUID})
diff --git a/deployments/env-test/opteesp/default_env-test.dts.in b/deployments/env-test/opteesp/default_env-test.dts.in
new file mode 100644
index 0000000..f64a5fa
--- /dev/null
+++ b/deployments/env-test/opteesp/default_env-test.dts.in
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+@DTS_TAG@
+
+@DTS_NODE@ {
+ compatible = "arm,ffa-manifest-1.0";
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
+ uuid = <@EXPORT_SP_UUID_DT@>;
+ description = "EnvTest";
+ execution-ctx-count = <1>;
+ exception-level = <1>; /* S-EL0 */
+ execution-state = <0>; /* AArch64 */
+ xlat-granule = <0>; /* 4KiB */
+ messaging-method = <0>; /* Direct messaging only */
+
+ memory-regions {
+ compatible = "arm,ffa-manifest-memory-regions";
+
+ /* Without optional base-address */
+ test-memory {
+ description = "test-memory";
+ pages-count = <4>;
+ attributes = <0x7>; /* read-write-execute */
+ };
+ };
+
+ device-regions {
+ compatible = "arm,ffa-manifest-device-regions";
+
+ trng {
+ /* Armv8 A Foundation Platform values */
+ base-address = <0x00000000 0x7fe60000>;
+ pages-count = <1>;
+ attributes = <0x3>; /* read-write */
+ };
+ };
+
+ boot-params {
+ compatible = "arm,ffa-manifest-boot-params";
+
+ event-log {
+ param = "EVENT_LOG"; /* The init parameter name */
+ tag = "arm,event-log"; /* Object identifier */
+ };
+ };
+};
diff --git a/deployments/env-test/opteesp/env_test.c b/deployments/env-test/opteesp/env_test.c
index 3df4c1a..ff2f8df 100644
--- a/deployments/env-test/opteesp/env_test.c
+++ b/deployments/env-test/opteesp/env_test.c
@@ -31,8 +31,6 @@
struct ffa_direct_msg req_msg;
/* Boot */
- (void) init_info;
-
if (sp_init(&own_id) != 0) goto fatal_error;
config_ramstore_init();
@@ -42,7 +40,7 @@
test_runner_iface = test_runner_provider_init(&test_runner_provider);
test_runner_provider_register_serializer(&test_runner_provider,
- TS_RPC_ENCODING_PACKED_C, packedc_test_runner_provider_serializer_instance());
+ TS_RPC_ENCODING_PACKED_C, packedc_test_runner_provider_serializer_instance());
env_test_register_tests(&test_runner_provider);