tftf: SPCI Beta1 add direct messaging test
This patch strips out former SPCI Alpha sample test code. Removing SPRT
references will be done in another coming patch. Version check is adapted
to SPCI Beta1. Version is now returned in x2.
The first test is a direct messaging test using SPCI_MSG_SEND_DIRECT_REQ
targetting a bare-metal cactus SP. TFTF expects a response from the SP
returning with SPCI_MSG_SEND_DIRECT_RESP.
Note: this patch also provides an initial SPCI_RUN interface. This API
may not be used in the mid-term because VM to SP communication is supposed
to be done only through direct messaging. Though the SPM boot-up for now
is only launching the first SP in the list of declared SP in SPMC manifest.
In order to make 2nd-VM ready, TFTF has to "boot-up" the SP through a single
SPCI_RUN invocation till it reaches SPCI_MSG_WAIT in the SP. Once SPM
implements boot up through all SPs, this SPCI_RUN invocation will no longer
be required.
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I141abd3e348409b3d34a911d0552570f49e85846
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index a90fd71..5c0f090 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -147,14 +147,19 @@
do { \
smc_args version_smc = { SPCI_VERSION }; \
smc_ret_values smc_ret = tftf_smc(&version_smc); \
- uint32_t version = smc_ret.ret0; \
+ uint32_t version = smc_ret.ret2; \
\
- if (version == SMC_UNKNOWN) { \
+ if (smc_ret.ret0 != SPCI_SUCCESS_SMC32) { \
tftf_testcase_printf("SPM not detected.\n"); \
return TEST_RESULT_SKIPPED; \
} \
+ \
+ if ((version & SPCI_VERSION_BIT31_MASK) != 0) { \
+ tftf_testcase_printf("SPCI_VERSION bad response.\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } \
\
- if (version < SPCI_VERSION_FORM(major, minor)) { \
+ if (version < MAKE_SPCI_VERSION(major, minor)) { \
tftf_testcase_printf("SPCI_VERSION returned %d.%d\n" \
"The required version is %d.%d\n", \
version >> SPCI_VERSION_MAJOR_SHIFT,\
diff --git a/include/runtime_services/spci_helpers.h b/include/runtime_services/spci_helpers.h
index a64591e..cfc3a5f 100644
--- a/include/runtime_services/spci_helpers.h
+++ b/include/runtime_services/spci_helpers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,41 +7,19 @@
#ifndef SPCI_HELPERS_H
#define SPCI_HELPERS_H
+#include <tftf_lib.h>
#include <utils_def.h>
/* This error code must be different to the ones used by SPCI */
#define SPCI_TFTF_ERROR -42
-/* Client ID used for SPCI calls */
-#define TFTF_SPCI_CLIENT_ID U(0x00007F7F)
-
#ifndef __ASSEMBLY__
#include <stdint.h>
-int spci_service_handle_open(uint16_t client_id, uint16_t *handle,
- uint32_t uuid1, uint32_t uuid2,
- uint32_t uuid3, uint32_t uuid4);
-int spci_service_handle_close(uint16_t client_id, uint16_t handle);
-
-int spci_service_request_start(u_register_t x1, u_register_t x2,
- u_register_t x3, u_register_t x4,
- u_register_t x5, u_register_t x6,
- uint16_t client_id, uint16_t handle,
- uint32_t *token);
-int spci_service_request_resume(uint16_t client_id, uint16_t handle,
- uint32_t token, u_register_t *x1,
- u_register_t *x2, u_register_t *x3);
-int spci_service_get_response(uint16_t client_id, uint16_t handle,
- uint32_t token, u_register_t *x1,
- u_register_t *x2, u_register_t *x3);
-
-int spci_service_request_blocking(u_register_t x1, u_register_t x2,
- u_register_t x3, u_register_t x4,
- u_register_t x5, u_register_t x6,
- uint16_t client_id, uint16_t handle,
- u_register_t *rx1, u_register_t *rx2,
- u_register_t *rx3);
+smc_ret_values spci_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message);
+smc_ret_values spci_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message);
+smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id);
#endif /* __ASSEMBLY__ */