diff options
author | Madhukar Pappireddy <madhukar.pappireddy@arm.com> | 2021-08-20 13:13:49 -0500 |
---|---|---|
committer | Madhukar Pappireddy <madhukar.pappireddy@arm.com> | 2021-11-05 15:35:57 -0500 |
commit | b640259337bc9db70d853ed886a39e67b11ffeae (patch) | |
tree | 19d01a1aa5ee44815a42ac4f495a6adbd845b0aa | |
parent | 3c287264eb513c720136a3ce8f24fa9a07a02ce8 (diff) |
feat: add a test command to send request to a VM/SP ..
requesting it to forward sleep request to another VM/SP.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I26f25fba93bedc38bfd0a5d785591582715921c3
-rw-r--r-- | include/runtime_services/cactus_test_cmds.h | 21 | ||||
-rw-r--r-- | spm/cactus/cactus_tests/cactus_test_interrupts.c | 30 |
2 files changed, 51 insertions, 0 deletions
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h index 131e964..d4cf407 100644 --- a/include/runtime_services/cactus_test_cmds.h +++ b/include/runtime_services/cactus_test_cmds.h @@ -264,11 +264,32 @@ static inline smc_ret_values cactus_sleep_cmd( 0); } +/** + * Command to request cactus to forward sleep command for the given time in ms + * + * The sender of this command expects to receive CACTUS_SUCCESS if the requested + * echo interaction happened successfully, or CACTUS_ERROR otherwise. + */ +#define CACTUS_FWD_SLEEP_CMD (CACTUS_SLEEP_CMD + 1) + +static inline smc_ret_values cactus_fwd_sleep_cmd( + ffa_id_t source, ffa_id_t dest, ffa_id_t fwd_dest, + uint32_t sleep_time) +{ + return cactus_send_cmd(source, dest, CACTUS_FWD_SLEEP_CMD, sleep_time, + fwd_dest, 0, 0); +} + static inline uint32_t cactus_get_sleep_time(smc_ret_values ret) { return (uint32_t)ret.ret4; } +static inline ffa_id_t cactus_get_fwd_sleep_dest(smc_ret_values ret) +{ + return (ffa_id_t)ret.ret5; +} + /** * Command to request cactus to enable/disable an interrupt * diff --git a/spm/cactus/cactus_tests/cactus_test_interrupts.c b/spm/cactus/cactus_tests/cactus_test_interrupts.c index a79885c..5cd53d1 100644 --- a/spm/cactus/cactus_tests/cactus_test_interrupts.c +++ b/spm/cactus/cactus_tests/cactus_test_interrupts.c @@ -30,6 +30,36 @@ CACTUS_CMD_HANDLER(sleep_cmd, CACTUS_SLEEP_CMD) time_lapsed); } +CACTUS_CMD_HANDLER(sleep_fwd_cmd, CACTUS_FWD_SLEEP_CMD) +{ + smc_ret_values ffa_ret; + ffa_id_t vm_id = ffa_dir_msg_dest(*args); + ffa_id_t fwd_dest = cactus_get_fwd_sleep_dest(*args); + uint32_t sleep_ms = cactus_get_sleep_time(*args); + + + VERBOSE("VM%x requested %x to sleep for value %u\n", + ffa_dir_msg_source(*args), fwd_dest, sleep_ms); + + ffa_ret = cactus_sleep_cmd(vm_id, fwd_dest, sleep_ms); + + if (!is_ffa_direct_response(ffa_ret)) { + ERROR("Encountered error in CACTUS_FWD_SLEEP_CMD response\n"); + return cactus_error_resp(vm_id, ffa_dir_msg_source(*args), + CACTUS_ERROR_FFA_CALL); + } + + if (cactus_get_response(ffa_ret) != sleep_ms) { + ERROR("Request returned: %u ms!\n", + cactus_get_response(ffa_ret)); + return cactus_error_resp(vm_id, ffa_dir_msg_source(*args), + CACTUS_ERROR_TEST); + + } + + return cactus_success_resp(vm_id, ffa_dir_msg_source(*args), 0); +} + CACTUS_CMD_HANDLER(interrupt_cmd, CACTUS_INTERRUPT_CMD) { uint32_t int_id = cactus_get_interrupt_id(*args); |