fix(realm): make PCIe tests default for testing
This patch moves the PCIe DOE test to the default realm world
testsuite.
Also fixes some build issues and hardens the PCIe functions.
Note that FVP_Base_RevC model needs to have the following
options enabled for the PCIe tests to work :
-C pci.pcie_rc.ahci0.endpoint.doe_supported=1
-C pci.pcie_rc.ahci0.endpoint.ide_supported=1
Change-Id: Icfd6b68799b0bacb44299c6a3cf99a3c425f833d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
diff --git a/tftf/tests/doe_tests/doe_helpers.c b/tftf/tests/doe_tests/doe_helpers.c
index 28b6a86..911fbd0 100644
--- a/tftf/tests/doe_tests/doe_helpers.c
+++ b/tftf/tests/doe_tests/doe_helpers.c
@@ -13,12 +13,15 @@
#include <pcie_doe.h>
#include <spdm.h>
-#include <platform_pcie.h>
-
void pcie_init(void)
{
+ static bool is_init;
+
/* Create PCIe table and enumeration */
- pcie_create_info_table();
+ if (!is_init) {
+ pcie_create_info_table();
+ is_init = true;
+ }
}
/*
@@ -113,7 +116,7 @@
sizeof(ver_resp->version_number_entry_count));
while (entry_count-- != 0) {
- spdm_version_number_t ver = *ver_ptr++;
+ spdm_version_number_t ver __unused = *ver_ptr++;
INFO("SPDM v%llu.%llu.%llu.%llu\n",
EXTRACT(SPDM_VER_MAJOR, ver),
diff --git a/tftf/tests/doe_tests/doe_helpers.h b/tftf/tests/doe_tests/doe_helpers.h
index 08137e3..d0fc5c8 100644
--- a/tftf/tests/doe_tests/doe_helpers.h
+++ b/tftf/tests/doe_tests/doe_helpers.h
@@ -8,6 +8,8 @@
#ifndef DOE_HELPERS_H
#define DOE_HELPERS_H
+#include <stdint.h>
+
void pcie_init(void);
int find_doe_device(uint32_t *bdf_ptr, uint32_t *cap_base_ptr);
int doe_discovery(uint32_t bdf, uint32_t doe_cap_base);
diff --git a/tftf/tests/doe_tests/test_doe.c b/tftf/tests/doe_tests/test_doe.c
index 6eb5079..cc852fa 100644
--- a/tftf/tests/doe_tests/test_doe.c
+++ b/tftf/tests/doe_tests/test_doe.c
@@ -10,6 +10,13 @@
#define SKIP_TEST_IF_DOE_NOT_SUPPORTED() \
do { \
+ /* Test PCIe DOE only for RME */ \
+ if (!get_armv9_2_feat_rme_support()) { \
+ tftf_testcase_printf("FEAT_RME not supported\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ \
+ pcie_init(); \
if (find_doe_device(&bdf, &doe_cap_base) != 0) { \
tftf_testcase_printf("PCIe DOE not supported\n"); \
return TEST_RESULT_SKIPPED; \
@@ -21,8 +28,6 @@
uint32_t bdf, doe_cap_base;
int ret;
- pcie_init();
-
SKIP_TEST_IF_DOE_NOT_SUPPORTED();
ret = doe_discovery(bdf, doe_cap_base);
diff --git a/tftf/tests/runtime_services/realm_payload/host_realm_simd_common.h b/tftf/tests/runtime_services/realm_payload/host_realm_simd_common.h
index 377c85b..6ab45c3 100644
--- a/tftf/tests/runtime_services/realm_payload/host_realm_simd_common.h
+++ b/tftf/tests/runtime_services/realm_payload/host_realm_simd_common.h
@@ -4,7 +4,7 @@
*/
#ifndef HOST_REALM_COMMON_H
-#define HOST_REALM_COMMON_h
+#define HOST_REALM_COMMON_H
#define NS_NORMAL_SVE 0x1U
#define NS_STREAMING_SVE 0x2U
diff --git a/tftf/tests/tests-pcie-doe.mk b/tftf/tests/tests-pcie-doe.mk
deleted file mode 100644
index 14bc9cf..0000000
--- a/tftf/tests/tests-pcie-doe.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (c) 2024, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-TESTS_SOURCES += \
- $(addprefix plat/arm/fvp/, \
- fvp_pcie.c \
- )
-
-TESTS_SOURCES += \
- $(addprefix tftf/tests/doe_tests/, \
- doe_helpers.c \
- test_doe.c \
- )
-
-TESTS_SOURCES += \
- $(addprefix lib/pcie/, \
- pcie.c \
- pcie_doe.c \
- )
diff --git a/tftf/tests/tests-pcie-doe.xml b/tftf/tests/tests-pcie-doe.xml
deleted file mode 100644
index ed8b7cb..0000000
--- a/tftf/tests/tests-pcie-doe.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- Copyright (c) 2024, Arm Limited. All rights reserved.
-
- SPDX-License-Identifier: BSD-3-Clause
--->
-
-<testsuites>
- <testsuite name="PCI Data Object Exchange" description="Check PCI DOE support">
- <testcase name="PCI DOE Discovery" function="doe_discovery_test" />
- <testcase name="SPDM Get Version" function="spdm_version_test" />
- </testsuite>
-</testsuites>
diff --git a/tftf/tests/tests-realm-payload.mk b/tftf/tests/tests-realm-payload.mk
index ae4b20a..4da8e3e 100644
--- a/tftf/tests/tests-realm-payload.mk
+++ b/tftf/tests/tests-realm-payload.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2021-2023, Arm Limited. All rights reserved.
+# Copyright (c) 2021-2024, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -44,4 +44,16 @@
$(addprefix lib/extensions/fpu/, \
fpu.c \
)
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/doe_tests/, \
+ doe_helpers.c \
+ test_doe.c \
+ )
+
+TESTS_SOURCES += \
+ $(addprefix lib/pcie/, \
+ pcie.c \
+ pcie_doe.c \
+ )
endif
diff --git a/tftf/tests/tests-realm-payload.xml b/tftf/tests/tests-realm-payload.xml
index 36fc52b..d95c474 100644
--- a/tftf/tests/tests-realm-payload.xml
+++ b/tftf/tests/tests-realm-payload.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2021-2023, Arm Limited. All rights reserved.
+ Copyright (c) 2021-2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
-->
@@ -132,5 +132,10 @@
<testcase name="Test realm attestation" function="host_realm_test_attestation" />
<testcase name="Test realm attestation fault"
function="host_realm_test_attestation_fault" />
+ <!-- Test case related to PCIE-DOE -->
+ <testcase name="PCI DOE Discovery"
+ function="doe_discovery_test" />
+ <testcase name="SPDM Get Version"
+ function="spdm_version_test" />
</testsuite>
</testsuites>