test(spm): check processor feature regs
For cactus secure partitions, check ID registers report:
-FPU/Adv. SIMD supported.
-SVE/SME not supported.
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Iba3508d57a8bcb1f554adddef97c4c83f4118a03
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index e0e749d..776cc75 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -8,6 +8,8 @@
#define SP_HELPERS_H
#include <stdint.h>
+
+#include <debug.h>
#include <tftf_lib.h>
#include <spm_common.h>
#include <spinlock.h>
diff --git a/spm/common/sp_tests/sp_test_cpu.c b/spm/common/sp_tests/sp_test_cpu.c
new file mode 100644
index 0000000..a05dbf3
--- /dev/null
+++ b/spm/common/sp_tests/sp_test_cpu.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <sp_helpers.h>
+
+#include <arch_features.h>
+
+static void cpu_check_id_regs(void)
+{
+ /* ID_AA64PFR0_EL1 */
+ EXPECT(is_feat_advsimd_present(), true);
+ EXPECT(is_feat_fp_present(), true);
+ EXPECT(is_armv8_2_sve_present(), false);
+
+ /* ID_AA64PFR1_EL1 */
+ EXPECT(is_feat_sme_supported(), false);
+}
+
+void cpu_feature_tests(void)
+{
+ const char *test_cpu_str = "CPU tests";
+
+ announce_test_section_start(test_cpu_str);
+ cpu_check_id_regs();
+ announce_test_section_end(test_cpu_str);
+}
diff --git a/spm/common/sp_tests/sp_test_ffa.c b/spm/common/sp_tests/sp_test_ffa.c
index c3774f9..ba63a0e 100644
--- a/spm/common/sp_tests/sp_test_ffa.c
+++ b/spm/common/sp_tests/sp_test_ffa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -195,7 +195,7 @@
ffa_partition_info_wrong_test();
}
-void ffa_version_test(void)
+static void ffa_version_test(void)
{
struct ffa_value ret = ffa_version(FFA_VERSION_COMPILED);
@@ -212,7 +212,7 @@
EXPECT((int)compatible, (int)true);
}
-void ffa_spm_id_get_test(void)
+static void ffa_spm_id_get_test(void)
{
if (spm_version >= FFA_VERSION_1_1) {
struct ffa_value ret = ffa_spm_id_get();
@@ -236,9 +236,9 @@
void ffa_tests(struct mailbox_buffers *mb)
{
- const char *test_ffa = "FF-A setup and discovery";
+ const char *test_ffa_str = "FF-A setup and discovery";
- announce_test_section_start(test_ffa);
+ announce_test_section_start(test_ffa_str);
ffa_features_test();
ffa_version_test();
@@ -246,5 +246,5 @@
ffa_partition_info_get_test(mb);
ffa_partition_info_get_regs_test();
- announce_test_section_end(test_ffa);
+ announce_test_section_end(test_ffa_str);
}
diff --git a/spm/common/sp_tests/sp_tests.h b/spm/common/sp_tests/sp_tests.h
index 10d3b9b..007c2ca 100644
--- a/spm/common/sp_tests/sp_tests.h
+++ b/spm/common/sp_tests/sp_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -10,9 +10,10 @@
#include <spm_common.h>
/*
- * Test functions
+ * Self test functions
*/
void ffa_tests(struct mailbox_buffers *mb);
+void cpu_feature_tests(void);
#endif /* CACTUS_TESTS_H */