diff options
author | Manish Pandey <manish.pandey2@arm.com> | 2020-09-22 09:50:45 +0000 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2020-09-22 09:50:45 +0000 |
commit | b43e2c8ed33a3e5aff46ce8fccd0e776da2c09af (patch) | |
tree | c5aadd3fde1dfcf08e9c2e9dcbaf849a9b552b7f | |
parent | 642d8b60264aacefdcba56056d0181f1cff0d2a6 (diff) | |
parent | 73d81cf12f362e7cf80d0b9cc214b7e0d3ffb3c4 (diff) | |
download | tf-a-tests-b43e2c8ed33a3e5aff46ce8fccd0e776da2c09af.tar.gz |
Merge changes from topic "od/ffa-id"
* changes:
cactus: break the message loop on bad message request
cactus: re-align secure partition id
cactus: adjust the number of EC context to max number of PEs
-rw-r--r-- | spm/cactus/cactus-secondary.dts | 2 | ||||
-rw-r--r-- | spm/cactus/cactus-tertiary.dts | 2 | ||||
-rw-r--r-- | spm/cactus/cactus.dts | 2 | ||||
-rw-r--r-- | spm/cactus/cactus_def.h | 8 | ||||
-rw-r--r-- | spm/cactus/cactus_ffa_tests.c | 6 | ||||
-rw-r--r-- | spm/cactus/cactus_main.c | 24 | ||||
-rw-r--r-- | spm/common/sp_helpers.h | 6 | ||||
-rw-r--r-- | tftf/tests/runtime_services/secure_service/ffa_helpers.c | 4 | ||||
-rw-r--r-- | tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c | 17 |
9 files changed, 33 insertions, 38 deletions
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts index 71a56f4f3..661684bd7 100644 --- a/spm/cactus/cactus-secondary.dts +++ b/spm/cactus/cactus-secondary.dts @@ -20,7 +20,7 @@ id = <2>; auxiliary-id = <0xae>; stream-endpoint-ids = <0 1 2 3>; - execution-ctx-count = <1>; + execution-ctx-count = <8>; exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7100000>; diff --git a/spm/cactus/cactus-tertiary.dts b/spm/cactus/cactus-tertiary.dts index d823ef397..ea7d5d6ff 100644 --- a/spm/cactus/cactus-tertiary.dts +++ b/spm/cactus/cactus-tertiary.dts @@ -20,7 +20,7 @@ id = <3>; auxiliary-id = <0xae>; stream-endpoint-ids = <0 1 2 3>; - execution-ctx-count = <1>; + execution-ctx-count = <8>; exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7200000>; diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts index 919a5d53a..e64d3a8ef 100644 --- a/spm/cactus/cactus.dts +++ b/spm/cactus/cactus.dts @@ -20,7 +20,7 @@ id = <1>; auxiliary-id = <0xae>; stream-endpoint-ids = <0 1 2 3>; - execution-ctx-count = <1>; + execution-ctx-count = <8>; exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7000000>; diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h index 5a4a5dd6d..be6f06ae1 100644 --- a/spm/cactus/cactus_def.h +++ b/spm/cactus/cactus_def.h @@ -31,10 +31,10 @@ /* * RX/TX buffer helpers. */ -#define get_sp_rx_start(sp_id) (CACTUS_RX_BASE + ((sp_id - 1) * CACTUS_RX_TX_SIZE)) -#define get_sp_rx_end(sp_id) (CACTUS_RX_BASE + ((sp_id - 1) * CACTUS_RX_TX_SIZE) + PAGE_SIZE) -#define get_sp_tx_start(sp_id) (CACTUS_TX_BASE + ((sp_id - 1) * CACTUS_RX_TX_SIZE)) -#define get_sp_tx_end(sp_id) (CACTUS_TX_BASE + ((sp_id - 1) * CACTUS_RX_TX_SIZE) + PAGE_SIZE) +#define get_sp_rx_start(sp_id) (CACTUS_RX_BASE + (((sp_id & 0x7FFFU) - 1U) * CACTUS_RX_TX_SIZE)) +#define get_sp_rx_end(sp_id) (CACTUS_RX_BASE + (((sp_id & 0x7FFFU) - 1U) * CACTUS_RX_TX_SIZE) + PAGE_SIZE) +#define get_sp_tx_start(sp_id) (CACTUS_TX_BASE + (((sp_id & 0x7FFFU) - 1U) * CACTUS_RX_TX_SIZE)) +#define get_sp_tx_end(sp_id) (CACTUS_TX_BASE + (((sp_id & 0x7FFFU) - 1U) * CACTUS_RX_TX_SIZE) + PAGE_SIZE) /* * UUID of secure partition as defined in the respective manifests. diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c index 085923a85..a242e41a0 100644 --- a/spm/cactus/cactus_ffa_tests.c +++ b/spm/cactus/cactus_ffa_tests.c @@ -121,9 +121,9 @@ static void ffa_partition_info_get_test(struct mailbox_buffers *mb) const char *test_all = "Get all partitions info"; const struct ffa_partition_info expected_info[] = { - {.id = SPM_VM_ID_FIRST, .exec_context = 8, .properties = 0}, /* Primary partition info */ - {.id = SPM_VM_ID_SECOND, .exec_context = 2, .properties = 0}, /* Secondary partition info */ - {.id = SPM_VM_ID_THIRD, .exec_context = 2, .properties = 0} /* Tertiary partition info */ + {.id = SPM_VM_ID_FIRST, .exec_context = 8U, .properties = 0U}, /* Primary partition info */ + {.id = SPM_VM_ID_FIRST + 1U, .exec_context = 8U, .properties = 0U}, /* Secondary partition info */ + {.id = SPM_VM_ID_FIRST + 2U, .exec_context = 8U, .properties = 0U} /* Tertiary partition info */ }; announce_test_section_start(test_partition_info); diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c index e8333108e..727ebcb78 100644 --- a/spm/cactus/cactus_main.c +++ b/spm/cactus/cactus_main.c @@ -50,18 +50,21 @@ static void __dead2 message_loop(ffa_vm_id_t vm_id) for (;;) { if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC32) { - ffa_ret = ffa_error(-1); - continue; + ERROR("%s(%u) unknown func id 0x%lx\n", + __func__, vm_id, ffa_ret.ret0); + break; } - if (ffa_ret.ret1 != SP_ID(vm_id)) { - ffa_ret = ffa_error(-2); - continue; + if (ffa_ret.ret1 != vm_id) { + ERROR("%s(%u) invalid vm id 0x%lx\n", + __func__, vm_id, ffa_ret.ret1); + break; } if (ffa_ret.ret2 != HYP_ID) { - ffa_ret = ffa_error(-3); - continue; + ERROR("%s(%u) invalid hyp id 0x%lx\n", + __func__, vm_id, ffa_ret.ret2); + break; } /* @@ -74,9 +77,10 @@ static void __dead2 message_loop(ffa_vm_id_t vm_id) * Send a response through direct messaging then block * until receiving a new message request. */ - ffa_ret = ffa_msg_send_direct_resp(SP_ID(vm_id), - HYP_ID, sp_response); + ffa_ret = ffa_msg_send_direct_resp(vm_id, HYP_ID, sp_response); } + + panic(); } static const mmap_region_t cactus_mmap[] __attribute__((used)) = { @@ -188,7 +192,7 @@ void __dead2 cactus_main(void) NOTICE("Booting Secondary Cactus Secure Partition (ID: %u)\n%s\n%s\n", ffa_id, build_message, version_string); - if (ffa_id == SPM_VM_ID_THIRD) { + if (ffa_id == (SPM_VM_ID_FIRST + 2)) { NOTICE("Mapping RXTX Region\n"); /* Declare RX/TX buffers at virtual FF-A instance */ diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h index 7096daf52..965f79903 100644 --- a/spm/common/sp_helpers.h +++ b/spm/common/sp_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 */ @@ -11,9 +11,7 @@ #include <tftf_lib.h> #include <ffa_helpers.h> -#define SPM_VM_ID_FIRST (1) -#define SPM_VM_ID_SECOND (2) -#define SPM_VM_ID_THIRD (3) +#define SPM_VM_ID_FIRST SP_ID(1) #define SPM_VM_GET_COUNT (0xFF01) #define SPM_VCPU_GET_COUNT (0xFF02) diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c index 7ccf89003..bda47c989 100644 --- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c +++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c @@ -134,7 +134,7 @@ bool check_spmc_execution_level(void) * */ ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1), - OPTEE_FFA_GET_API_VERSION); + OPTEE_FFA_GET_API_VERSION); if ((ret_values.ret3 == FFA_VERSION_MAJOR) && (ret_values.ret4 == FFA_VERSION_MINOR)) { is_optee_spmc_criteria++; @@ -146,7 +146,7 @@ bool check_spmc_execution_level(void) * */ ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1), - OPTEE_FFA_GET_OS_VERSION); + 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++; diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c index 6008b7800..d00793abe 100644 --- a/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c +++ b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c @@ -22,8 +22,7 @@ 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 = ffa_msg_send_direct_req(HYP_ID, SP_ID(sp_id), - test_pattern); + ret_values = ffa_msg_send_direct_req(HYP_ID, sp_id, test_pattern); /* * Return responses may be FFA_MSG_SEND_DIRECT_RESP or FFA_INTERRUPT, @@ -70,7 +69,7 @@ test_result_t test_ffa_direct_messaging(void) /********************************************************************** * Send a message to SP1 through direct messaging **********************************************************************/ - result = send_receive_direct_msg(1, DIRECT_MSG_TEST_PATTERN1); + result = send_receive_direct_msg(SP_ID(1), DIRECT_MSG_TEST_PATTERN1); if (result != TEST_RESULT_SUCCESS) { return result; } @@ -78,7 +77,7 @@ test_result_t test_ffa_direct_messaging(void) /********************************************************************** * Send a message to SP2 through direct messaging **********************************************************************/ - result = send_receive_direct_msg(2, DIRECT_MSG_TEST_PATTERN2); + result = send_receive_direct_msg(SP_ID(2), DIRECT_MSG_TEST_PATTERN2); if (result != TEST_RESULT_SUCCESS) { return result; } @@ -86,13 +85,7 @@ test_result_t test_ffa_direct_messaging(void) /********************************************************************** * Send a message to SP1 through direct messaging **********************************************************************/ - result = send_receive_direct_msg(1, DIRECT_MSG_TEST_PATTERN3); - if (result != TEST_RESULT_SUCCESS) { - return result; - } + result = send_receive_direct_msg(SP_ID(1), DIRECT_MSG_TEST_PATTERN3); - /********************************************************************** - * All tests passed. - **********************************************************************/ - return TEST_RESULT_SUCCESS; + return result; } |