aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2020-05-26 09:11:49 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2020-05-26 09:11:49 +0000
commit5da6f402dcc85a9a281eb93dc00d5af2eeabf3b0 (patch)
tree536558dbcc3e81536a84c42010dff760b7418c08
parentfa940145f77d1b9b625866b96108ba8eb8c62d46 (diff)
parent09d3ce922a82c76e5c231219fe16c719633cf048 (diff)
downloadtf-a-tests-5da6f402dcc85a9a281eb93dc00d5af2eeabf3b0.tar.gz
Merge changes from topic "spci_to_ffa"
* changes: cactus: update memory/device region nodes in manifest cactus: map memory regions, used as RX/TX buffers in SPM SPCI is now called PSA FF-A
-rw-r--r--include/common/test_helpers.h20
-rw-r--r--include/runtime_services/ffa_helpers.h26
-rw-r--r--include/runtime_services/ffa_svc.h140
-rw-r--r--include/runtime_services/spci_helpers.h26
-rw-r--r--include/runtime_services/spci_svc.h140
-rw-r--r--spm/README.txt2
-rw-r--r--spm/cactus/cactus-secondary.dts48
-rw-r--r--spm/cactus/cactus.dts49
-rw-r--r--spm/cactus/cactus_debug.c2
-rw-r--r--spm/cactus/cactus_def.h18
-rw-r--r--spm/cactus/cactus_main.c104
-rw-r--r--spm/cactus/ffa_helpers.h (renamed from spm/cactus/spci_helpers.h)38
-rw-r--r--tftf/tests/runtime_services/secure_service/ffa_helpers.c (renamed from tftf/tests/runtime_services/secure_service/spci_helpers.c)36
-rw-r--r--tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c (renamed from tftf/tests/runtime_services/secure_service/test_spci_direct_messaging.c)58
-rw-r--r--tftf/tests/tests-spm.mk4
-rw-r--r--tftf/tests/tests-spm.xml4
16 files changed, 375 insertions, 340 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 5c0f090e..e9e0b7bf 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -10,7 +10,7 @@
#include <arch_features.h>
#include <plat_topology.h>
#include <psci.h>
-#include <spci_svc.h>
+#include <ffa_svc.h>
#include <tftf_lib.h>
#include <trusted_os.h>
#include <tsp.h>
@@ -143,27 +143,27 @@ typedef test_result_t (*test_function_arg_t)(void *arg);
version & MM_VERSION_MINOR_MASK); \
} while (0)
-#define SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(major, minor) \
+#define SKIP_TEST_IF_FFA_VERSION_LESS_THAN(major, minor) \
do { \
- smc_args version_smc = { SPCI_VERSION }; \
+ smc_args version_smc = { FFA_VERSION }; \
smc_ret_values smc_ret = tftf_smc(&version_smc); \
uint32_t version = smc_ret.ret2; \
\
- if (smc_ret.ret0 != SPCI_SUCCESS_SMC32) { \
+ if (smc_ret.ret0 != FFA_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"); \
+ if ((version & FFA_VERSION_BIT31_MASK) != 0) { \
+ tftf_testcase_printf("FFA_VERSION bad response.\n"); \
return TEST_RESULT_SKIPPED; \
} \
\
- if (version < MAKE_SPCI_VERSION(major, minor)) { \
- tftf_testcase_printf("SPCI_VERSION returned %d.%d\n" \
+ if (version < MAKE_FFA_VERSION(major, minor)) { \
+ tftf_testcase_printf("FFA_VERSION returned %d.%d\n" \
"The required version is %d.%d\n", \
- version >> SPCI_VERSION_MAJOR_SHIFT,\
- version & SPCI_VERSION_MINOR_MASK, \
+ version >> FFA_VERSION_MAJOR_SHIFT,\
+ version & FFA_VERSION_MINOR_MASK, \
major, minor); \
return TEST_RESULT_SKIPPED; \
} \
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
new file mode 100644
index 00000000..f280c773
--- /dev/null
+++ b/include/runtime_services/ffa_helpers.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef FFA_HELPERS_H
+#define FFA_HELPERS_H
+
+#include <tftf_lib.h>
+#include <utils_def.h>
+
+/* This error code must be different to the ones used by FFA */
+#define FFA_TFTF_ERROR -42
+
+#ifndef __ASSEMBLY__
+
+#include <stdint.h>
+
+smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message);
+smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message);
+smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* FFA_HELPERS_H */
diff --git a/include/runtime_services/ffa_svc.h b/include/runtime_services/ffa_svc.h
new file mode 100644
index 00000000..541a75ac
--- /dev/null
+++ b/include/runtime_services/ffa_svc.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef FFA_SVC_H
+#define FFA_SVC_H
+
+#include <lib/utils_def.h>
+#include <smccc.h>
+#include <uuid.h>
+
+/* FFA error codes. */
+#define FFA_ERROR_NOT_SUPPORTED -1
+#define FFA_ERROR_INVALID_PARAMETER -2
+#define FFA_ERROR_NO_MEMORY -3
+#define FFA_ERROR_BUSY -4
+#define FFA_ERROR_INTERRUPTED -5
+#define FFA_ERROR_DENIED -6
+#define FFA_ERROR_RETRY -7
+
+/* The macros below are used to identify FFA calls from the SMC function ID */
+#define FFA_FNUM_MIN_VALUE U(0x60)
+#define FFA_FNUM_MAX_VALUE U(0x7f)
+#define is_ffa_fid(fid) __extension__ ({ \
+ __typeof__(fid) _fid = (fid); \
+ ((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \
+ (GET_SMC_NUM(_fid) <= FFA_FNUM_MAX_VALUE)); })
+
+/* FFA_VERSION helpers */
+#define FFA_VERSION_MAJOR U(1)
+#define FFA_VERSION_MAJOR_SHIFT 16
+#define FFA_VERSION_MAJOR_MASK U(0x7FFF)
+#define FFA_VERSION_MINOR U(0)
+#define FFA_VERSION_MINOR_SHIFT 0
+#define FFA_VERSION_MINOR_MASK U(0xFFFF)
+#define FFA_VERSION_BIT31_MASK (1 << 31)
+
+#define MAKE_FFA_VERSION(major, minor) \
+ ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \
+ (((minor) & FFA_VERSION_MINOR_MASK) << FFA_VERSION_MINOR_SHIFT))
+#define FFA_VERSION_COMPILED MAKE_FFA_VERSION(FFA_VERSION_MAJOR, \
+ FFA_VERSION_MINOR)
+
+/* FFA_MSG_SEND helpers */
+#define FFA_MSG_SEND_ATTRS_BLK_SHIFT U(0)
+#define FFA_MSG_SEND_ATTRS_BLK_MASK U(0x1)
+#define FFA_MSG_SEND_ATTRS_BLK U(0)
+#define FFA_MSG_SEND_ATTRS_BLK_NOT U(1)
+#define FFA_MSG_SEND_ATTRS(blk) \
+ (((blk) & FFA_MSG_SEND_ATTRS_BLK_MASK) \
+ << FFA_MSG_SEND_ATTRS_BLK_SHIFT)
+
+/* Get FFA fastcall std FID from function number */
+#define FFA_FID(smc_cc, func_num) \
+ ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
+ ((smc_cc) << FUNCID_CC_SHIFT) | \
+ (OEN_STD_START << FUNCID_OEN_SHIFT) | \
+ ((func_num) << FUNCID_NUM_SHIFT))
+
+/* FFA function numbers */
+#define FFA_FNUM_ERROR U(0x60)
+#define FFA_FNUM_SUCCESS U(0x61)
+#define FFA_FNUM_INTERRUPT U(0x62)
+#define FFA_FNUM_VERSION U(0x63)
+#define FFA_FNUM_FEATURES U(0x64)
+#define FFA_FNUM_RX_RELEASE U(0x65)
+#define FFA_FNUM_RXTX_MAP U(0x66)
+#define FFA_FNUM_RXTX_UNMAP U(0x67)
+#define FFA_FNUM_PARTITION_INFO_GET U(0x68)
+#define FFA_FNUM_ID_GET U(0x69)
+#define FFA_FNUM_MSG_POLL U(0x6A)
+#define FFA_FNUM_MSG_WAIT U(0x6B)
+#define FFA_FNUM_MSG_YIELD U(0x6C)
+#define FFA_FNUM_MSG_RUN U(0x6D)
+#define FFA_FNUM_MSG_SEND U(0x6E)
+#define FFA_FNUM_MSG_SEND_DIRECT_REQ U(0x6F)
+#define FFA_FNUM_MSG_SEND_DIRECT_RESP U(0x70)
+#define FFA_FNUM_MEM_DONATE U(0x71)
+#define FFA_FNUM_MEM_LEND U(0x72)
+#define FFA_FNUM_MEM_SHARE U(0x73)
+#define FFA_FNUM_MEM_RETRIEVE_REQ U(0x74)
+#define FFA_FNUM_MEM_RETRIEVE_RESP U(0x75)
+#define FFA_FNUM_MEM_RELINQUISH U(0x76)
+#define FFA_FNUM_MEM_RECLAIM U(0x77)
+
+/* FFA SMC32 FIDs */
+#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR)
+#define FFA_SUCCESS_SMC32 FFA_FID(SMC_32, FFA_FNUM_SUCCESS)
+#define FFA_INTERRUPT FFA_FID(SMC_32, FFA_FNUM_INTERRUPT)
+#define FFA_VERSION FFA_FID(SMC_32, FFA_FNUM_VERSION)
+#define FFA_FEATURES FFA_FID(SMC_32, FFA_FNUM_FEATURES)
+#define FFA_RX_RELEASE FFA_FID(SMC_32, FFA_FNUM_RX_RELEASE)
+#define FFA_RXTX_MAP_SMC32 FFA_FID(SMC_32, FFA_FNUM_RXTX_MAP)
+#define FFA_RXTX_UNMAP FFA_FID(SMC_32, FFA_FNUM_RXTX_UNMAP)
+#define FFA_PARTITION_INFO_GET FFA_FID(SMC_32, FFA_FNUM_PARTITION_INFO_GET)
+#define FFA_ID_GET FFA_FID(SMC_32, FFA_FNUM_ID_GET)
+#define FFA_MSG_POLL FFA_FID(SMC_32, FFA_FNUM_MSG_POLL)
+#define FFA_MSG_WAIT FFA_FID(SMC_32, FFA_FNUM_MSG_WAIT)
+#define FFA_MSG_YIELD FFA_FID(SMC_32, FFA_FNUM_MSG_YIELD)
+#define FFA_MSG_RUN FFA_FID(SMC_32, FFA_FNUM_MSG_RUN)
+#define FFA_MSG_SEND FFA_FID(SMC_32, FFA_FNUM_MSG_SEND)
+#define FFA_MSG_SEND_DIRECT_REQ_SMC32 \
+ FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_REQ)
+#define FFA_MSG_SEND_DIRECT_RESP_SMC32 \
+ FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_RESP)
+#define FFA_MEM_DONATE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_DONATE)
+#define FFA_MEM_LEND_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_LEND)
+#define FFA_MEM_SHARE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_SHARE)
+#define FFA_MEM_RETRIEVE_REQ_SMC32 \
+ FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_REQ)
+#define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP)
+#define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH)
+#define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM)
+
+/* FFA SMC64 FIDs */
+#define FFA_SUCCESS_SMC64 FFA_FID(SMC_64, FFA_FNUM_SUCCESS)
+#define FFA_RXTX_MAP_SMC64 FFA_FID(SMC_64, FFA_FNUM_RXTX_MAP)
+#define FFA_MSG_SEND_DIRECT_REQ_SMC64 \
+ FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_REQ)
+#define FFA_MSG_SEND_DIRECT_RESP_SMC64 \
+ FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_RESP)
+#define FFA_MEM_DONATE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_DONATE)
+#define FFA_MEM_LEND_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_LEND)
+#define FFA_MEM_SHARE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_SHARE)
+#define FFA_MEM_RETRIEVE_REQ_SMC64 \
+ FFA_FID(SMC_64, FFA_FNUM_MEM_RETRIEVE_REQ)
+
+/*
+ * Reserve a special value for traffic targeted to the Hypervisor or SPM.
+ */
+#define FFA_TARGET_INFO_MBZ U(0x0)
+
+/*
+ * Reserve a special value for MBZ parameters.
+ */
+#define FFA_PARAM_MBZ U(0x0)
+
+#endif /* FFA_SVC_H */
diff --git a/include/runtime_services/spci_helpers.h b/include/runtime_services/spci_helpers.h
deleted file mode 100644
index cfc3a5ff..00000000
--- a/include/runtime_services/spci_helpers.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#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
-
-#ifndef __ASSEMBLY__
-
-#include <stdint.h>
-
-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__ */
-
-#endif /* SPCI_HELPERS_H */
diff --git a/include/runtime_services/spci_svc.h b/include/runtime_services/spci_svc.h
deleted file mode 100644
index 926f52a3..00000000
--- a/include/runtime_services/spci_svc.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef SPCI_SVC_H
-#define SPCI_SVC_H
-
-#include <lib/utils_def.h>
-#include <smccc.h>
-#include <uuid.h>
-
-/* SPCI error codes. */
-#define SPCI_ERROR_NOT_SUPPORTED -1
-#define SPCI_ERROR_INVALID_PARAMETER -2
-#define SPCI_ERROR_NO_MEMORY -3
-#define SPCI_ERROR_BUSY -4
-#define SPCI_ERROR_INTERRUPTED -5
-#define SPCI_ERROR_DENIED -6
-#define SPCI_ERROR_RETRY -7
-
-/* The macros below are used to identify SPCI calls from the SMC function ID */
-#define SPCI_FNUM_MIN_VALUE U(0x60)
-#define SPCI_FNUM_MAX_VALUE U(0x7f)
-#define is_spci_fid(fid) __extension__ ({ \
- __typeof__(fid) _fid = (fid); \
- ((GET_SMC_NUM(_fid) >= SPCI_FNUM_MIN_VALUE) && \
- (GET_SMC_NUM(_fid) <= SPCI_FNUM_MAX_VALUE)); })
-
-/* SPCI_VERSION helpers */
-#define SPCI_VERSION_MAJOR U(0)
-#define SPCI_VERSION_MAJOR_SHIFT 16
-#define SPCI_VERSION_MAJOR_MASK U(0x7FFF)
-#define SPCI_VERSION_MINOR U(9)
-#define SPCI_VERSION_MINOR_SHIFT 0
-#define SPCI_VERSION_MINOR_MASK U(0xFFFF)
-#define SPCI_VERSION_BIT31_MASK (1 << 31)
-
-#define MAKE_SPCI_VERSION(major, minor) \
- ((((major) & SPCI_VERSION_MAJOR_MASK) << SPCI_VERSION_MAJOR_SHIFT) | \
- (((minor) & SPCI_VERSION_MINOR_MASK) << SPCI_VERSION_MINOR_SHIFT))
-#define SPCI_VERSION_COMPILED MAKE_SPCI_VERSION(SPCI_VERSION_MAJOR, \
- SPCI_VERSION_MINOR)
-
-/* SPCI_MSG_SEND helpers */
-#define SPCI_MSG_SEND_ATTRS_BLK_SHIFT U(0)
-#define SPCI_MSG_SEND_ATTRS_BLK_MASK U(0x1)
-#define SPCI_MSG_SEND_ATTRS_BLK U(0)
-#define SPCI_MSG_SEND_ATTRS_BLK_NOT U(1)
-#define SPCI_MSG_SEND_ATTRS(blk) \
- (((blk) & SPCI_MSG_SEND_ATTRS_BLK_MASK) \
- << SPCI_MSG_SEND_ATTRS_BLK_SHIFT)
-
-/* Get SPCI fastcall std FID from function number */
-#define SPCI_FID(smc_cc, func_num) \
- ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
- ((smc_cc) << FUNCID_CC_SHIFT) | \
- (OEN_STD_START << FUNCID_OEN_SHIFT) | \
- ((func_num) << FUNCID_NUM_SHIFT))
-
-/* SPCI function numbers */
-#define SPCI_FNUM_ERROR U(0x60)
-#define SPCI_FNUM_SUCCESS U(0x61)
-#define SPCI_FNUM_INTERRUPT U(0x62)
-#define SPCI_FNUM_VERSION U(0x63)
-#define SPCI_FNUM_FEATURES U(0x64)
-#define SPCI_FNUM_RX_RELEASE U(0x65)
-#define SPCI_FNUM_RXTX_MAP U(0x66)
-#define SPCI_FNUM_RXTX_UNMAP U(0x67)
-#define SPCI_FNUM_PARTITION_INFO_GET U(0x68)
-#define SPCI_FNUM_ID_GET U(0x69)
-#define SPCI_FNUM_MSG_POLL U(0x6A)
-#define SPCI_FNUM_MSG_WAIT U(0x6B)
-#define SPCI_FNUM_MSG_YIELD U(0x6C)
-#define SPCI_FNUM_MSG_RUN U(0x6D)
-#define SPCI_FNUM_MSG_SEND U(0x6E)
-#define SPCI_FNUM_MSG_SEND_DIRECT_REQ U(0x6F)
-#define SPCI_FNUM_MSG_SEND_DIRECT_RESP U(0x70)
-#define SPCI_FNUM_MEM_DONATE U(0x71)
-#define SPCI_FNUM_MEM_LEND U(0x72)
-#define SPCI_FNUM_MEM_SHARE U(0x73)
-#define SPCI_FNUM_MEM_RETRIEVE_REQ U(0x74)
-#define SPCI_FNUM_MEM_RETRIEVE_RESP U(0x75)
-#define SPCI_FNUM_MEM_RELINQUISH U(0x76)
-#define SPCI_FNUM_MEM_RECLAIM U(0x77)
-
-/* SPCI SMC32 FIDs */
-#define SPCI_ERROR SPCI_FID(SMC_32, SPCI_FNUM_ERROR)
-#define SPCI_SUCCESS_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_SUCCESS)
-#define SPCI_INTERRUPT SPCI_FID(SMC_32, SPCI_FNUM_INTERRUPT)
-#define SPCI_VERSION SPCI_FID(SMC_32, SPCI_FNUM_VERSION)
-#define SPCI_FEATURES SPCI_FID(SMC_32, SPCI_FNUM_FEATURES)
-#define SPCI_RX_RELEASE SPCI_FID(SMC_32, SPCI_FNUM_RX_RELEASE)
-#define SPCI_RXTX_MAP_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_RXTX_MAP)
-#define SPCI_RXTX_UNMAP SPCI_FID(SMC_32, SPCI_FNUM_RXTX_UNMAP)
-#define SPCI_PARTITION_INFO_GET SPCI_FID(SMC_32, SPCI_FNUM_PARTITION_INFO_GET)
-#define SPCI_ID_GET SPCI_FID(SMC_32, SPCI_FNUM_ID_GET)
-#define SPCI_MSG_POLL SPCI_FID(SMC_32, SPCI_FNUM_MSG_POLL)
-#define SPCI_MSG_WAIT SPCI_FID(SMC_32, SPCI_FNUM_MSG_WAIT)
-#define SPCI_MSG_YIELD SPCI_FID(SMC_32, SPCI_FNUM_MSG_YIELD)
-#define SPCI_MSG_RUN SPCI_FID(SMC_32, SPCI_FNUM_MSG_RUN)
-#define SPCI_MSG_SEND SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND)
-#define SPCI_MSG_SEND_DIRECT_REQ_SMC32 \
- SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_REQ)
-#define SPCI_MSG_SEND_DIRECT_RESP_SMC32 \
- SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_RESP)
-#define SPCI_MEM_DONATE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_DONATE)
-#define SPCI_MEM_LEND_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_LEND)
-#define SPCI_MEM_SHARE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_SHARE)
-#define SPCI_MEM_RETRIEVE_REQ_SMC32 \
- SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_REQ)
-#define SPCI_MEM_RETRIEVE_RESP SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_RESP)
-#define SPCI_MEM_RELINQUISH SPCI_FID(SMC_32, SPCI_FNUM_MEM_RELINQUISH)
-#define SPCI_MEM_RECLAIM SPCI_FID(SMC_32, SPCI_FNUM_MEM_RECLAIM)
-
-/* SPCI SMC64 FIDs */
-#define SPCI_SUCCESS_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_SUCCESS)
-#define SPCI_RXTX_MAP_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_RXTX_MAP)
-#define SPCI_MSG_SEND_DIRECT_REQ_SMC64 \
- SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_REQ)
-#define SPCI_MSG_SEND_DIRECT_RESP_SMC64 \
- SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_RESP)
-#define SPCI_MEM_DONATE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_DONATE)
-#define SPCI_MEM_LEND_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_LEND)
-#define SPCI_MEM_SHARE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_SHARE)
-#define SPCI_MEM_RETRIEVE_REQ_SMC64 \
- SPCI_FID(SMC_64, SPCI_FNUM_MEM_RETRIEVE_REQ)
-
-/*
- * Reserve a special value for traffic targeted to the Hypervisor or SPM.
- */
-#define SPCI_TARGET_INFO_MBZ U(0x0)
-
-/*
- * Reserve a special value for MBZ parameters.
- */
-#define SPCI_PARAM_MBZ U(0x0)
-
-#endif /* SPCI_SVC_H */
diff --git a/spm/README.txt b/spm/README.txt
index 0a25d6b7..cb226365 100644
--- a/spm/README.txt
+++ b/spm/README.txt
@@ -1,4 +1,4 @@
-This is a prototype loosely based on the SPCI Beta1 specification.
+This is a prototype loosely based on the PSA FF-A v1.0 specification.
Any interface / platform API introduced for this is subject to
change as it evolves.
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts
index 041cd317..8a140a97 100644
--- a/spm/cactus/cactus-secondary.dts
+++ b/spm/cactus/cactus-secondary.dts
@@ -11,11 +11,11 @@
/dts-v1/;
/ {
- compatible = "arm,spci-manifest-1.0";
+ compatible = "arm,ffa-manifest-1.0";
/* Properties */
description = "Base-1";
- spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
uuid = <0xd1582309 0xf02347b9 0x827c4464 0xf5578fc8>;
id = <2>;
auxiliary-id = <0xae>;
@@ -34,29 +34,45 @@
gp-register-num = <0x0>;
rx_tx-info {
- compatible = "arm,spci-manifest-rx_tx-buffer";
-
- description = "NS RX/TX Buffer";
- pages-count = <1>;
- attributes = <0x0>;
- base-address = <0x7200000>;
+ compatible = "arm,ffa-manifest-rx_tx-buffer";
+ rx-buffer = <&rxbuffer>;
+ tx-buffer = <&txbuffer>;
};
memory-regions {
- compatible = "arm,spci-manifest-memory-regions";
+ compatible = "arm,ffa-manifest-memory-regions";
+
+ rxbuffer: rx-buffer {
+ description = "rx-buffer";
+ pages-count = <1>;
+ base-address = <0x00000000 0x7202000>;
+ attributes = <0x1>; /* read-only */
+ };
+
+ txbuffer: tx-buffer {
+ description = "tx-buffer";
+ pages-count = <1>;
+ base-address = <0x00000000 0x7203000>;
+ attributes = <0x3>; /* read-write */
+ };
+
+ /* Without optional base-address */
test-memory {
- description = "Test Memory";
- pages-count = <32>; /* 128KiB with 4KiB pages */
- base-address = <0x00000000 0x21000000>;
- attributes = <0x0>;
+ description = "test-memory";
+ pages-count = <4>;
+ attributes = <0x7>; /* read-write-execute */
};
};
device-regions {
- compatible = "arm,spci-manifest-device-regions";
- attributes = <0x0>;
+ compatible = "arm,ffa-manifest-device-regions";
+
test-reg {
- reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */
+ /* Dummy values */
+ base-address = <0x00000000 0x24000000>;
+ pages-count = <16>;
+ attributes = <0x3>; /* read-write */
+ reg = <0x10000008 0x00000001 1>;
smmu-id = <1>;
stream-ids = <0x0 0x1>;
interrupts = <0x2 0x3>,
diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts
index 78cbb56c..2e30db4a 100644
--- a/spm/cactus/cactus.dts
+++ b/spm/cactus/cactus.dts
@@ -11,11 +11,11 @@
/dts-v1/;
/ {
- compatible = "arm,spci-manifest-1.0";
+ compatible = "arm,ffa-manifest-1.0";
/* Properties */
description = "Base-1";
- spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
uuid = <0xb4b5671e 0x4a904fe1 0xb81ffb13 0xdae1dacb>;
id = <1>;
auxiliary-id = <0xae>;
@@ -34,33 +34,50 @@
gp-register-num = <0x0>;
rx_tx-info {
- compatible = "arm,spci-manifest-rx_tx-buffer";
-
- description = "NS RX/TX Buffer";
- pages-count = <1>;
- attributes = <0x0>;
- base-address = <0x7200000>;
+ compatible = "arm,ffa-manifest-rx_tx-buffer";
+ rx-buffer = <&rxbuffer>;
+ tx-buffer = <&txbuffer>;
};
memory-regions {
- compatible = "arm,spci-manifest-memory-regions";
+ compatible = "arm,ffa-manifest-memory-regions";
+
+ rxbuffer: rx-buffer {
+ description = "rx-buffer";
+ pages-count = <1>;
+ base-address = <0x00000000 0x7200000>;
+ attributes = <0x1>; /* read-only */
+ };
+
+ txbuffer: tx-buffer {
+ description = "tx-buffer";
+ pages-count = <1>;
+ base-address = <0x00000000 0x7201000>;
+ attributes = <0x3>; /* read-write */
+ };
+
+ /* Without optional base-address */
test-memory {
- description = "Test Memory";
- pages-count = <32>; /* 128KiB with 4KiB pages */
- base-address = <0x00000000 0x21000000>;
- attributes = <0x0>;
+ description = "test-memory";
+ pages-count = <4>;
+ attributes = <0x7>; /* read-write-execute */
};
};
device-regions {
- compatible = "arm,spci-manifest-device-regions";
- attributes = <0x0>;
+ compatible = "arm,ffa-manifest-device-regions";
+
test-reg {
- reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */
+ /* Dummy Values */
+ base-address = <0x00000000 0x22000000>;
+ pages-count = <64>;
+ attributes = <0x3>; /* read-write */
+ reg = <0x10000008 0x00000001 1>;
smmu-id = <1>;
stream-ids = <0x0 0x1>;
interrupts = <0x2 0x3>,
<0x4 0x5>;
+ exclusive-access;
};
};
diff --git a/spm/cactus/cactus_debug.c b/spm/cactus/cactus_debug.c
index cce09731..91fbfda9 100644
--- a/spm/cactus/cactus_debug.c
+++ b/spm/cactus/cactus_debug.c
@@ -8,7 +8,7 @@
#include <drivers/console.h>
#include "cactus.h"
-#include "spci_helpers.h"
+#include "ffa_helpers.h"
static int (*putc_impl)(int);
diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h
index 6eceb010..a0adb234 100644
--- a/spm/cactus/cactus_def.h
+++ b/spm/cactus/cactus_def.h
@@ -20,16 +20,12 @@
/* Memory reserved for stacks */
#define CACTUS_STACKS_SIZE ULL(0x1000)
-/* Memory shared between EL3 and S-EL0 (64 KiB). */
-#define CACTUS_SPM_BUF_BASE (CACTUS_IMAGE_BASE + CACTUS_IMAGE_SIZE)
-#define CACTUS_SPM_BUF_SIZE ULL(0x10000)
-
-/* Memory shared between Normal world and S-EL0 (64 KiB). */
-#define CACTUS_NS_BUF_BASE (CACTUS_SPM_BUF_BASE + CACTUS_SPM_BUF_SIZE)
-#define CACTUS_NS_BUF_SIZE ULL(0x10000)
-
-/* Memory area used by tests (128 KiB). */
-#define CACTUS_TEST_MEM_BASE (CACTUS_NS_BUF_BASE + CACTUS_NS_BUF_SIZE)
-#define CACTUS_TEST_MEM_SIZE ULL(0x20000)
+/*
+ * RX/TX buffer used by VM's in SPM for memory sharing
+ * Each VM allocated 2 pages, one for RX and one for TX buffer.
+ */
+#define CACTUS_RX_BASE ULL(0x7200000)
+#define CACTUS_TX_BASE CACTUS_RX_BASE + PAGE_SIZE
+#define CACTUS_RX_TX_SIZE PAGE_SIZE * 2
#endif /* CACTUS_DEF_H */
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index be137adc..d5d923d1 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -19,7 +19,7 @@
#include "cactus.h"
#include "cactus_def.h"
-#include "spci_helpers.h"
+#include "ffa_helpers.h"
/* Host machine information injected by the build system in the ELF file. */
extern const char build_message[];
@@ -33,9 +33,9 @@ extern const char version_string[];
* but rather through Hafnium print hypercall.
*
*/
-static void __dead2 message_loop(spci_vm_id_t vm_id)
+static void __dead2 message_loop(ffa_vm_id_t vm_id)
{
- smc_ret_values spci_ret;
+ smc_ret_values ffa_ret;
uint32_t sp_response;
/*
@@ -43,22 +43,22 @@ static void __dead2 message_loop(spci_vm_id_t vm_id)
* SP initialization has completed. It blocks until receiving
* a direct message request.
*/
- spci_ret = spci_msg_wait();
+ ffa_ret = ffa_msg_wait();
for (;;) {
- if (spci_ret.ret0 != SPCI_MSG_SEND_DIRECT_REQ_SMC32) {
- spci_ret = spci_error(-1);
+ if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
+ ffa_ret = ffa_error(-1);
continue;
}
- if (spci_ret.ret1 != SP_ID(vm_id)) {
- spci_ret = spci_error(-2);
+ if (ffa_ret.ret1 != SP_ID(vm_id)) {
+ ffa_ret = ffa_error(-2);
continue;
}
- if (spci_ret.ret2 != HYP_ID) {
- spci_ret = spci_error(-3);
+ if (ffa_ret.ret2 != HYP_ID) {
+ ffa_ret = ffa_error(-3);
continue;
}
@@ -66,13 +66,13 @@ static void __dead2 message_loop(spci_vm_id_t vm_id)
* For the sake of testing, add the vm id to the
* received message.
*/
- sp_response = spci_ret.ret3 | vm_id;
+ sp_response = ffa_ret.ret3 | vm_id;
/*
* Send a response through direct messaging then block
* until receiving a new message request.
*/
- spci_ret = spci_msg_send_direct_resp(SP_ID(vm_id),
+ ffa_ret = ffa_msg_send_direct_resp(SP_ID(vm_id),
HYP_ID, sp_response);
}
}
@@ -83,36 +83,32 @@ static const mmap_region_t cactus_mmap[] __attribute__((used)) = {
{0}
};
-static void cactus_print_memory_layout(void)
+static void cactus_print_memory_layout(unsigned int vm_id)
{
NOTICE("Secure Partition memory layout:\n");
- NOTICE(" Image regions\n");
- NOTICE(" Text region : %p - %p\n",
+ NOTICE(" Text region : %p - %p\n",
(void *)CACTUS_TEXT_START, (void *)CACTUS_TEXT_END);
- NOTICE(" Read-only data region : %p - %p\n",
+
+ NOTICE(" Read-only data region : %p - %p\n",
(void *)CACTUS_RODATA_START, (void *)CACTUS_RODATA_END);
- NOTICE(" Data region : %p - %p\n",
+
+ NOTICE(" Data region : %p - %p\n",
(void *)CACTUS_DATA_START, (void *)CACTUS_DATA_END);
- NOTICE(" BSS region : %p - %p\n",
+
+ NOTICE(" BSS region : %p - %p\n",
(void *)CACTUS_BSS_START, (void *)CACTUS_BSS_END);
- NOTICE(" Total image memory : %p - %p\n",
- (void *)CACTUS_IMAGE_BASE,
- (void *)(CACTUS_IMAGE_BASE + CACTUS_IMAGE_SIZE));
- NOTICE(" SPM regions\n");
- NOTICE(" SPM <-> SP buffer : %p - %p\n",
- (void *)CACTUS_SPM_BUF_BASE,
- (void *)(CACTUS_SPM_BUF_BASE + CACTUS_SPM_BUF_SIZE));
- NOTICE(" NS <-> SP buffer : %p - %p\n",
- (void *)CACTUS_NS_BUF_BASE,
- (void *)(CACTUS_NS_BUF_BASE + CACTUS_NS_BUF_SIZE));
- NOTICE(" Test regions\n");
- NOTICE(" Test region : %p - %p\n",
- (void *)CACTUS_TEST_MEM_BASE,
- (void *)(CACTUS_TEST_MEM_BASE + CACTUS_TEST_MEM_SIZE));
+
+ NOTICE(" RX : %p - %p\n",
+ (void *)(CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (void *)(CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)));
+
+ NOTICE(" TX : %p - %p\n",
+ (void *)(CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (void *)(CACTUS_RX_BASE + (vm_id * CACTUS_RX_TX_SIZE)));
}
-static void cactus_plat_configure_mmu(void)
+static void cactus_plat_configure_mmu(unsigned int vm_id)
{
mmap_add_region(CACTUS_TEXT_START,
CACTUS_TEXT_START,
@@ -131,6 +127,16 @@ static void cactus_plat_configure_mmu(void)
CACTUS_BSS_END - CACTUS_BSS_START,
MT_RW_DATA);
+ mmap_add_region((CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (CACTUS_RX_TX_SIZE / 2),
+ MT_RO_DATA);
+
+ mmap_add_region((CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)),
+ (CACTUS_RX_TX_SIZE / 2),
+ MT_RW_DATA);
+
mmap_add(cactus_mmap);
init_xlat_tables();
}
@@ -143,20 +149,20 @@ void __dead2 cactus_main(void)
memset((void *)CACTUS_BSS_START,
0, CACTUS_BSS_END - CACTUS_BSS_START);
- /* Configure and enable Stage-1 MMU, enable D-Cache */
- cactus_plat_configure_mmu();
- enable_mmu_el1(0);
-
- /* Get current SPCI id */
- smc_ret_values spci_id_ret = spci_id_get();
- if (spci_id_ret.ret0 != SPCI_SUCCESS_SMC32) {
- ERROR("SPCI_ID_GET failed.\n");
+ /* Get current FFA id */
+ smc_ret_values ffa_id_ret = ffa_id_get();
+ if (ffa_id_ret.ret0 != FFA_SUCCESS_SMC32) {
+ ERROR("FFA_ID_GET failed.\n");
panic();
}
- spci_vm_id_t spci_id = spci_id_ret.ret2 & 0xffff;
+ ffa_vm_id_t ffa_id = ffa_id_ret.ret2 & 0xffff;
+
+ /* Configure and enable Stage-1 MMU, enable D-Cache */
+ cactus_plat_configure_mmu(ffa_id);
+ enable_mmu_el1(0);
- if (spci_id == SPM_VM_ID_FIRST) {
+ if (ffa_id == SPM_VM_ID_FIRST) {
console_init(PL011_UART2_BASE,
PL011_UART2_CLK_IN_HZ,
PL011_BAUDRATE);
@@ -166,23 +172,23 @@ void __dead2 cactus_main(void)
NOTICE("Booting Primary Cactus Secure Partition\n%s\n%s\n",
build_message, version_string);
- cactus_print_memory_layout();
-
- NOTICE("SPCI id: %u\n", spci_id); /* Expect VM id 1 */
-
/* Get number of VMs */
NOTICE("VM count: %u\n", spm_vm_get_count());
/* Get virtual CPU count for current VM */
- NOTICE("vCPU count: %u\n", spm_vcpu_get_count(spci_id));
+ NOTICE("vCPU count: %u\n", spm_vcpu_get_count(ffa_id));
} else {
set_putc_impl(HVC_CALL_AS_STDOUT);
NOTICE("Booting Secondary Cactus Secure Partition\n%s\n%s\n",
build_message, version_string);
}
+
+ NOTICE("FFA id: %u\n", ffa_id);
+ cactus_print_memory_layout(ffa_id);
+
/* End up to message loop */
- message_loop(spci_id);
+ message_loop(ffa_id);
/* Not reached */
}
diff --git a/spm/cactus/spci_helpers.h b/spm/cactus/ffa_helpers.h
index 189df9aa..8f6beb44 100644
--- a/spm/cactus/spci_helpers.h
+++ b/spm/cactus/ffa_helpers.h
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef __SPCI_HELPERS_H__
-#define __SPCI_HELPERS_H__
+#ifndef __FFA_HELPERS_H__
+#define __FFA_HELPERS_H__
-#include <spci_svc.h>
+#include <ffa_svc.h>
#include "tftf_lib.h"
#define SPM_VM_ID_FIRST (1)
@@ -17,19 +17,19 @@
#define SPM_VCPU_GET_COUNT (0xFF02)
#define SPM_DEBUG_LOG (0xBD000000)
-/* Hypervisor ID at physical SPCI instance */
+/* Hypervisor ID at physical FFA instance */
#define HYP_ID (0)
/* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */
#define SP_ID(x) ((x) | (1 << 15))
-typedef unsigned short spci_vm_id_t;
-typedef unsigned short spci_vm_count_t;
-typedef unsigned short spci_vcpu_count_t;
+typedef unsigned short ffa_vm_id_t;
+typedef unsigned short ffa_vm_count_t;
+typedef unsigned short ffa_vcpu_count_t;
/* Functions */
-static inline spci_vcpu_count_t spm_vcpu_get_count(spci_vm_id_t vm_id)
+static inline ffa_vcpu_count_t spm_vcpu_get_count(ffa_vm_id_t vm_id)
{
hvc_args args = {
.fid = SPM_VCPU_GET_COUNT,
@@ -41,7 +41,7 @@ static inline spci_vcpu_count_t spm_vcpu_get_count(spci_vm_id_t vm_id)
return ret.ret0;
}
-static inline spci_vm_count_t spm_vm_get_count(void)
+static inline ffa_vm_count_t spm_vm_get_count(void)
{
hvc_args args = {
.fid = SPM_VM_GET_COUNT
@@ -62,31 +62,31 @@ static inline void spm_debug_log(char c)
(void)tftf_hvc(&args);
}
-static inline smc_ret_values spci_id_get(void)
+static inline smc_ret_values ffa_id_get(void)
{
smc_args args = {
- .fid = SPCI_ID_GET
+ .fid = FFA_ID_GET
};
return tftf_smc(&args);
}
-static inline smc_ret_values spci_msg_wait(void)
+static inline smc_ret_values ffa_msg_wait(void)
{
smc_args args = {
- .fid = SPCI_MSG_WAIT
+ .fid = FFA_MSG_WAIT
};
return tftf_smc(&args);
}
/* Send response through registers using direct messaging */
-static inline smc_ret_values spci_msg_send_direct_resp(spci_vm_id_t sender_vm_id,
- spci_vm_id_t target_vm_id,
+static inline smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t sender_vm_id,
+ ffa_vm_id_t target_vm_id,
uint32_t message)
{
smc_args args = {
- .fid = SPCI_MSG_SEND_DIRECT_RESP_SMC32,
+ .fid = FFA_MSG_SEND_DIRECT_RESP_SMC32,
.arg1 = ((uint32_t)sender_vm_id << 16) | target_vm_id,
.arg3 = message
};
@@ -94,10 +94,10 @@ static inline smc_ret_values spci_msg_send_direct_resp(spci_vm_id_t sender_vm_id
return tftf_smc(&args);
}
-static inline smc_ret_values spci_error(int32_t error_code)
+static inline smc_ret_values ffa_error(int32_t error_code)
{
smc_args args = {
- .fid = SPCI_ERROR,
+ .fid = FFA_ERROR,
.arg1 = 0,
.arg2 = error_code
};
@@ -105,4 +105,4 @@ static inline smc_ret_values spci_error(int32_t error_code)
return tftf_smc(&args);
}
-#endif /* __SPCI_HELPERS_H__ */
+#endif /* __FFA_HELPERS_H__ */
diff --git a/tftf/tests/runtime_services/secure_service/spci_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index 1370a387..9d19fec2 100644
--- a/tftf/tests/runtime_services/secure_service/spci_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -6,11 +6,11 @@
#include <debug.h>
#include <smccc.h>
-#include <spci_helpers.h>
-#include <spci_svc.h>
+#include <ffa_helpers.h>
+#include <ffa_svc.h>
/*-----------------------------------------------------------------------------
- * SPCI_RUN
+ * FFA_RUN
*
* Parameters
* uint32 Function ID (w0): 0x8400006D
@@ -19,17 +19,17 @@
* -Bits[15:0]: ID of vCPU of SP/VM to run.
* Other Parameter registers w2-w7/x2-x7: Reserved (MBZ)
*
- * On failure, returns SPCI_ERROR in w0 and error code in w2:
+ * On failure, returns FFA_ERROR in w0 and error code in w2:
* -INVALID_PARAMETERS: Unrecognized endpoint or vCPU ID
- * -NOT_SUPPORTED: This function is not implemented at this SPCI instance
+ * -NOT_SUPPORTED: This function is not implemented at this FFA instance
* -DENIED: Callee is not in a state to handle this request
* -BUSY: vCPU is busy and caller must retry later
* -ABORTED: vCPU or VM ran into an unexpected error and has aborted
*/
-smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id)
+smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id)
{
smc_args args = {
- SPCI_MSG_RUN,
+ FFA_MSG_RUN,
(dest_id << 16) | vcpu_id,
0, 0, 0, 0, 0, 0
};
@@ -38,7 +38,7 @@ smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id)
}
/*-----------------------------------------------------------------------------
- * SPCI_MSG_SEND_DIRECT_REQ
+ * FFA_MSG_SEND_DIRECT_REQ
*
* Parameters
* uint32 Function ID (w0): 0x8400006F / 0xC400006F
@@ -48,14 +48,14 @@ smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id)
* uint32/uint64 (w2/x2) - RFU MBZ
* w3-w7 - Implementation defined
*
- * On failure, returns SPCI_ERROR in w0 and error code in w2:
+ * On failure, returns FFA_ERROR in w0 and error code in w2:
* -INVALID_PARAMETERS: Invalid endpoint ID or non-zero reserved register
* -DENIED: Callee is not in a state to handle this request
- * -NOT_SUPPORTED: This function is not implemented at this SPCI instance
+ * -NOT_SUPPORTED: This function is not implemented at this FFA instance
* -BUSY: Message target is busy
* -ABORTED: Message target ran into an unexpected error and has aborted
*/
-static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id,
+static smc_ret_values __ffa_msg_send_direct_req32_5(uint32_t source_id,
uint32_t dest_id,
uint32_t arg0,
uint32_t arg1,
@@ -64,7 +64,7 @@ static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id,
uint32_t arg4)
{
smc_args args = {
- SPCI_MSG_SEND_DIRECT_REQ_SMC32,
+ FFA_MSG_SEND_DIRECT_REQ_SMC32,
(source_id << 16) | dest_id,
0,
arg0, arg1, arg2, arg3, arg4
@@ -74,14 +74,14 @@ static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id,
}
/* Direct message send helper accepting a single 32b message argument */
-smc_ret_values spci_msg_send_direct_req(uint32_t source_id, uint32_t dest_id,
+smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id,
uint32_t message)
{
- return __spci_msg_send_direct_req32_5(source_id, dest_id,
+ return __ffa_msg_send_direct_req32_5(source_id, dest_id,
message, 0, 0, 0, 0);
}
-static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id,
+static smc_ret_values __ffa_msg_send_direct_req64_5(uint32_t source_id,
uint32_t dest_id,
uint64_t arg0,
uint64_t arg1,
@@ -90,7 +90,7 @@ static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id,
uint64_t arg4)
{
smc_args args = {
- SPCI_MSG_SEND_DIRECT_REQ_SMC64,
+ FFA_MSG_SEND_DIRECT_REQ_SMC64,
(source_id << 16) | dest_id,
0,
arg0, arg1, arg2, arg3, arg4
@@ -100,9 +100,9 @@ static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id,
}
/* Direct message send helper accepting a single 64b message argument */
-smc_ret_values spci_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id,
+smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id,
uint64_t message)
{
- return __spci_msg_send_direct_req64_5(source_id, dest_id,
+ return __ffa_msg_send_direct_req64_5(source_id, dest_id,
message, 0, 0, 0, 0);
}
diff --git a/tftf/tests/runtime_services/secure_service/test_spci_direct_messaging.c b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c
index e085226b..f1890543 100644
--- a/tftf/tests/runtime_services/secure_service/test_spci_direct_messaging.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c
@@ -8,11 +8,11 @@
#include <cactus_def.h>
#include <platform.h>
#include <smccc.h>
-#include <spci_helpers.h>
-#include <spci_svc.h>
+#include <ffa_helpers.h>
+#include <ffa_svc.h>
#include <test_helpers.h>
-/* Hypervisor ID at physical SPCI instance */
+/* Hypervisor ID at physical FFA instance */
#define HYP_ID (0)
/* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */
@@ -22,10 +22,10 @@
#define DIRECT_MSG_TEST_PATTERN2 (0xbbbb0000)
#define DIRECT_MSG_TEST_PATTERN3 (0xcccc0000)
-#define OPTEE_SPCI_GET_API_VERSION (0)
-#define OPTEE_SPCI_GET_OS_VERSION (1)
-#define OPTEE_SPCI_GET_OS_VERSION_MAJOR (3)
-#define OPTEE_SPCI_GET_OS_VERSION_MINOR (8)
+#define OPTEE_FFA_GET_API_VERSION (0)
+#define OPTEE_FFA_GET_OS_VERSION (1)
+#define OPTEE_FFA_GET_OS_VERSION_MAJOR (3)
+#define OPTEE_FFA_GET_OS_VERSION_MINOR (8)
static test_result_t send_receive_direct_msg(unsigned int sp_id,
unsigned int test_pattern)
@@ -33,15 +33,15 @@ static test_result_t send_receive_direct_msg(unsigned int sp_id,
smc_ret_values ret_values;
/* Send a message to SP through direct messaging */
- ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(sp_id),
+ ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(sp_id),
test_pattern);
/*
- * Return responses may be SPCI_MSG_SEND_DIRECT_RESP or SPCI_INTERRUPT,
+ * Return responses may be FFA_MSG_SEND_DIRECT_RESP or FFA_INTERRUPT,
* but only expect the former. Expect SMC32 convention from SP.
*/
- if (ret_values.ret0 != SPCI_MSG_SEND_DIRECT_RESP_SMC32) {
- tftf_testcase_printf("spci_msg_send_direct_req returned %lx\n",
+ if (ret_values.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
+ tftf_testcase_printf("ffa_msg_send_direct_req returned %lx\n",
(u_register_t)ret_values.ret0);
return TEST_RESULT_FAIL;
}
@@ -75,40 +75,40 @@ static bool check_spmc_execution_level(void)
/*
* Send a first OP-TEE-defined protocol message through
- * SPCI direct message.
+ * FFA direct message.
*
*/
- ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(1),
- OPTEE_SPCI_GET_API_VERSION);
- if ((ret_values.ret3 == SPCI_VERSION_MAJOR) &&
- (ret_values.ret4 == SPCI_VERSION_MINOR)) {
+ ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1),
+ OPTEE_FFA_GET_API_VERSION);
+ if ((ret_values.ret3 == FFA_VERSION_MAJOR) &&
+ (ret_values.ret4 == FFA_VERSION_MINOR)) {
is_optee_spmc_criteria++;
}
/*
* Send a second OP-TEE-defined protocol message through
- * SPCI direct message.
+ * FFA direct message.
*
*/
- ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(1),
- OPTEE_SPCI_GET_OS_VERSION);
- if ((ret_values.ret3 == OPTEE_SPCI_GET_OS_VERSION_MAJOR) &&
- (ret_values.ret4 == OPTEE_SPCI_GET_OS_VERSION_MINOR)) {
+ ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1),
+ OPTEE_FFA_GET_OS_VERSION);
+ if ((ret_values.ret3 == OPTEE_FFA_GET_OS_VERSION_MAJOR) &&
+ (ret_values.ret4 == OPTEE_FFA_GET_OS_VERSION_MINOR)) {
is_optee_spmc_criteria++;
}
return (is_optee_spmc_criteria == 2);
}
-test_result_t test_spci_direct_messaging(void)
+test_result_t test_ffa_direct_messaging(void)
{
smc_ret_values ret_values;
test_result_t result;
/**********************************************************************
- * Verify that SPCI is there and that it has the correct version.
+ * Verify that FFA is there and that it has the correct version.
**********************************************************************/
- SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(0, 9);
+ SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0);
/* Check if SPMC is OP-TEE at S-EL1 */
if (check_spmc_execution_level()) {
@@ -135,14 +135,14 @@ test_result_t test_spci_direct_messaging(void)
**********************************************************************/
/*
* NOTICE: for now, the SPM does not initially run each SP sequentially
- * on boot up so we explicitely run the SP once by invoking SPCI_RUN so
- * it reaches spci_msg_wait in the message loop function.
+ * on boot up so we explicitely run the SP once by invoking FFA_RUN so
+ * it reaches ffa_msg_wait in the message loop function.
*/
/* Request running SP2 on VCPU0 */
- ret_values = spci_run(2, 0);
- if (ret_values.ret0 != SPCI_MSG_WAIT) {
- tftf_testcase_printf("spci_run returned %lx\n",
+ ret_values = ffa_run(2, 0);
+ if (ret_values.ret0 != FFA_MSG_WAIT) {
+ tftf_testcase_printf("ffa_run returned %lx\n",
(u_register_t)ret_values.ret0);
return TEST_RESULT_FAIL;
}
diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk
index 40c9b87d..dab4c6ac 100644
--- a/tftf/tests/tests-spm.mk
+++ b/tftf/tests/tests-spm.mk
@@ -6,6 +6,6 @@
TESTS_SOURCES += \
$(addprefix tftf/tests/runtime_services/secure_service/, \
- spci_helpers.c \
- test_spci_direct_messaging.c \
+ ffa_helpers.c \
+ test_ffa_direct_messaging.c \
)
diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml
index beac7dd6..09af6397 100644
--- a/tftf/tests/tests-spm.xml
+++ b/tftf/tests/tests-spm.xml
@@ -11,8 +11,8 @@
<testsuite name="Secure Partition Manager"
description="Test SPM APIs">
- <testcase name="SPCI direct messaging API"
- function="test_spci_direct_messaging" />
+ <testcase name="PSA FF-A direct messaging API"
+ function="test_ffa_direct_messaging" />
</testsuite>