diff options
author | J-Alves <joao.alves@arm.com> | 2021-07-30 11:58:41 +0100 |
---|---|---|
committer | J-Alves <joao.alves@arm.com> | 2021-11-09 17:10:19 +0000 |
commit | f7535f4a81fb6015a3373f00f07f6ecb216df01c (patch) | |
tree | 04e857c55b158c20807d186f56e18d165787f1b2 /spm/cactus/cactus_tests | |
parent | 269118a82af2c240513a716c1db2cb66ccce1e3e (diff) |
feat(cactus): count requests received
Message loop counts the amount of requests received in each core. The
counting can be accessed through newly added test command
CACTUS_GET_REQ_COUNT_CMD.
Added such special command to be able to test delay Schedule Receiver
Interrupt, in the context of the notifications feature.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Id0a5a9cf58e10d1221a1a0f0af6264474fe7e020
Diffstat (limited to 'spm/cactus/cactus_tests')
-rw-r--r-- | spm/cactus/cactus_tests/cactus_message_loop.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/spm/cactus/cactus_tests/cactus_message_loop.c b/spm/cactus/cactus_tests/cactus_message_loop.c index c24f6fc..750c954 100644 --- a/spm/cactus/cactus_tests/cactus_message_loop.c +++ b/spm/cactus/cactus_tests/cactus_message_loop.c @@ -4,11 +4,20 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "cactus_message_loop.h" -#include "cactus_test_cmds.h" -#include <ffa_helpers.h> #include <debug.h> +#include <cactus_message_loop.h> +#include <cactus_test_cmds.h> +#include <ffa_helpers.h> +#include <events.h> +#include <platform.h> + +/** + * Counter of the number of handled requests, for each CPU. The number of + * requests can be accessed from another Cactus SP, or from the normal world + * using a special test command. + */ +static uint32_t requests_counter[PLATFORM_CORE_COUNT]; /** * Begin and end of command handler table, respectively. Both symbols defined by @@ -31,6 +40,10 @@ bool cactus_handle_cmd(smc_ret_values *cmd_args, smc_ret_values *ret, { uint64_t in_cmd; + /* Get which core it is running from. */ + unsigned int core_pos = platform_get_core_pos( + read_mpidr_el1() & MPID_MASK); + if (cmd_args == NULL || ret == NULL) { ERROR("Invalid arguments passed to %s!\n", __func__); return false; @@ -45,10 +58,33 @@ bool cactus_handle_cmd(smc_ret_values *cmd_args, smc_ret_values *ret, it_cmd++) { if (it_cmd->id == in_cmd) { *ret = it_cmd->fn(cmd_args, mb); + + /* + * Increment the number of requests handled in current + * core. + */ + requests_counter[core_pos]++; + return true; } } + /* Handle special command. */ + if (in_cmd == CACTUS_GET_REQ_COUNT_CMD) { + uint32_t requests_counter_resp; + + /* Read value from array. */ + requests_counter_resp = requests_counter[core_pos]; + VERBOSE("Requests Counter %u, core: %u\n", requests_counter_resp, + core_pos); + + *ret = cactus_success_resp( + ffa_dir_msg_dest(*cmd_args), + ffa_dir_msg_source(*cmd_args), + requests_counter_resp); + return true; + } + *ret = cactus_error_resp(ffa_dir_msg_dest(*cmd_args), ffa_dir_msg_source(*cmd_args), CACTUS_ERROR_UNHANDLED); |