feat: support Cactus SP to boot on EL3 SPMC
EL3 SPMC has a limited set of FF-A functionality and does not support
all the features built into the current Cactus SP implementation.
Hence, this patch introduces a build option to strip out few features
from Cactus SP in order to boot it on EL3 SPMC.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I6319563adca67460015b79219ebc5c9468e3d54a
diff --git a/Makefile b/Makefile
index 8f6e14c..d0aac05 100644
--- a/Makefile
+++ b/Makefile
@@ -170,6 +170,7 @@
$(eval $(call assert_numeric,BRANCH_PROTECTION))
$(eval $(call assert_boolean,ENABLE_REALM_PAYLOAD_TESTS))
$(eval $(call assert_boolean,TRANSFER_LIST))
+$(eval $(call assert_boolean,SPMC_AT_EL3))
################################################################################
# Process build options
@@ -197,6 +198,7 @@
$(eval $(call add_define,TFTF_DEFINES,ENABLE_REALM_PAYLOAD_TESTS))
$(eval $(call add_define,TFTF_DEFINES,TRANSFER_LIST))
$(eval $(call add_define,TFTF_DEFINES,PLAT_AMU_GROUP1_COUNTERS_MASK))
+$(eval $(call add_define,TFTF_DEFINES,SPMC_AT_EL3))
################################################################################
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index 699b79d..08343e3 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -149,6 +149,12 @@
(RAM) or 1 (non-volatile memory like flash) as test results storage. Default
value is 0, as writing to the flash significantly slows tests down.
+Cactus SP Build Options
+-----------------------
+
+- ``SPMC_AT_EL3``: This flag is required to match the feature set of Cactus SP that
+ are implemented in TF-A EL3 SPMC. Default value is 0.
+
Realm payload specific Build Options
------------------------------------
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index d26ec06..3a7f8bf 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -55,3 +55,7 @@
# Use the Firmware Handoff framework to receive configurations from preceding
# bootloader.
TRANSFER_LIST := 0
+
+# This flag is required to match the feature set of Cactus SP that are
+# implemented in TF-A EL3 SPMC.
+SPMC_AT_EL3 := 0
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 9557745..0fa0ab5 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -94,6 +94,7 @@
$(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL))
$(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT}))
$(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC))
+$(eval $(call add_define,CACTUS_DEFINES,SPMC_AT_EL3))
$(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf
$(CACTUS_DTB) : $(CACTUS_DTS)
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 28afbfb..b608d7b 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -324,12 +324,14 @@
EXPECT(ffa_func_id(ret), FFA_SUCCESS_SMC32);
}
+#if !SPMC_AT_EL3
discover_managed_exit_interrupt_id();
register_maintenance_interrupt_handlers();
/* Invoking self tests */
ffa_tests(&mb, true);
cpu_feature_tests();
+#endif
msg_loop:
/* End up to message loop */