| From a9edc50077d72cdd7e40ba3f03aee974848cd532 Mon Sep 17 00:00:00 2001 |
| From: Imre Kis <imre.kis@arm.com> |
| Date: Tue, 19 Jul 2022 17:38:00 +0200 |
| Subject: [PATCH 21/24] Add 64 bit direct message handling to libsp |
| |
| * Change direct message struct to allow 64 bit arguments |
| * Add 64 bit direct message req/resp functions to FF-A layer |
| * Distinguish 32/64 bit messages on SP layer by field in sp_msg |
| * Update tests and mocks |
| |
| The FF-A direct message response must match the request's 32/64bit mode |
| which is the responsibility of the callee and it should be validated by |
| the SPMC. |
| |
| Signed-off-by: Imre Kis <imre.kis@arm.com> |
| Change-Id: Ibbd64ca0291dfe142a23471a649a07ba1a036824 |
| |
| Upstream-Status: Pending [In review] |
| Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> |
| |
| --- |
| components/messaging/ffa/libsp/ffa.c | 84 ++- |
| .../libsp/ffa_direct_msg_routing_extension.c | 28 +- |
| .../messaging/ffa/libsp/include/ffa_api.h | 58 +- |
| .../ffa/libsp/include/ffa_api_defines.h | 5 + |
| .../ffa/libsp/include/ffa_api_types.h | 7 +- |
| .../ffa/libsp/include/sp_messaging.h | 9 +- |
| .../messaging/ffa/libsp/mock/mock_ffa_api.cpp | 100 +++- |
| .../messaging/ffa/libsp/mock/mock_ffa_api.h | 34 +- |
| .../ffa/libsp/mock/test/test_mock_ffa_api.cpp | 50 +- |
| components/messaging/ffa/libsp/sp_messaging.c | 74 ++- |
| .../messaging/ffa/libsp/test/test_ffa_api.cpp | 337 ++++++++++-- |
| .../ffa/libsp/test/test_sp_messaging.cpp | 498 ++++++++++-------- |
| .../rpc/ffarpc/caller/sp/ffarpc_caller.c | 31 +- |
| .../rpc/ffarpc/endpoint/ffarpc_call_ep.c | 4 +- |
| .../endpoint/sp/mm_communicate_call_ep.c | 16 +- |
| .../smm-gateway/common/smm_gateway_sp.c | 8 +- |
| 16 files changed, 961 insertions(+), 382 deletions(-) |
| |
| diff --git a/components/messaging/ffa/libsp/ffa.c b/components/messaging/ffa/libsp/ffa.c |
| index 374e940..caacc79 100644 |
| --- a/components/messaging/ffa/libsp/ffa.c |
| +++ b/components/messaging/ffa/libsp/ffa.c |
| @@ -33,11 +33,20 @@ static inline void ffa_unpack_direct_msg(struct ffa_params *svc_result, |
| msg->function_id = svc_result->a0; |
| msg->source_id = (svc_result->a1 >> 16); |
| msg->destination_id = svc_result->a1; |
| - msg->args[0] = svc_result->a3; |
| - msg->args[1] = svc_result->a4; |
| - msg->args[2] = svc_result->a5; |
| - msg->args[3] = svc_result->a6; |
| - msg->args[4] = svc_result->a7; |
| + |
| + if (FFA_IS_32_BIT_FUNC(msg->function_id)) { |
| + msg->args.args32[0] = svc_result->a3; |
| + msg->args.args32[1] = svc_result->a4; |
| + msg->args.args32[2] = svc_result->a5; |
| + msg->args.args32[3] = svc_result->a6; |
| + msg->args.args32[4] = svc_result->a7; |
| + } else { |
| + msg->args.args64[0] = svc_result->a3; |
| + msg->args.args64[1] = svc_result->a4; |
| + msg->args.args64[2] = svc_result->a5; |
| + msg->args.args64[3] = svc_result->a6; |
| + msg->args.args64[4] = svc_result->a7; |
| + } |
| } |
| |
| /* |
| @@ -217,7 +226,7 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg) |
| |
| if (result.a0 == FFA_ERROR) { |
| return ffa_get_errorcode(&result); |
| - } else if (result.a0 == FFA_MSG_SEND_DIRECT_REQ_32) { |
| + } else if (FFA_TO_32_BIT_FUNC(result.a0) == FFA_MSG_SEND_DIRECT_REQ_32) { |
| ffa_unpack_direct_msg(&result, msg); |
| } else { |
| assert(result.a0 == FFA_SUCCESS_32); |
| @@ -227,13 +236,15 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg) |
| return FFA_OK; |
| } |
| |
| -ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, struct ffa_direct_msg *msg) |
| +static ffa_result ffa_msg_send_direct_req(uint32_t function_id, uint32_t resp_id, |
| + uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg) |
| { |
| struct ffa_params result = {0}; |
| |
| - ffa_svc(FFA_MSG_SEND_DIRECT_REQ_32, |
| + ffa_svc(function_id, |
| SHIFT_U32(source, FFA_MSG_SEND_DIRECT_REQ_SOURCE_ID_SHIFT) | |
| dest, FFA_PARAM_MBZ, a0, a1, a2, a3, a4, &result); |
| |
| @@ -244,7 +255,7 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| |
| if (result.a0 == FFA_ERROR) { |
| return ffa_get_errorcode(&result); |
| - } else if (result.a0 == FFA_MSG_SEND_DIRECT_RESP_32) { |
| + } else if (result.a0 == resp_id) { |
| ffa_unpack_direct_msg(&result, msg); |
| } else { |
| assert(result.a0 == FFA_SUCCESS_32); |
| @@ -254,13 +265,36 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| return FFA_OK; |
| } |
| |
| -ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, struct ffa_direct_msg *msg) |
| +ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + struct ffa_direct_msg *msg) |
| +{ |
| + return ffa_msg_send_direct_req(FFA_MSG_SEND_DIRECT_REQ_32, |
| + FFA_MSG_SEND_DIRECT_RESP_32, |
| + source, dest, a0, a1, a2, a3, a4, msg); |
| +} |
| + |
| +ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg) |
| +{ |
| + return ffa_msg_send_direct_req(FFA_MSG_SEND_DIRECT_REQ_64, |
| + FFA_MSG_SEND_DIRECT_RESP_64, |
| + source, dest, a0, a1, a2, a3, a4, msg); |
| +} |
| + |
| +static ffa_result ffa_msg_send_direct_resp(uint32_t function_id, |
| + uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, |
| + uint64_t a2, uint64_t a3, |
| + uint64_t a4, |
| + struct ffa_direct_msg *msg) |
| { |
| struct ffa_params result = {0}; |
| |
| - ffa_svc(FFA_MSG_SEND_DIRECT_RESP_32, |
| + ffa_svc(function_id, |
| SHIFT_U32(source, FFA_MSG_SEND_DIRECT_RESP_SOURCE_ID_SHIFT) | |
| dest, FFA_PARAM_MBZ, a0, a1, a2, a3, a4, &result); |
| |
| @@ -271,7 +305,7 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| |
| if (result.a0 == FFA_ERROR) { |
| return ffa_get_errorcode(&result); |
| - } else if (result.a0 == FFA_MSG_SEND_DIRECT_REQ_32) { |
| + } else if (FFA_TO_32_BIT_FUNC(result.a0) == FFA_MSG_SEND_DIRECT_REQ_32) { |
| ffa_unpack_direct_msg(&result, msg); |
| } else { |
| assert(result.a0 == FFA_SUCCESS_32); |
| @@ -281,6 +315,24 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| return FFA_OK; |
| } |
| |
| +ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + struct ffa_direct_msg *msg) |
| +{ |
| + return ffa_msg_send_direct_resp(FFA_MSG_SEND_DIRECT_RESP_32, source, |
| + dest, a0, a1, a2, a3, a4, msg); |
| +} |
| + |
| +ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg) |
| +{ |
| + return ffa_msg_send_direct_resp(FFA_MSG_SEND_DIRECT_RESP_64, source, |
| + dest, a0, a1, a2, a3, a4, msg); |
| +} |
| + |
| ffa_result ffa_mem_donate(uint32_t total_length, uint32_t fragment_length, |
| void *buffer_address, uint32_t page_count, |
| uint64_t *handle) |
| diff --git a/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c b/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c |
| index 6813573..03a372f 100644 |
| --- a/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c |
| +++ b/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c |
| @@ -1,6 +1,6 @@ |
| // SPDX-License-Identifier: BSD-3-Clause |
| /* |
| - * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
| + * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
| */ |
| |
| #include "ffa_direct_msg_routing_extension.h" |
| @@ -20,23 +20,23 @@ static uint16_t callee_id = SP_ID_INVALID; |
| |
| static bool is_rc_message(const struct ffa_direct_msg *msg) |
| { |
| - return msg->args[0] & FFA_ROUTING_EXT_RC_BIT; |
| + return msg->args.args32[0] & FFA_ROUTING_EXT_RC_BIT; |
| } |
| |
| static bool is_error_message(const struct ffa_direct_msg *msg) |
| { |
| - return msg->args[0] & FFA_ROUTING_EXT_ERROR_BIT; |
| + return msg->args.args32[0] & FFA_ROUTING_EXT_ERROR_BIT; |
| } |
| |
| static ffa_result get_error_code_from_message(const struct ffa_direct_msg *msg) |
| { |
| - return (ffa_result)msg->args[1]; |
| + return (ffa_result)msg->args.args32[1]; |
| } |
| |
| static ffa_result send_rc_error_message(struct ffa_direct_msg *req, |
| ffa_result error_code) |
| { |
| - return ffa_msg_send_direct_resp(req->destination_id, req->source_id, |
| + return ffa_msg_send_direct_resp_32(req->destination_id, req->source_id, |
| (FFA_ROUTING_EXT_ERROR_BIT | |
| FFA_ROUTING_EXT_RC_BIT), |
| error_code, 0, 0, 0, req); |
| @@ -45,7 +45,7 @@ static ffa_result send_rc_error_message(struct ffa_direct_msg *req, |
| static ffa_result send_rc_error_message_to_rc_root(struct ffa_direct_msg *resp, |
| ffa_result error_code) |
| { |
| - return ffa_msg_send_direct_req(own_id, callee_id, |
| + return ffa_msg_send_direct_req_32(own_id, callee_id, |
| (FFA_ROUTING_EXT_RC_BIT | |
| FFA_ROUTING_EXT_ERROR_BIT), |
| error_code, 0, 0, 0, resp); |
| @@ -128,10 +128,10 @@ ffa_result ffa_direct_msg_routing_ext_req_post_hook(struct ffa_direct_msg *resp) |
| /* Forwarding RC request towards the root (normal world) */ |
| state = forwarding; |
| |
| - ffa_res = ffa_msg_send_direct_resp(own_id, caller_id, |
| - resp->args[0], resp->args[1], |
| - resp->args[2], resp->args[3], |
| - resp->args[4], &rc_resp); |
| + ffa_res = ffa_msg_send_direct_resp_32(own_id, caller_id, |
| + resp->args.args32[0], resp->args.args32[1], |
| + resp->args.args32[2], resp->args.args32[3], |
| + resp->args.args32[4], &rc_resp); |
| if (ffa_res != FFA_OK) |
| goto forward_ffa_error_to_rc_root; |
| |
| @@ -145,9 +145,9 @@ ffa_result ffa_direct_msg_routing_ext_req_post_hook(struct ffa_direct_msg *resp) |
| |
| /* Forwarding RC response towards the RC root. */ |
| state = internal; |
| - ffa_res = ffa_msg_send_direct_req( |
| - own_id, callee_id, rc_resp.args[0], rc_resp.args[1], |
| - rc_resp.args[2], rc_resp.args[3], rc_resp.args[4], |
| + ffa_res = ffa_msg_send_direct_req_32( |
| + own_id, callee_id, rc_resp.args.args32[0], rc_resp.args.args32[1], |
| + rc_resp.args.args32[2], rc_resp.args.args32[3], rc_resp.args.args32[4], |
| resp); |
| |
| goto break_on_ffa_error; |
| @@ -197,7 +197,7 @@ void ffa_direct_msg_routing_ext_resp_error_hook(void) |
| |
| void ffa_direct_msg_routing_ext_rc_req_pre_hook(struct ffa_direct_msg *req) |
| { |
| - req->args[0] = FFA_ROUTING_EXT_RC_BIT; |
| + req->args.args32[0] = FFA_ROUTING_EXT_RC_BIT; |
| state = rc_root; |
| } |
| |
| diff --git a/components/messaging/ffa/libsp/include/ffa_api.h b/components/messaging/ffa/libsp/include/ffa_api.h |
| index ec5cb04..4b7073b 100644 |
| --- a/components/messaging/ffa/libsp/include/ffa_api.h |
| +++ b/components/messaging/ffa/libsp/include/ffa_api.h |
| @@ -126,8 +126,8 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg); |
| /** Messaging interfaces */ |
| |
| /** |
| - * @brief Sends a partition message in parameter registers as a request and |
| - * blocks until the response is available. |
| + * @brief Sends a 32 bit partition message in parameter registers as a |
| + * request and blocks until the response is available. |
| * @note The ffa_interrupt_handler function can be called during the |
| * execution of this function |
| * |
| @@ -138,13 +138,14 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg); |
| * |
| * @return The FF-A error status code |
| */ |
| -ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, struct ffa_direct_msg *msg); |
| +ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + struct ffa_direct_msg *msg); |
| |
| /** |
| - * @brief Sends a partition message in parameter registers as a response |
| - * and blocks until the response is available. |
| + * @brief Sends a 64 bit partition message in parameter registers as a |
| + * request and blocks until the response is available. |
| * @note The ffa_interrupt_handler function can be called during the |
| * execution of this function |
| * |
| @@ -155,9 +156,46 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| * |
| * @return The FF-A error status code |
| */ |
| -ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, struct ffa_direct_msg *msg); |
| +ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg); |
| + |
| +/** |
| + * @brief Sends a 32 bit partition message in parameter registers as a |
| + * response and blocks until the response is available. |
| + * @note The ffa_interrupt_handler function can be called during the |
| + * execution of this function |
| + * |
| + * @param[in] source Source endpoint ID |
| + * @param[in] dest Destination endpoint ID |
| + * @param[in] a0,a1,a2,a3,a4 Implementation defined message values |
| + * @param[out] msg The response message |
| + * |
| + * @return The FF-A error status code |
| + */ |
| +ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + struct ffa_direct_msg *msg); |
| + |
| +/** |
| + * @brief Sends a 64 bit partition message in parameter registers as a |
| + * response and blocks until the response is available. |
| + * @note The ffa_interrupt_handler function can be called during the |
| + * execution of this function |
| + * |
| + * @param[in] source Source endpoint ID |
| + * @param[in] dest Destination endpoint ID |
| + * @param[in] a0,a1,a2,a3,a4 Implementation defined message values |
| + * @param[out] msg The response message |
| + * |
| + * @return The FF-A error status code |
| + */ |
| +ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg); |
| |
| /** |
| * Memory management interfaces |
| diff --git a/components/messaging/ffa/libsp/include/ffa_api_defines.h b/components/messaging/ffa/libsp/include/ffa_api_defines.h |
| index 95bcb0c..163a0cd 100644 |
| --- a/components/messaging/ffa/libsp/include/ffa_api_defines.h |
| +++ b/components/messaging/ffa/libsp/include/ffa_api_defines.h |
| @@ -58,6 +58,11 @@ |
| #define FFA_MEM_PERM_GET UINT32_C(0x84000088) |
| #define FFA_MEM_PERM_SET UINT32_C(0x84000089) |
| |
| +/* Utility macros */ |
| +#define FFA_TO_32_BIT_FUNC(x) ((x) & (~UINT32_C(0x40000000))) |
| +#define FFA_IS_32_BIT_FUNC(x) (((x) & UINT32_C(0x40000000)) == 0) |
| +#define FFA_IS_64_BIT_FUNC(x) (((x) & UINT32_C(0x40000000)) != 0) |
| + |
| /* Special value for MBZ parameters */ |
| #define FFA_PARAM_MBZ UINT32_C(0x0) |
| |
| diff --git a/components/messaging/ffa/libsp/include/ffa_api_types.h b/components/messaging/ffa/libsp/include/ffa_api_types.h |
| index 3686e2e..b1be7ac 100644 |
| --- a/components/messaging/ffa/libsp/include/ffa_api_types.h |
| +++ b/components/messaging/ffa/libsp/include/ffa_api_types.h |
| @@ -1,6 +1,6 @@ |
| /* SPDX-License-Identifier: BSD-3-Clause */ |
| /* |
| - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| + * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
| */ |
| |
| #ifndef LIBSP_INCLUDE_FFA_API_TYPES_H_ |
| @@ -80,7 +80,10 @@ struct ffa_direct_msg { |
| uint32_t function_id; |
| uint16_t source_id; |
| uint16_t destination_id; |
| - uint32_t args[5]; |
| + union { |
| + uint32_t args32[5]; |
| + uint64_t args64[5]; |
| + } args; |
| }; |
| |
| /** |
| diff --git a/components/messaging/ffa/libsp/include/sp_messaging.h b/components/messaging/ffa/libsp/include/sp_messaging.h |
| index 4bb45f7..7173a92 100644 |
| --- a/components/messaging/ffa/libsp/include/sp_messaging.h |
| +++ b/components/messaging/ffa/libsp/include/sp_messaging.h |
| @@ -1,6 +1,6 @@ |
| /* SPDX-License-Identifier: BSD-3-Clause */ |
| /* |
| - * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| + * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| */ |
| |
| #ifndef LIBSP_INCLUDE_SP_MESSAGING_H_ |
| @@ -9,6 +9,7 @@ |
| #include "sp_api_defines.h" |
| #include "sp_api_types.h" |
| |
| +#include <stdbool.h> |
| #include <stdint.h> |
| |
| #ifdef __cplusplus |
| @@ -23,7 +24,11 @@ extern "C" { |
| struct sp_msg { |
| uint16_t source_id; |
| uint16_t destination_id; |
| - uint32_t args[SP_MSG_ARG_COUNT]; |
| + bool is_64bit_message; |
| + union { |
| + uint32_t args32[SP_MSG_ARG_COUNT]; |
| + uint64_t args64[SP_MSG_ARG_COUNT]; |
| + } args; |
| }; |
| |
| /** |
| diff --git a/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp |
| index ceebcbf..a01848c 100644 |
| --- a/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp |
| +++ b/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp |
| @@ -140,13 +140,13 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg) |
| .returnIntValue(); |
| } |
| |
| -void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, |
| - const struct ffa_direct_msg *msg, |
| - ffa_result result) |
| +void expect_ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result) |
| { |
| - mock().expectOneCall("ffa_msg_send_direct_req") |
| + mock().expectOneCall("ffa_msg_send_direct_req_32") |
| .withUnsignedIntParameter("source", source) |
| .withUnsignedIntParameter("dest", dest) |
| .withUnsignedIntParameter("a0", a0) |
| @@ -158,12 +158,13 @@ void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| .andReturnValue(result); |
| } |
| |
| -ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, struct ffa_direct_msg *msg) |
| +ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3,uint32_t a4, |
| + struct ffa_direct_msg *msg) |
| { |
| return mock() |
| - .actualCall("ffa_msg_send_direct_req") |
| + .actualCall("ffa_msg_send_direct_req_32") |
| .withUnsignedIntParameter("source", source) |
| .withUnsignedIntParameter("dest", dest) |
| .withUnsignedIntParameter("a0", a0) |
| @@ -175,13 +176,49 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| .returnIntValue(); |
| } |
| |
| -void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, |
| +void expect_ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result) |
| +{ |
| + mock().expectOneCall("ffa_msg_send_direct_req_64") |
| + .withUnsignedIntParameter("source", source) |
| + .withUnsignedIntParameter("dest", dest) |
| + .withUnsignedLongIntParameter("a0", a0) |
| + .withUnsignedLongIntParameter("a1", a1) |
| + .withUnsignedLongIntParameter("a2", a2) |
| + .withUnsignedLongIntParameter("a3", a3) |
| + .withUnsignedLongIntParameter("a4", a4) |
| + .withOutputParameterReturning("msg", msg, sizeof(*msg)) |
| + .andReturnValue(result); |
| +} |
| + |
| +ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + struct ffa_direct_msg *msg) |
| +{ |
| + return mock() |
| + .actualCall("ffa_msg_send_direct_req_64") |
| + .withUnsignedIntParameter("source", source) |
| + .withUnsignedIntParameter("dest", dest) |
| + .withUnsignedLongIntParameter("a0", a0) |
| + .withUnsignedLongIntParameter("a1", a1) |
| + .withUnsignedLongIntParameter("a2", a2) |
| + .withUnsignedLongIntParameter("a3", a3) |
| + .withUnsignedLongIntParameter("a4", a4) |
| + .withOutputParameter("msg", msg) |
| + .returnIntValue(); |
| +} |
| + |
| +void expect_ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, |
| uint32_t a0, uint32_t a1, uint32_t a2, |
| uint32_t a3, uint32_t a4, |
| const struct ffa_direct_msg *msg, |
| ffa_result result) |
| { |
| - mock().expectOneCall("ffa_msg_send_direct_resp") |
| + mock().expectOneCall("ffa_msg_send_direct_resp_32") |
| .withUnsignedIntParameter("source", source) |
| .withUnsignedIntParameter("dest", dest) |
| .withUnsignedIntParameter("a0", a0) |
| @@ -193,12 +230,12 @@ void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, |
| .andReturnValue(result); |
| } |
| |
| -ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| +ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, uint32_t a0, |
| uint32_t a1, uint32_t a2, uint32_t a3, |
| uint32_t a4, struct ffa_direct_msg *msg) |
| { |
| return mock() |
| - .actualCall("ffa_msg_send_direct_resp") |
| + .actualCall("ffa_msg_send_direct_resp_32") |
| .withUnsignedIntParameter("source", source) |
| .withUnsignedIntParameter("dest", dest) |
| .withUnsignedIntParameter("a0", a0) |
| @@ -210,6 +247,41 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0, |
| .returnIntValue(); |
| } |
| |
| +void expect_ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result) |
| +{ |
| + mock().expectOneCall("ffa_msg_send_direct_resp_64") |
| + .withUnsignedIntParameter("source", source) |
| + .withUnsignedIntParameter("dest", dest) |
| + .withUnsignedLongIntParameter("a0", a0) |
| + .withUnsignedLongIntParameter("a1", a1) |
| + .withUnsignedLongIntParameter("a2", a2) |
| + .withUnsignedLongIntParameter("a3", a3) |
| + .withUnsignedLongIntParameter("a4", a4) |
| + .withOutputParameterReturning("msg", msg, sizeof(*msg)) |
| + .andReturnValue(result); |
| +} |
| + |
| +ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, uint64_t a0, |
| + uint64_t a1, uint64_t a2, uint64_t a3, |
| + uint64_t a4, struct ffa_direct_msg *msg) |
| +{ |
| + return mock() |
| + .actualCall("ffa_msg_send_direct_resp_64") |
| + .withUnsignedIntParameter("source", source) |
| + .withUnsignedIntParameter("dest", dest) |
| + .withUnsignedLongIntParameter("a0", a0) |
| + .withUnsignedLongIntParameter("a1", a1) |
| + .withUnsignedLongIntParameter("a2", a2) |
| + .withUnsignedLongIntParameter("a3", a3) |
| + .withUnsignedLongIntParameter("a4", a4) |
| + .withOutputParameter("msg", msg) |
| + .returnIntValue(); |
| +} |
| + |
| void expect_ffa_mem_donate(uint32_t total_length, uint32_t fragment_length, |
| void *buffer_address, uint32_t page_count, |
| const uint64_t *handle, ffa_result result) |
| diff --git a/components/messaging/ffa/libsp/mock/mock_ffa_api.h b/components/messaging/ffa/libsp/mock/mock_ffa_api.h |
| index b1c794f..4213ccb 100644 |
| --- a/components/messaging/ffa/libsp/mock/mock_ffa_api.h |
| +++ b/components/messaging/ffa/libsp/mock/mock_ffa_api.h |
| @@ -30,17 +30,29 @@ void expect_ffa_id_get(const uint16_t *id, ffa_result result); |
| |
| void expect_ffa_msg_wait(const struct ffa_direct_msg *msg, ffa_result result); |
| |
| -void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0, |
| - uint32_t a1, uint32_t a2, uint32_t a3, |
| - uint32_t a4, |
| - const struct ffa_direct_msg *msg, |
| - ffa_result result); |
| - |
| -void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, |
| - uint32_t a0, uint32_t a1, uint32_t a2, |
| - uint32_t a3, uint32_t a4, |
| - const struct ffa_direct_msg *msg, |
| - ffa_result result); |
| +void expect_ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result); |
| + |
| +void expect_ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result); |
| + |
| +void expect_ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, |
| + uint32_t a0, uint32_t a1, uint32_t a2, |
| + uint32_t a3, uint32_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result); |
| + |
| +void expect_ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, |
| + uint64_t a0, uint64_t a1, uint64_t a2, |
| + uint64_t a3, uint64_t a4, |
| + const struct ffa_direct_msg *msg, |
| + ffa_result result); |
| |
| void expect_ffa_mem_donate(uint32_t total_length, uint32_t fragment_length, |
| void *buffer_address, uint32_t page_count, |
| diff --git a/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp |
| index ab33649..c1cbdd6 100644 |
| --- a/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp |
| +++ b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp |
| @@ -105,7 +105,7 @@ TEST(mock_ffa_api, ffa_msg_wait) |
| MEMCMP_EQUAL(&expected_msg, &msg, sizeof(expected_msg)); |
| } |
| |
| -TEST(mock_ffa_api, ffa_msg_send_direct_req) |
| +TEST(mock_ffa_api, ffa_msg_send_direct_req_32) |
| { |
| const uint16_t source = 0x1122; |
| const uint16_t dest = 0x2233; |
| @@ -116,13 +116,30 @@ TEST(mock_ffa_api, ffa_msg_send_direct_req) |
| const uint32_t a4 = 0x89124567; |
| struct ffa_direct_msg msg = { 0 }; |
| |
| - expect_ffa_msg_send_direct_req(source, dest, a0, a1, a2, a3, a4, |
| + expect_ffa_msg_send_direct_req_32(source, dest, a0, a1, a2, a3, a4, |
| + &expected_msg, result); |
| + LONGS_EQUAL(result, ffa_msg_send_direct_req_32(source, dest, a0, a1, a2, |
| + a3, a4, &msg)); |
| +} |
| + |
| +TEST(mock_ffa_api, ffa_msg_send_direct_req_64) |
| +{ |
| + const uint16_t source = 0x1122; |
| + const uint16_t dest = 0x2233; |
| + const uint64_t a0 = 0x4567891221987654; |
| + const uint64_t a1 = 0x5678912442198765; |
| + const uint64_t a2 = 0x6789124554219876; |
| + const uint64_t a3 = 0x7891245665421987; |
| + const uint64_t a4 = 0x8912456776542198; |
| + struct ffa_direct_msg msg = { 0 }; |
| + |
| + expect_ffa_msg_send_direct_req_64(source, dest, a0, a1, a2, a3, a4, |
| &expected_msg, result); |
| - LONGS_EQUAL(result, ffa_msg_send_direct_req(source, dest, a0, a1, a2, |
| - a3, a4, &msg)); |
| + LONGS_EQUAL(result, ffa_msg_send_direct_req_64(source, dest, a0, a1, a2, |
| + a3, a4, &msg)); |
| } |
| |
| -TEST(mock_ffa_api, ffa_msg_send_direct_resp) |
| +TEST(mock_ffa_api, ffa_msg_send_direct_resp_32) |
| { |
| const uint16_t source = 0x1122; |
| const uint16_t dest = 0x2233; |
| @@ -133,10 +150,27 @@ TEST(mock_ffa_api, ffa_msg_send_direct_resp) |
| const uint32_t a4 = 0x89124567; |
| struct ffa_direct_msg msg = { 0 }; |
| |
| - expect_ffa_msg_send_direct_resp(source, dest, a0, a1, a2, a3, a4, |
| + expect_ffa_msg_send_direct_resp_32(source, dest, a0, a1, a2, a3, a4, |
| &expected_msg, result); |
| - LONGS_EQUAL(result, ffa_msg_send_direct_resp(source, dest, a0, a1, a2, |
| - a3, a4, &msg)); |
| + LONGS_EQUAL(result, ffa_msg_send_direct_resp_32(source, dest, a0, a1, |
| + a2, a3, a4, &msg)); |
| +} |
| + |
| +TEST(mock_ffa_api, ffa_msg_send_direct_resp_64) |
| +{ |
| + const uint16_t source = 0x1122; |
| + const uint16_t dest = 0x2233; |
| + const uint64_t a0 = 0x4567891221987654; |
| + const uint64_t a1 = 0x5678912442198765; |
| + const uint64_t a2 = 0x6789124554219876; |
| + const uint64_t a3 = 0x7891245665421987; |
| + const uint64_t a4 = 0x8912456776542198; |
| + struct ffa_direct_msg msg = { 0 }; |
| + |
| + expect_ffa_msg_send_direct_resp_64(source, dest, a0, a1, a2, a3, a4, |
| + &expected_msg, result); |
| + LONGS_EQUAL(result, ffa_msg_send_direct_resp_64(source, dest, a0, a1, |
| + a2, a3, a4, &msg)); |
| } |
| |
| TEST(mock_ffa_api, ffa_mem_donate) |
| diff --git a/components/messaging/ffa/libsp/sp_messaging.c b/components/messaging/ffa/libsp/sp_messaging.c |
| index f7223aa..392006b 100644 |
| --- a/components/messaging/ffa/libsp/sp_messaging.c |
| +++ b/components/messaging/ffa/libsp/sp_messaging.c |
| @@ -1,6 +1,6 @@ |
| // SPDX-License-Identifier: BSD-3-Clause |
| /* |
| - * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| + * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| */ |
| |
| #include "ffa_api.h" |
| @@ -20,22 +20,40 @@ static void pack_ffa_direct_msg(const struct sp_msg *msg, |
| ffa_msg->source_id = msg->source_id; |
| ffa_msg->destination_id = msg->destination_id; |
| |
| - ffa_msg->args[0] = 0; |
| - memcpy(&ffa_msg->args[SP_MSG_ARG_OFFSET], msg->args, sizeof(msg->args)); |
| + ffa_msg->args.args64[0] = 0; |
| + if (msg->is_64bit_message) |
| + memcpy(&ffa_msg->args.args64[SP_MSG_ARG_OFFSET], |
| + msg->args.args64, sizeof(msg->args.args64)); |
| + else |
| + memcpy(&ffa_msg->args.args32[SP_MSG_ARG_OFFSET], |
| + msg->args.args32, sizeof(msg->args.args32)); |
| } |
| |
| static void unpack_ffa_direct_msg(const struct ffa_direct_msg *ffa_msg, |
| struct sp_msg *msg) |
| { |
| - if (ffa_msg->function_id != FFA_SUCCESS_32) { |
| + if (ffa_msg->function_id == FFA_MSG_SEND_DIRECT_REQ_32 || |
| + ffa_msg->function_id == FFA_MSG_SEND_DIRECT_RESP_32) { |
| /* |
| - * Handling request or response (error is handled before call) |
| + * Handling 32 bit request or response |
| */ |
| msg->source_id = ffa_msg->source_id; |
| msg->destination_id = ffa_msg->destination_id; |
| + msg->is_64bit_message = FFA_IS_64_BIT_FUNC(ffa_msg->function_id); |
| |
| - memcpy(msg->args, &ffa_msg->args[SP_MSG_ARG_OFFSET], |
| - sizeof(msg->args)); |
| + memcpy(msg->args.args32, &ffa_msg->args.args32[SP_MSG_ARG_OFFSET], |
| + sizeof(msg->args.args32)); |
| + } else if (ffa_msg->function_id == FFA_MSG_SEND_DIRECT_REQ_64 || |
| + ffa_msg->function_id == FFA_MSG_SEND_DIRECT_RESP_64) { |
| + /* |
| + * Handling 64 bit request or response |
| + */ |
| + msg->source_id = ffa_msg->source_id; |
| + msg->destination_id = ffa_msg->destination_id; |
| + msg->is_64bit_message = FFA_IS_64_BIT_FUNC(ffa_msg->function_id); |
| + |
| + memcpy(msg->args.args64, &ffa_msg->args.args64[SP_MSG_ARG_OFFSET], |
| + sizeof(msg->args.args64)); |
| } else { |
| /* Success has no message parameters */ |
| *msg = (struct sp_msg){ 0 }; |
| @@ -89,11 +107,18 @@ sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp) |
| ffa_direct_msg_routing_ext_req_pre_hook(&ffa_req); |
| #endif |
| |
| - ffa_res = ffa_msg_send_direct_req(ffa_req.source_id, |
| - ffa_req.destination_id, |
| - ffa_req.args[0], ffa_req.args[1], |
| - ffa_req.args[2], ffa_req.args[3], |
| - ffa_req.args[4], &ffa_resp); |
| + if (req->is_64bit_message) |
| + ffa_res = ffa_msg_send_direct_req_64( |
| + ffa_req.source_id, ffa_req.destination_id, |
| + ffa_req.args.args64[0], ffa_req.args.args64[1], |
| + ffa_req.args.args64[2], ffa_req.args.args64[3], |
| + ffa_req.args.args64[4], &ffa_resp); |
| + else |
| + ffa_res = ffa_msg_send_direct_req_32( |
| + ffa_req.source_id, ffa_req.destination_id, |
| + ffa_req.args.args32[0], ffa_req.args.args32[1], |
| + ffa_req.args.args32[2], ffa_req.args.args32[3], |
| + ffa_req.args.args32[4], &ffa_resp); |
| |
| if (ffa_res != FFA_OK) { |
| #if FFA_DIRECT_MSG_ROUTING_EXTENSION |
| @@ -136,11 +161,18 @@ sp_result sp_msg_send_direct_resp(const struct sp_msg *resp, struct sp_msg *req) |
| ffa_direct_msg_routing_ext_resp_pre_hook(&ffa_resp); |
| #endif |
| |
| - ffa_res = ffa_msg_send_direct_resp(ffa_resp.source_id, |
| - ffa_resp.destination_id, |
| - ffa_resp.args[0], ffa_resp.args[1], |
| - ffa_resp.args[2], ffa_resp.args[3], |
| - ffa_resp.args[4], &ffa_req); |
| + if (resp->is_64bit_message) |
| + ffa_res = ffa_msg_send_direct_resp_64( |
| + ffa_resp.source_id, ffa_resp.destination_id, |
| + ffa_resp.args.args64[0], ffa_resp.args.args64[1], |
| + ffa_resp.args.args64[2], ffa_resp.args.args64[3], |
| + ffa_resp.args.args64[4], &ffa_req); |
| + else |
| + ffa_res = ffa_msg_send_direct_resp_32( |
| + ffa_resp.source_id, ffa_resp.destination_id, |
| + ffa_resp.args.args32[0], ffa_resp.args.args32[1], |
| + ffa_resp.args.args32[2], ffa_resp.args.args32[3], |
| + ffa_resp.args.args32[4], &ffa_req); |
| |
| if (ffa_res != FFA_OK) { |
| #if FFA_DIRECT_MSG_ROUTING_EXTENSION |
| @@ -182,11 +214,11 @@ sp_result sp_msg_send_rc_req(const struct sp_msg *req, struct sp_msg *resp) |
| |
| ffa_direct_msg_routing_ext_rc_req_pre_hook(&ffa_req); |
| |
| - ffa_res = ffa_msg_send_direct_resp(ffa_req.source_id, |
| + ffa_res = ffa_msg_send_direct_resp_32(ffa_req.source_id, |
| ffa_req.destination_id, |
| - ffa_req.args[0], ffa_req.args[1], |
| - ffa_req.args[2], ffa_req.args[3], |
| - ffa_req.args[4], &ffa_resp); |
| + ffa_req.args.args32[0], ffa_req.args.args32[1], |
| + ffa_req.args.args32[2], ffa_req.args.args32[3], |
| + ffa_req.args.args32[4], &ffa_resp); |
| |
| if (ffa_res != FFA_OK) { |
| ffa_direct_msg_routing_ext_rc_req_error_hook(); |
| diff --git a/components/messaging/ffa/libsp/test/test_ffa_api.cpp b/components/messaging/ffa/libsp/test/test_ffa_api.cpp |
| index 8fa261e..6cca085 100644 |
| --- a/components/messaging/ffa/libsp/test/test_ffa_api.cpp |
| +++ b/components/messaging/ffa/libsp/test/test_ffa_api.cpp |
| @@ -43,20 +43,35 @@ TEST_GROUP(ffa_api) |
| svc_result.a2 = (uint32_t)error_code; |
| } |
| |
| - void msg_equal(uint32_t func_id, uint16_t source_id, uint16_t dest_id, |
| - uint32_t arg0, uint32_t arg1, uint32_t arg2, |
| - uint32_t arg3, uint32_t arg4) |
| + void msg_equal_32(uint32_t func_id, uint16_t source_id, uint16_t dest_id, |
| + uint32_t arg0, uint32_t arg1, uint32_t arg2, |
| + uint32_t arg3, uint32_t arg4) |
| { |
| UNSIGNED_LONGS_EQUAL(func_id, msg.function_id); |
| UNSIGNED_LONGS_EQUAL(source_id, msg.source_id); |
| UNSIGNED_LONGS_EQUAL(dest_id, msg.destination_id); |
| - UNSIGNED_LONGS_EQUAL(arg0, msg.args[0]); |
| - UNSIGNED_LONGS_EQUAL(arg1, msg.args[1]); |
| - UNSIGNED_LONGS_EQUAL(arg2, msg.args[2]); |
| - UNSIGNED_LONGS_EQUAL(arg3, msg.args[3]); |
| - UNSIGNED_LONGS_EQUAL(arg4, msg.args[4]); |
| + UNSIGNED_LONGS_EQUAL(arg0, msg.args.args32[0]); |
| + UNSIGNED_LONGS_EQUAL(arg1, msg.args.args32[1]); |
| + UNSIGNED_LONGS_EQUAL(arg2, msg.args.args32[2]); |
| + UNSIGNED_LONGS_EQUAL(arg3, msg.args.args32[3]); |
| + UNSIGNED_LONGS_EQUAL(arg4, msg.args.args32[4]); |
| } |
| |
| + void msg_equal_64(uint32_t func_id, uint16_t source_id, uint16_t dest_id, |
| + uint64_t arg0, uint64_t arg1, uint64_t arg2, |
| + uint64_t arg3, uint64_t arg4) |
| + { |
| + UNSIGNED_LONGS_EQUAL(func_id, msg.function_id); |
| + UNSIGNED_LONGS_EQUAL(source_id, msg.source_id); |
| + UNSIGNED_LONGS_EQUAL(dest_id, msg.destination_id); |
| + UNSIGNED_LONGLONGS_EQUAL(arg0, msg.args.args64[0]); |
| + UNSIGNED_LONGLONGS_EQUAL(arg1, msg.args.args64[1]); |
| + UNSIGNED_LONGLONGS_EQUAL(arg2, msg.args.args64[2]); |
| + UNSIGNED_LONGLONGS_EQUAL(arg3, msg.args.args64[3]); |
| + UNSIGNED_LONGLONGS_EQUAL(arg4, msg.args.args64[4]); |
| + } |
| + |
| + |
| struct ffa_params svc_result; |
| struct ffa_direct_msg msg; |
| }; |
| @@ -360,7 +375,7 @@ TEST(ffa_api, ffa_msg_wait_success) |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| ffa_result result = ffa_msg_wait(&msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| TEST(ffa_api, ffa_msg_wait_error) |
| @@ -369,10 +384,10 @@ TEST(ffa_api, ffa_msg_wait_error) |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| ffa_result result = ffa_msg_wait(&msg); |
| LONGS_EQUAL(-1, result); |
| - msg_equal(0, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_wait_direct_req) |
| +TEST(ffa_api, ffa_msg_wait_direct_req_32) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -392,7 +407,31 @@ TEST(ffa_api, ffa_msg_wait_direct_req) |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| ffa_result result = ffa_msg_wait(&msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x8400006F, source_id, dest_id, arg0, arg1, arg2, arg3, |
| + msg_equal_32(0x8400006F, source_id, dest_id, arg0, arg1, arg2, arg3, |
| + arg4); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_wait_direct_req_64) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint64_t arg0 = 0x0123456776543210ULL; |
| + const uint64_t arg1 = 0x1234567887654321ULL; |
| + const uint64_t arg2 = 0x2345678998765432ULL; |
| + const uint64_t arg3 = 0x3456789aa9876543ULL; |
| + const uint64_t arg4 = 0x456789abba987654ULL; |
| + |
| + svc_result.a0 = 0xC400006F; |
| + svc_result.a1 = ((uint32_t)source_id) << 16 | dest_id; |
| + svc_result.a3 = arg0; |
| + svc_result.a4 = arg1; |
| + svc_result.a5 = arg2; |
| + svc_result.a6 = arg3; |
| + svc_result.a7 = arg4; |
| + expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| + ffa_result result = ffa_msg_wait(&msg); |
| + LONGS_EQUAL(0, result); |
| + msg_equal_64(0xC400006F, source_id, dest_id, arg0, arg1, arg2, arg3, |
| arg4); |
| } |
| |
| @@ -410,7 +449,7 @@ TEST(ffa_api, ffa_msg_wait_one_interrupt_success) |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| ffa_result result = ffa_msg_wait(&msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| TEST(ffa_api, ffa_msg_wait_two_interrupt_success) |
| @@ -434,7 +473,7 @@ TEST(ffa_api, ffa_msg_wait_two_interrupt_success) |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| ffa_result result = ffa_msg_wait(&msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| TEST(ffa_api, ffa_msg_wait_unknown_response) |
| @@ -448,7 +487,7 @@ TEST(ffa_api, ffa_msg_wait_unknown_response) |
| } |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_success) |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -461,13 +500,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_success) |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_req( |
| + ffa_result result = ffa_msg_send_direct_req_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_error) |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_error) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -480,13 +519,48 @@ TEST(ffa_api, ffa_msg_send_direct_req_error) |
| setup_error_response(-1); |
| expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_req( |
| + ffa_result result = ffa_msg_send_direct_req_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(-1, result); |
| - msg_equal(0, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_get_resp_64) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint32_t arg0 = 0x01234567ULL; |
| + const uint32_t arg1 = 0x12345678ULL; |
| + const uint32_t arg2 = 0x23456789ULL; |
| + const uint32_t arg3 = 0x3456789aULL; |
| + const uint32_t arg4 = 0x456789abULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint64_t resp_arg0 = 0x9012345665432109ULL; |
| + const uint64_t resp_arg1 = 0xa12345677654321aULL; |
| + const uint64_t resp_arg2 = 0xb23456788765432bULL; |
| + const uint64_t resp_arg3 = 0xc34567899876543cULL; |
| + const uint64_t resp_arg4 = 0xd456789aa987654dULL; |
| + assert_environment_t assert_env; |
| + |
| + svc_result.a0 = 0xC4000070; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + |
| + expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + |
| + if (SETUP_ASSERT_ENVIRONMENT(assert_env)) { |
| + ffa_msg_send_direct_req_32(source_id, dest_id, arg0, arg1, arg2, |
| + arg3, arg4, &msg); |
| + } |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_direct_resp) |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_direct_resp) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -512,14 +586,82 @@ TEST(ffa_api, ffa_msg_send_direct_req_direct_resp) |
| svc_result.a7 = resp_arg4; |
| expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_req( |
| + ffa_result result = ffa_msg_send_direct_req_32( |
| + source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| + LONGS_EQUAL(0, result); |
| + msg_equal_32(0x84000070, resp_source_id, resp_dest_id, resp_arg0, |
| + resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_req_64_success) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint64_t arg0 = 0x0123456776543210ULL; |
| + const uint64_t arg1 = 0x1234567887654321ULL; |
| + const uint64_t arg2 = 0x2345678998765432ULL; |
| + const uint64_t arg3 = 0x3456789aa9876543ULL; |
| + const uint64_t arg4 = 0x456789abba987654ULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint64_t resp_arg0 = 0x9012345665432109ULL; |
| + const uint64_t resp_arg1 = 0xa12345677654321aULL; |
| + const uint64_t resp_arg2 = 0xb23456788765432bULL; |
| + const uint64_t resp_arg3 = 0xc34567899876543cULL; |
| + const uint64_t resp_arg4 = 0xd456789aa987654dULL; |
| + |
| + svc_result.a0 = 0xC4000070; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + expect_ffa_svc(0xC400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + ffa_result result = ffa_msg_send_direct_req_64( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000070, resp_source_id, resp_dest_id, resp_arg0, |
| + msg_equal_64(0xC4000070, resp_source_id, resp_dest_id, resp_arg0, |
| resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_one_interrupt_success) |
| +TEST(ffa_api, ffa_msg_send_direct_req_64_get_resp_32) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint64_t arg0 = 0x9012345665432109ULL; |
| + const uint64_t arg1 = 0xa12345677654321aULL; |
| + const uint64_t arg2 = 0xb23456788765432bULL; |
| + const uint64_t arg3 = 0xc34567899876543cULL; |
| + const uint64_t arg4 = 0xd456789aa987654dULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint32_t resp_arg0 = 0x01234567ULL; |
| + const uint32_t resp_arg1 = 0x12345678ULL; |
| + const uint32_t resp_arg2 = 0x23456789ULL; |
| + const uint32_t resp_arg3 = 0x3456789aULL; |
| + const uint32_t resp_arg4 = 0x456789abULL; |
| + assert_environment_t assert_env; |
| + |
| + svc_result.a0 = 0x84000070; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + |
| + expect_ffa_svc(0xC400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + |
| + if (SETUP_ASSERT_ENVIRONMENT(assert_env)) { |
| + ffa_msg_send_direct_req_64(source_id, dest_id, arg0, arg1, arg2, |
| + arg3, arg4, &msg); |
| + } |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_one_interrupt_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -539,13 +681,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_one_interrupt_success) |
| |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_req( |
| + ffa_result result = ffa_msg_send_direct_req_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_two_interrupt_success) |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_two_interrupt_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -573,13 +715,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_two_interrupt_success) |
| |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_req( |
| + ffa_result result = ffa_msg_send_direct_req_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_req_unknown_response) |
| +TEST(ffa_api, ffa_msg_send_direct_req_32_unknown_response) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -594,12 +736,12 @@ TEST(ffa_api, ffa_msg_send_direct_req_unknown_response) |
| expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| if (SETUP_ASSERT_ENVIRONMENT(assert_env)) { |
| - ffa_msg_send_direct_req(source_id, dest_id, arg0, arg1, arg2, |
| + ffa_msg_send_direct_req_32(source_id, dest_id, arg0, arg1, arg2, |
| arg3, arg4, &msg); |
| } |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_success) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -612,13 +754,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_success) |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_resp( |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_error) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_error) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -631,13 +773,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_error) |
| setup_error_response(-1); |
| expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_resp( |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(-1, result); |
| - msg_equal(0, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_then_get_direct_req_as_response) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_then_get_direct_req_32_as_response) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -663,14 +805,113 @@ TEST(ffa_api, ffa_msg_send_direct_resp_then_get_direct_req_as_response) |
| svc_result.a7 = resp_arg4; |
| expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_resp( |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| + source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| + LONGS_EQUAL(0, result); |
| + msg_equal_32(0x8400006F, resp_source_id, resp_dest_id, resp_arg0, |
| + resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_then_get_direct_req_64_as_response) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint32_t arg0 = 0x01234567ULL; |
| + const uint32_t arg1 = 0x12345678ULL; |
| + const uint32_t arg2 = 0x23456789ULL; |
| + const uint32_t arg3 = 0x3456789aULL; |
| + const uint32_t arg4 = 0x456789abULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint64_t resp_arg0 = 0x9012345665432109ULL; |
| + const uint64_t resp_arg1 = 0xa12345677654321aULL; |
| + const uint64_t resp_arg2 = 0xb23456788765432bULL; |
| + const uint64_t resp_arg3 = 0xc34567899876543cULL; |
| + const uint64_t resp_arg4 = 0xd456789aa987654dULL; |
| + |
| + svc_result.a0 = 0xC400006F; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| + source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| + LONGS_EQUAL(0, result); |
| + msg_equal_64(0xC400006F, resp_source_id, resp_dest_id, resp_arg0, |
| + resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_resp_64_then_get_direct_req_32_as_response) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint64_t arg0 = 0x9012345665432109ULL; |
| + const uint64_t arg1 = 0xa12345677654321aULL; |
| + const uint64_t arg2 = 0xb23456788765432bULL; |
| + const uint64_t arg3 = 0xc34567899876543cULL; |
| + const uint64_t arg4 = 0xd456789aa987654dULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint32_t resp_arg0 = 0x01234567ULL; |
| + const uint32_t resp_arg1 = 0x12345678ULL; |
| + const uint32_t resp_arg2 = 0x23456789ULL; |
| + const uint32_t resp_arg3 = 0x3456789aULL; |
| + const uint32_t resp_arg4 = 0x456789abULL; |
| + |
| + svc_result.a0 = 0x8400006F; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + expect_ffa_svc(0xC4000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + ffa_result result = ffa_msg_send_direct_resp_64( |
| + source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| + LONGS_EQUAL(0, result); |
| + msg_equal_32(0x8400006F, resp_source_id, resp_dest_id, resp_arg0, |
| + resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| +} |
| + |
| +TEST(ffa_api, ffa_msg_send_direct_resp_64_then_get_direct_req_64_as_response) |
| +{ |
| + const uint16_t source_id = 0x1122; |
| + const uint16_t dest_id = 0x3344; |
| + const uint64_t arg0 = 0x0123456776543210ULL; |
| + const uint64_t arg1 = 0x1234567887654321ULL; |
| + const uint64_t arg2 = 0x2345678998765432ULL; |
| + const uint64_t arg3 = 0x3456789aa9876543ULL; |
| + const uint64_t arg4 = 0x456789abba987654ULL; |
| + const uint16_t resp_source_id = 0x1221; |
| + const uint16_t resp_dest_id = 0x3443; |
| + const uint64_t resp_arg0 = 0x9012345665432109ULL; |
| + const uint64_t resp_arg1 = 0xa12345677654321aULL; |
| + const uint64_t resp_arg2 = 0xb23456788765432bULL; |
| + const uint64_t resp_arg3 = 0xc34567899876543cULL; |
| + const uint64_t resp_arg4 = 0xd456789aa987654dULL; |
| + |
| + svc_result.a0 = 0xC400006F; |
| + svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id; |
| + svc_result.a3 = resp_arg0; |
| + svc_result.a4 = resp_arg1; |
| + svc_result.a5 = resp_arg2; |
| + svc_result.a6 = resp_arg3; |
| + svc_result.a7 = resp_arg4; |
| + expect_ffa_svc(0xC4000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| + arg0, arg1, arg2, arg3, arg4, &svc_result); |
| + ffa_result result = ffa_msg_send_direct_resp_64( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x8400006F, resp_source_id, resp_dest_id, resp_arg0, |
| + msg_equal_64(0xC400006F, resp_source_id, resp_dest_id, resp_arg0, |
| resp_arg1, resp_arg2, resp_arg3, resp_arg4); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_one_interrupt_success) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_one_interrupt_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -690,13 +931,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_one_interrupt_success) |
| |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_resp( |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_two_interrupt_success) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_two_interrupt_success) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -724,13 +965,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_two_interrupt_success) |
| |
| svc_result.a0 = 0x84000061; |
| expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result); |
| - ffa_result result = ffa_msg_send_direct_resp( |
| + ffa_result result = ffa_msg_send_direct_resp_32( |
| source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg); |
| LONGS_EQUAL(0, result); |
| - msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| + msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0); |
| } |
| |
| -TEST(ffa_api, ffa_msg_send_direct_resp_unknown_response) |
| +TEST(ffa_api, ffa_msg_send_direct_resp_32_unknown_response) |
| { |
| const uint16_t source_id = 0x1122; |
| const uint16_t dest_id = 0x3344; |
| @@ -745,7 +986,7 @@ TEST(ffa_api, ffa_msg_send_direct_resp_unknown_response) |
| expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0, |
| arg0, arg1, arg2, arg3, arg4, &svc_result); |
| if (SETUP_ASSERT_ENVIRONMENT(assert_env)) { |
| - ffa_msg_send_direct_resp(source_id, dest_id, arg0, arg1, arg2, |
| + ffa_msg_send_direct_resp_32(source_id, dest_id, arg0, arg1, arg2, |
| arg3, arg4, &msg); |
| } |
| } |
| diff --git a/components/messaging/ffa/libsp/test/test_sp_messaging.cpp b/components/messaging/ffa/libsp/test/test_sp_messaging.cpp |
| index 78bf8bf..786f66e 100644 |
| --- a/components/messaging/ffa/libsp/test/test_sp_messaging.cpp |
| +++ b/components/messaging/ffa/libsp/test/test_sp_messaging.cpp |
| @@ -1,6 +1,6 @@ |
| // SPDX-License-Identifier: BSD-3-Clause |
| /* |
| - * Copyright (c) 2021, Arm Limited. All rights reserved. |
| + * Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
| */ |
| |
| #include <CppUTest/TestHarness.h> |
| @@ -32,7 +32,7 @@ TEST_GROUP(sp_messaging) |
| mock().clear(); |
| } |
| |
| - void copy_sp_to_ffa_args(const uint32_t sp_args[], uint32_t ffa_args[]) |
| + void copy_sp_to_ffa_args_32(const uint32_t sp_args[], uint32_t ffa_args[]) |
| { |
| int i = 0; |
| |
| @@ -41,7 +41,16 @@ TEST_GROUP(sp_messaging) |
| } |
| } |
| |
| - void fill_ffa_msg(struct ffa_direct_msg * msg) |
| + void copy_sp_to_ffa_args_64(const uint64_t sp_args[], uint64_t ffa_args[]) |
| + { |
| + int i = 0; |
| + |
| + for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| + ffa_args[i + SP_MSG_ARG_OFFSET] = sp_args[i]; |
| + } |
| + } |
| + |
| + void fill_ffa_msg_32(struct ffa_direct_msg * msg) |
| { |
| int i = 0; |
| |
| @@ -49,20 +58,47 @@ TEST_GROUP(sp_messaging) |
| msg->source_id = source_id; |
| msg->destination_id = dest_id; |
| |
| - msg->args[0] = 0; |
| + msg->args.args32[0] = 0; |
| for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| - msg->args[i + SP_MSG_ARG_OFFSET] = args[i]; |
| + msg->args.args32[i + SP_MSG_ARG_OFFSET] = args32[i]; |
| } |
| } |
| |
| - void fill_sp_msg(struct sp_msg * msg) |
| + void fill_ffa_msg_64(struct ffa_direct_msg * msg) |
| { |
| int i = 0; |
| |
| + msg->function_id = FFA_MSG_SEND_DIRECT_REQ_64; |
| msg->source_id = source_id; |
| msg->destination_id = dest_id; |
| + |
| + msg->args.args64[0] = 0; |
| for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| - msg->args[i] = args[i + SP_MSG_ARG_OFFSET]; |
| + msg->args.args64[i + SP_MSG_ARG_OFFSET] = args64[i]; |
| + } |
| + } |
| + |
| + void fill_sp_msg_32(struct sp_msg * msg) |
| + { |
| + int i = 0; |
| + |
| + msg->source_id = source_id; |
| + msg->destination_id = dest_id; |
| + msg->is_64bit_message = false; |
| + for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| + msg->args.args32[i] = args32[i + SP_MSG_ARG_OFFSET]; |
| + } |
| + } |
| + |
| + void fill_sp_msg_64(struct sp_msg * msg) |
| + { |
| + int i = 0; |
| + |
| + msg->source_id = source_id; |
| + msg->destination_id = dest_id; |
| + msg->is_64bit_message = true; |
| + for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| + msg->args.args64[i] = args64[i + SP_MSG_ARG_OFFSET]; |
| } |
| } |
| |
| @@ -74,10 +110,19 @@ TEST_GROUP(sp_messaging) |
| UNSIGNED_LONGS_EQUAL(ffa_msg->source_id, sp_msg->source_id); |
| UNSIGNED_LONGS_EQUAL(ffa_msg->destination_id, |
| sp_msg->destination_id); |
| - for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| - UNSIGNED_LONGS_EQUAL( |
| - ffa_msg->args[i + SP_MSG_ARG_OFFSET], |
| - sp_msg->args[i]); |
| + CHECK_EQUAL(FFA_IS_64_BIT_FUNC(ffa_msg->function_id), sp_msg->is_64bit_message); |
| + if (sp_msg->is_64bit_message) { |
| + for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| + UNSIGNED_LONGS_EQUAL( |
| + ffa_msg->args.args64[i + SP_MSG_ARG_OFFSET], |
| + sp_msg->args.args64[i]); |
| + } |
| + } else { |
| + for (i = 0; i < SP_MSG_ARG_COUNT; i++) { |
| + UNSIGNED_LONGS_EQUAL( |
| + ffa_msg->args.args32[i + SP_MSG_ARG_OFFSET], |
| + sp_msg->args.args32[i]); |
| + } |
| } |
| } |
| |
| @@ -87,7 +132,7 @@ TEST_GROUP(sp_messaging) |
| struct ffa_direct_msg expected_ffa_req = { 0 }; |
| struct sp_msg req = { 0 }; |
| |
| - fill_ffa_msg(&expected_ffa_req); |
| + fill_ffa_msg_32(&expected_ffa_req); |
| expected_ffa_req.source_id = source_id; |
| expected_ffa_req.destination_id = dest_id; |
| expect_ffa_msg_wait(&expected_ffa_req, FFA_OK); |
| @@ -103,8 +148,10 @@ TEST_GROUP(sp_messaging) |
| |
| const uint16_t source_id = 0x1234; |
| const uint16_t dest_id = 0x5678; |
| - const uint32_t args[SP_MSG_ARG_COUNT] = { 0x01234567, 0x12345678, |
| - 0x23456789, 0x3456789a }; |
| + const uint32_t args32[SP_MSG_ARG_COUNT] = { 0x01234567, 0x12345678, |
| + 0x23456789, 0x3456789a }; |
| + const uint64_t args64[SP_MSG_ARG_COUNT] = { 0x0123456776543210, 0x1234567887654321, |
| + 0x2345678998765432, 0x3456789aa9876543 }; |
| const sp_result result = -1; |
| const sp_msg empty_sp_msg = (const sp_msg){ 0 }; |
| }; |
| @@ -126,7 +173,7 @@ TEST(sp_messaging, sp_msg_wait_ffa_error) |
| |
| TEST(sp_messaging, sp_msg_wait) |
| { |
| - fill_ffa_msg(&ffa_msg); |
| + fill_ffa_msg_32(&ffa_msg); |
| expect_ffa_msg_wait(&ffa_msg, FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_wait(&req)); |
| @@ -139,12 +186,12 @@ TEST(sp_messaging, sp_msg_wait_deny_rc_failure) |
| struct ffa_direct_msg rc_msg = { 0 }; |
| ffa_result result = FFA_ABORTED; |
| |
| - fill_ffa_msg(&rc_msg); |
| - rc_msg.args[0] = ROUTING_EXT_RC_BIT; |
| + fill_ffa_msg_32(&rc_msg); |
| + rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT; |
| expect_ffa_msg_wait(&rc_msg, FFA_OK); |
| |
| - fill_ffa_msg(&ffa_msg); |
| - expect_ffa_msg_send_direct_resp( |
| + fill_ffa_msg_32(&ffa_msg); |
| + expect_ffa_msg_send_direct_resp_32( |
| rc_msg.destination_id, rc_msg.source_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, result); |
| @@ -157,12 +204,12 @@ TEST(sp_messaging, sp_msg_wait_deny_rc) |
| { |
| struct ffa_direct_msg rc_msg = { 0 }; |
| |
| - fill_ffa_msg(&rc_msg); |
| - rc_msg.args[0] = ROUTING_EXT_RC_BIT; |
| + fill_ffa_msg_32(&rc_msg); |
| + rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT; |
| expect_ffa_msg_wait(&rc_msg, FFA_OK); |
| |
| - fill_ffa_msg(&ffa_msg); |
| - expect_ffa_msg_send_direct_resp( |
| + fill_ffa_msg_32(&ffa_msg); |
| + expect_ffa_msg_send_direct_resp_32( |
| rc_msg.destination_id, rc_msg.source_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, FFA_OK); |
| @@ -191,10 +238,10 @@ TEST(sp_messaging, sp_msg_send_direct_req_ffa_error) |
| ffa_result result = FFA_ABORTED; |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&req); |
| + fill_sp_msg_32(&req); |
| memset(&resp, 0x5a, sizeof(resp)); |
| - copy_sp_to_ffa_args(req.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_req( |
| + copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_req_32( |
| req.source_id, req.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, result); |
| @@ -203,14 +250,30 @@ TEST(sp_messaging, sp_msg_send_direct_req_ffa_error) |
| MEMCMP_EQUAL(&empty_sp_msg, &resp, sizeof(empty_sp_msg)); |
| } |
| |
| -TEST(sp_messaging, sp_msg_send_direct_req_msg) |
| +TEST(sp_messaging, sp_msg_send_direct_req_msg_32) |
| { |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&req); |
| - fill_ffa_msg(&ffa_msg); |
| - copy_sp_to_ffa_args(req.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_req( |
| + fill_sp_msg_32(&req); |
| + fill_ffa_msg_32(&ffa_msg); |
| + copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_req_32( |
| + req.source_id, req.destination_id, expected_ffa_args[0], |
| + expected_ffa_args[1], expected_ffa_args[2], |
| + expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| + |
| + LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&req, &resp)); |
| + ffa_and_sp_msg_equal(&ffa_msg, &resp); |
| +} |
| + |
| +TEST(sp_messaging, sp_msg_send_direct_req_msg_64) |
| +{ |
| + uint64_t expected_ffa_args[5] = { 0 }; |
| + |
| + fill_sp_msg_64(&req); |
| + fill_ffa_msg_64(&ffa_msg); |
| + copy_sp_to_ffa_args_64(req.args.args64, expected_ffa_args); |
| + expect_ffa_msg_send_direct_req_64( |
| req.source_id, req.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| @@ -223,10 +286,10 @@ TEST(sp_messaging, sp_msg_send_direct_req_success) |
| { |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&req); |
| + fill_sp_msg_32(&req); |
| ffa_msg.function_id = FFA_SUCCESS_32; |
| - copy_sp_to_ffa_args(req.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_req( |
| + copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_req_32( |
| req.source_id, req.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| @@ -248,54 +311,54 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &rc_resp, FFA_OK); |
| |
| /* Fowarding RC response to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0], |
| - rc_resp.args[1], rc_resp.args[2], |
| - rc_resp.args[3], rc_resp.args[4], &resp, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0], |
| + rc_resp.args.args32[1], rc_resp.args.args32[2], |
| + rc_resp.args.args32[3], rc_resp.args.args32[4], &resp, |
| FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp)); |
| @@ -312,28 +375,28 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_error) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_err); |
| + fill_ffa_msg_32(&rc_err); |
| rc_err.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_err.source_id = rc_root_id; |
| rc_err.destination_id = own_id; |
| - rc_err.args[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT; |
| - rc_err.args[1] = result; |
| + rc_err.args.args32[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT; |
| + rc_err.args.args32[1] = result; |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_err, FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_FFA(result), |
| @@ -354,64 +417,64 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success_deny_request) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| request_to_deny.source_id = root_id; |
| request_to_deny.destination_id = own_id; |
| - request_to_deny.args[0] = 0; |
| + request_to_deny.args.args32[0] = 0; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving a request to deny */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &request_to_deny, FFA_OK); |
| |
| /* Sending error to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| own_id, root_id, ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_OK); |
| |
| /* Fowarding RC response to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0], |
| - rc_resp.args[1], rc_resp.args[2], |
| - rc_resp.args[3], rc_resp.args[4], &resp, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0], |
| + rc_resp.args.args32[1], rc_resp.args.args32[2], |
| + rc_resp.args.args32[3], rc_resp.args.args32[4], &resp, |
| FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp)); |
| @@ -431,65 +494,65 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success_invalid_req_src) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| /* This source ID should be denied in the current state. */ |
| request_to_deny.source_id = rc_root_id; |
| request_to_deny.destination_id = own_id; |
| - request_to_deny.args[0] = ROUTING_EXT_RC_BIT; |
| + request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &request_to_deny, FFA_OK); |
| |
| /* Sending error to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| own_id, rc_root_id, ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT, |
| SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_OK); |
| |
| /* Fowarding RC response to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0], |
| - rc_resp.args[1], rc_resp.args[2], |
| - rc_resp.args[3], rc_resp.args[4], &resp, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0], |
| + rc_resp.args.args32[1], rc_resp.args.args32[2], |
| + rc_resp.args.args32[3], rc_resp.args.args32[4], &resp, |
| FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp)); |
| @@ -509,58 +572,58 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_success) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| /* This source ID should be denied in the current state. */ |
| request_to_deny.source_id = rc_root_id; |
| request_to_deny.destination_id = own_id; |
| - request_to_deny.args[0] = ROUTING_EXT_RC_BIT; |
| + request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &request_to_deny, FFA_OK); |
| |
| /* Sending error to root which fails */ |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| own_id, rc_root_id, (ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT), |
| SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_DENIED); |
| |
| @@ -568,9 +631,9 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_success) |
| expect_ffa_msg_wait(&rc_resp, FFA_OK); |
| |
| /* Fowarding RC response to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0], |
| - rc_resp.args[1], rc_resp.args[2], |
| - rc_resp.args[3], rc_resp.args[4], &resp, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0], |
| + rc_resp.args.args32[1], rc_resp.args.args32[2], |
| + rc_resp.args.args32[3], rc_resp.args.args32[4], &resp, |
| FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp)); |
| @@ -590,58 +653,58 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_fail_forwarding) |
| sp_msg sp_req = { 0 }; |
| sp_msg sp_resp = { 0 }; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| /* This source ID should be denied in the current state. */ |
| request_to_deny.source_id = rc_root_id; |
| request_to_deny.destination_id = own_id; |
| - request_to_deny.args[0] = ROUTING_EXT_RC_BIT; |
| + request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &request_to_deny, FFA_OK); |
| |
| /* Sending error to root which fails */ |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| own_id, rc_root_id, ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT, |
| SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_DENIED); |
| |
| @@ -649,7 +712,7 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_fail_forwarding) |
| expect_ffa_msg_wait(&rc_resp, result); |
| |
| /* Fowarding RC error as FFA_MSG_WAIT failed */ |
| - expect_ffa_msg_send_direct_req( |
| + expect_ffa_msg_send_direct_req_32( |
| own_id, rc_root_id, (ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT), |
| result, 0, 0, 0, &resp, FFA_OK); |
| |
| @@ -670,52 +733,52 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_return_rc_error_msg) |
| sp_msg sp_resp = { 0 }; |
| ffa_result result = FFA_ABORTED; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &rc_resp, result); |
| |
| /* Fowarding RC error to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(result), 0, 0, 0, &resp, |
| FFA_OK); |
| @@ -737,54 +800,54 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_return_resp_fail) |
| sp_msg sp_resp = { 0 }; |
| ffa_result result = FFA_ABORTED; |
| |
| - fill_sp_msg(&sp_req); |
| + fill_sp_msg_32(&sp_req); |
| sp_req.source_id = own_id; |
| sp_req.destination_id = rc_root_id; |
| |
| req.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| req.source_id = own_id; |
| req.destination_id = rc_root_id; |
| - copy_sp_to_ffa_args(sp_req.args, req.args); |
| + copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32); |
| |
| - fill_ffa_msg(&rc_req); |
| + fill_ffa_msg_32(&rc_req); |
| rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| rc_req.source_id = rc_root_id; |
| rc_req.destination_id = own_id; |
| - rc_req.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_req.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&rc_resp); |
| + fill_ffa_msg_32(&rc_resp); |
| rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32; |
| rc_resp.source_id = root_id; |
| rc_resp.destination_id = own_id; |
| - rc_resp.args[0] = ROUTING_EXT_RC_BIT; |
| + rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_sp_msg(&sp_resp); |
| + fill_sp_msg_32(&sp_resp); |
| sp_resp.source_id = rc_root_id; |
| sp_resp.destination_id = own_id; |
| |
| resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32; |
| resp.source_id = rc_root_id; |
| resp.destination_id = own_id; |
| - copy_sp_to_ffa_args(sp_resp.args, resp.args); |
| + copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32); |
| |
| /* Initial request to current SP to set own_id */ |
| wait_and_receive_request(root_id, own_id); |
| |
| /* Sending request and receiving RC request from RC root */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1], |
| - req.args[2], req.args[3], req.args[4], |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1], |
| + req.args.args32[2], req.args.args32[3], req.args.args32[4], |
| &rc_req, FFA_OK); |
| |
| /* Forwarding RC request to root and receiving RC response */ |
| - expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0], |
| - rc_req.args[1], rc_req.args[2], |
| - rc_req.args[3], rc_req.args[4], |
| + expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0], |
| + rc_req.args.args32[1], rc_req.args.args32[2], |
| + rc_req.args.args32[3], rc_req.args.args32[4], |
| &rc_resp, FFA_OK); |
| |
| /* Fowarding RC response to RC root and receiving response */ |
| - expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0], |
| - rc_resp.args[1], rc_resp.args[2], |
| - rc_resp.args[3], rc_resp.args[4], &resp, |
| + expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0], |
| + rc_resp.args.args32[1], rc_resp.args.args32[2], |
| + rc_resp.args.args32[3], rc_resp.args.args32[4], &resp, |
| result); |
| |
| LONGS_EQUAL(SP_RESULT_FFA(result), |
| @@ -812,10 +875,11 @@ TEST(sp_messaging, sp_msg_send_direct_resp_ffa_error) |
| ffa_result result = FFA_ABORTED; |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&resp); |
| + fill_sp_msg_32(&resp); |
| memset(&req, 0x5a, sizeof(req)); |
| - copy_sp_to_ffa_args(resp.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_resp( |
| + req.is_64bit_message = false; |
| + copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_resp_32( |
| resp.source_id, resp.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, result); |
| @@ -825,14 +889,30 @@ TEST(sp_messaging, sp_msg_send_direct_resp_ffa_error) |
| MEMCMP_EQUAL(&empty_sp_msg, &req, sizeof(empty_sp_msg)); |
| } |
| |
| -TEST(sp_messaging, sp_msg_send_direct_resp_msg) |
| +TEST(sp_messaging, sp_msg_send_direct_resp_msg_32) |
| { |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&resp); |
| - fill_ffa_msg(&ffa_msg); |
| - copy_sp_to_ffa_args(resp.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_resp( |
| + fill_sp_msg_32(&resp); |
| + fill_ffa_msg_32(&ffa_msg); |
| + copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_resp_32( |
| + resp.source_id, resp.destination_id, expected_ffa_args[0], |
| + expected_ffa_args[1], expected_ffa_args[2], |
| + expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| + |
| + LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_resp(&resp, &req)); |
| + ffa_and_sp_msg_equal(&ffa_msg, &req); |
| +} |
| + |
| +TEST(sp_messaging, sp_msg_send_direct_resp_msg_64) |
| +{ |
| + uint64_t expected_ffa_args[5] = { 0 }; |
| + |
| + fill_sp_msg_64(&resp); |
| + fill_ffa_msg_64(&ffa_msg); |
| + copy_sp_to_ffa_args_64(resp.args.args64, expected_ffa_args); |
| + expect_ffa_msg_send_direct_resp_64( |
| resp.source_id, resp.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| @@ -841,15 +921,16 @@ TEST(sp_messaging, sp_msg_send_direct_resp_msg) |
| ffa_and_sp_msg_equal(&ffa_msg, &req); |
| } |
| |
| + |
| TEST(sp_messaging, sp_msg_send_direct_resp_success) |
| { |
| uint32_t expected_ffa_args[5] = { 0 }; |
| |
| - fill_sp_msg(&req); |
| - fill_sp_msg(&resp); |
| + fill_sp_msg_32(&req); |
| + fill_sp_msg_32(&resp); |
| ffa_msg.function_id = FFA_SUCCESS_32; |
| - copy_sp_to_ffa_args(resp.args, expected_ffa_args); |
| - expect_ffa_msg_send_direct_resp( |
| + copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args); |
| + expect_ffa_msg_send_direct_resp_32( |
| resp.source_id, resp.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK); |
| @@ -864,20 +945,20 @@ TEST(sp_messaging, sp_msg_send_direct_resp_deny_rc_failure) |
| uint32_t expected_ffa_args[5] = { 0 }; |
| struct ffa_direct_msg rc_msg = { 0 }; |
| |
| - fill_sp_msg(&resp); |
| + fill_sp_msg_32(&resp); |
| |
| - fill_ffa_msg(&rc_msg); |
| - rc_msg.args[0] = ROUTING_EXT_RC_BIT; |
| + fill_ffa_msg_32(&rc_msg); |
| + rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&ffa_msg); |
| - copy_sp_to_ffa_args(resp.args, expected_ffa_args); |
| + fill_ffa_msg_32(&ffa_msg); |
| + copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args); |
| |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| resp.source_id, resp.destination_id, expected_ffa_args[0], |
| expected_ffa_args[1], expected_ffa_args[2], |
| expected_ffa_args[3], expected_ffa_args[4], &rc_msg, FFA_OK); |
| |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| rc_msg.destination_id, rc_msg.source_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, result); |
| @@ -892,21 +973,21 @@ TEST(sp_messaging, sp_msg_send_direct_resp_deny_rc) |
| uint32_t expected_ffa_args[5] = { 0 }; |
| struct ffa_direct_msg rc_msg = { 0 }; |
| |
| - fill_sp_msg(&resp); |
| + fill_sp_msg_32(&resp); |
| |
| - fill_ffa_msg(&rc_msg); |
| - rc_msg.args[0] = ROUTING_EXT_RC_BIT; |
| + fill_ffa_msg_32(&rc_msg); |
| + rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - fill_ffa_msg(&ffa_msg); |
| - copy_sp_to_ffa_args(resp.args, expected_ffa_args); |
| + fill_ffa_msg_32(&ffa_msg); |
| + copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args); |
| |
| - expect_ffa_msg_send_direct_resp(resp.source_id, resp.destination_id, 0, |
| + expect_ffa_msg_send_direct_resp_32(resp.source_id, resp.destination_id, 0, |
| expected_ffa_args[1], |
| expected_ffa_args[2], |
| expected_ffa_args[3], |
| expected_ffa_args[4], &rc_msg, FFA_OK); |
| |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| rc_msg.destination_id, rc_msg.source_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, FFA_OK); |
| @@ -933,13 +1014,14 @@ TEST(sp_messaging, sp_msg_send_rc_req_ffa_error) |
| { |
| ffa_result result = FFA_ABORTED; |
| |
| - fill_sp_msg(&resp); |
| + fill_sp_msg_32(&resp); |
| memset(&req, 0x5a, sizeof(req)); |
| - fill_ffa_msg(&ffa_msg); |
| + req.is_64bit_message = false; |
| + fill_ffa_msg_32(&ffa_msg); |
| |
| - expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id, |
| - ROUTING_EXT_RC_BIT, req.args[0], |
| - req.args[1], req.args[2], req.args[3], |
| + expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id, |
| + ROUTING_EXT_RC_BIT, req.args.args32[0], |
| + req.args.args32[1], req.args.args32[2], req.args.args32[3], |
| &ffa_msg, result); |
| |
| LONGS_EQUAL(SP_RESULT_FFA(result), sp_msg_send_rc_req(&req, &resp)); |
| @@ -953,22 +1035,22 @@ TEST(sp_messaging, sp_msg_send_rc_req_deny_fail_wait_fail) |
| |
| wait_and_receive_request(root_id, own_id); |
| |
| - fill_sp_msg(&req); |
| + fill_sp_msg_32(&req); |
| req.source_id = own_id; |
| req.destination_id = root_id; |
| |
| - fill_ffa_msg(&ffa_msg); |
| + fill_ffa_msg_32(&ffa_msg); |
| ffa_msg.source_id = root_id; |
| ffa_msg.destination_id = own_id; |
| /* Should be RC message so it will be denied */ |
| - ffa_msg.args[0] = 0; |
| + ffa_msg.args.args32[0] = 0; |
| |
| - expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id, |
| - ROUTING_EXT_RC_BIT, req.args[0], |
| - req.args[1], req.args[2], req.args[3], |
| + expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id, |
| + ROUTING_EXT_RC_BIT, req.args.args32[0], |
| + req.args.args32[1], req.args.args32[2], req.args.args32[3], |
| &ffa_msg, FFA_OK); |
| |
| - expect_ffa_msg_send_direct_resp( |
| + expect_ffa_msg_send_direct_resp_32( |
| req.source_id, req.destination_id, |
| ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT, |
| SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &ffa_msg, result); |
| @@ -987,19 +1069,19 @@ TEST(sp_messaging, sp_msg_send_rc_req_rc_error) |
| |
| wait_and_receive_request(root_id, own_id); |
| |
| - fill_sp_msg(&req); |
| + fill_sp_msg_32(&req); |
| req.source_id = own_id; |
| req.destination_id = root_id; |
| |
| - fill_ffa_msg(&ffa_msg); |
| + fill_ffa_msg_32(&ffa_msg); |
| ffa_msg.source_id = root_id; |
| ffa_msg.destination_id = own_id; |
| - ffa_msg.args[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT; |
| - ffa_msg.args[1] = sp_err; |
| + ffa_msg.args.args32[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT; |
| + ffa_msg.args.args32[1] = sp_err; |
| |
| - expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id, |
| - ROUTING_EXT_RC_BIT, req.args[0], |
| - req.args[1], req.args[2], req.args[3], |
| + expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id, |
| + ROUTING_EXT_RC_BIT, req.args.args32[0], |
| + req.args.args32[1], req.args.args32[2], req.args.args32[3], |
| &ffa_msg, FFA_OK); |
| |
| LONGS_EQUAL(sp_err, sp_msg_send_rc_req(&req, &resp)); |
| @@ -1013,18 +1095,18 @@ TEST(sp_messaging, sp_msg_send_rc_req_success) |
| |
| wait_and_receive_request(root_id, own_id); |
| |
| - fill_sp_msg(&req); |
| + fill_sp_msg_32(&req); |
| req.source_id = own_id; |
| req.destination_id = root_id; |
| |
| - fill_ffa_msg(&ffa_msg); |
| + fill_ffa_msg_32(&ffa_msg); |
| ffa_msg.source_id = root_id; |
| ffa_msg.destination_id = own_id; |
| - ffa_msg.args[0] = ROUTING_EXT_RC_BIT; |
| + ffa_msg.args.args32[0] = ROUTING_EXT_RC_BIT; |
| |
| - expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id, |
| - ROUTING_EXT_RC_BIT, req.args[0], |
| - req.args[1], req.args[2], req.args[3], |
| + expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id, |
| + ROUTING_EXT_RC_BIT, req.args.args32[0], |
| + req.args.args32[1], req.args.args32[2], req.args.args32[3], |
| &ffa_msg, FFA_OK); |
| |
| LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_rc_req(&req, &resp)); |
| diff --git a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c |
| index 4ad98fb..ca3d318 100644 |
| --- a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c |
| +++ b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c |
| @@ -81,16 +81,17 @@ static rpc_status_t call_invoke(void *context, rpc_call_handle handle, uint32_t |
| |
| req.destination_id = this_context->dest_partition_id; |
| req.source_id = own_id; |
| - req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| + req.is_64bit_message = false; |
| + req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(this_context->dest_iface_id, opcode); |
| - req.args[SP_CALL_ARGS_REQ_DATA_LEN] = (uint32_t)this_context->req_len; |
| - req.args[SP_CALL_ARGS_ENCODING] = this_context->rpc_caller.encoding; |
| + req.args.args32[SP_CALL_ARGS_REQ_DATA_LEN] = (uint32_t)this_context->req_len; |
| + req.args.args32[SP_CALL_ARGS_ENCODING] = this_context->rpc_caller.encoding; |
| |
| /* Initialise the caller ID. Depending on the call path, this may |
| * be overridden by a higher privilege execution level, based on its |
| * perspective of the caller identity. |
| */ |
| - req.args[SP_CALL_ARGS_CALLER_ID] = 0; |
| + req.args.args32[SP_CALL_ARGS_CALLER_ID] = 0; |
| |
| sp_res = sp_msg_send_direct_req(&req, &resp); |
| if (sp_res != SP_RESULT_OK) { |
| @@ -98,9 +99,9 @@ static rpc_status_t call_invoke(void *context, rpc_call_handle handle, uint32_t |
| goto out; |
| } |
| |
| - this_context->resp_len = (size_t)resp.args[SP_CALL_ARGS_RESP_DATA_LEN]; |
| - status = resp.args[SP_CALL_ARGS_RESP_RPC_STATUS]; |
| - *opstatus = (rpc_status_t)((int32_t)resp.args[SP_CALL_ARGS_RESP_OP_STATUS]); |
| + this_context->resp_len = (size_t)resp.args.args32[SP_CALL_ARGS_RESP_DATA_LEN]; |
| + status = resp.args.args32[SP_CALL_ARGS_RESP_RPC_STATUS]; |
| + *opstatus = (rpc_status_t)((int32_t)resp.args.args32[SP_CALL_ARGS_RESP_OP_STATUS]); |
| |
| if (this_context->resp_len > this_context->shared_mem_required_size) { |
| EMSG("invalid response length"); |
| @@ -242,11 +243,12 @@ int ffarpc_caller_open(struct ffarpc_caller *caller, uint16_t dest_partition_id, |
| |
| req.source_id = own_id; |
| req.destination_id = dest_partition_id; |
| - req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| + req.is_64bit_message = false; |
| + req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(FFA_CALL_MGMT_IFACE_ID, FFA_CALL_OPCODE_SHARE_BUF); |
| - req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = (uint32_t)(handle & UINT32_MAX); |
| - req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = (uint32_t)(handle >> 32); |
| - req.args[SP_CALL_ARGS_SHARE_MEM_SIZE] = (uint32_t)(caller->shared_mem_required_size); |
| + req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = (uint32_t)(handle & UINT32_MAX); |
| + req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = (uint32_t)(handle >> 32); |
| + req.args.args32[SP_CALL_ARGS_SHARE_MEM_SIZE] = (uint32_t)(caller->shared_mem_required_size); |
| |
| sp_res = sp_msg_send_direct_req(&req, &resp); |
| if (sp_res != SP_RESULT_OK) { |
| @@ -273,10 +275,11 @@ int ffarpc_caller_close(struct ffarpc_caller *caller) |
| |
| req.source_id = own_id; |
| req.destination_id = caller->dest_partition_id; |
| - req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| + req.is_64bit_message = false; |
| + req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] = |
| FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(FFA_CALL_MGMT_IFACE_ID, FFA_CALL_OPCODE_UNSHARE_BUF); |
| - req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = handle_lo; |
| - req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = handle_hi; |
| + req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = handle_lo; |
| + req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = handle_hi; |
| |
| sp_res = sp_msg_send_direct_req(&req, &resp); |
| if (sp_res != SP_RESULT_OK) { |
| diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c |
| index 6a8cef0..c024196 100644 |
| --- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c |
| +++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c |
| @@ -260,8 +260,8 @@ void ffa_call_ep_receive(struct ffa_call_ep *call_ep, |
| const struct sp_msg *req_msg, |
| struct sp_msg *resp_msg) |
| { |
| - const uint32_t *req_args = req_msg->args; |
| - uint32_t *resp_args = resp_msg->args; |
| + const uint32_t *req_args = req_msg->args.args32; |
| + uint32_t *resp_args = resp_msg->args.args32; |
| |
| uint16_t source_id = req_msg->source_id; |
| uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE]; |
| diff --git a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c |
| index 09f1e2c..dc49e64 100644 |
| --- a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c |
| +++ b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c |
| @@ -1,6 +1,6 @@ |
| // SPDX-License-Identifier: BSD-3-Clause |
| /* |
| - * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| + * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| */ |
| |
| #include "components/rpc/mm_communicate/common/mm_communicate_call_args.h" |
| @@ -127,15 +127,15 @@ void mm_communicate_call_ep_receive(struct mm_communicate_ep *mm_communicate_cal |
| uintptr_t buffer_address = 0; |
| size_t buffer_size = 0; |
| |
| - buffer_address = req_msg->args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS]; |
| - buffer_size = req_msg->args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE]; |
| + buffer_address = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS]; |
| + buffer_size = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE]; |
| |
| return_value = handle_mm_communicate(mm_communicate_call_ep, req_msg->source_id, |
| buffer_address, buffer_size); |
| |
| - resp_msg->args[MM_COMMUNICATE_CALL_ARGS_RETURN_ID] = ARM_SVC_ID_SP_EVENT_COMPLETE; |
| - resp_msg->args[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value; |
| - resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0; |
| - resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0; |
| - resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0; |
| + resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_ID] = ARM_SVC_ID_SP_EVENT_COMPLETE; |
| + resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value; |
| + resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0; |
| + resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0; |
| + resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0; |
| } |
| diff --git a/deployments/smm-gateway/common/smm_gateway_sp.c b/deployments/smm-gateway/common/smm_gateway_sp.c |
| index 2187fea..3697b7f 100644 |
| --- a/deployments/smm-gateway/common/smm_gateway_sp.c |
| +++ b/deployments/smm-gateway/common/smm_gateway_sp.c |
| @@ -70,10 +70,10 @@ void __noreturn sp_main(struct ffa_init_info *init_info) |
| while (1) { |
| mm_communicate_call_ep_receive(&mm_communicate_call_ep, &req_msg, &resp_msg); |
| |
| - ffa_msg_send_direct_resp(req_msg.destination_id, |
| - req_msg.source_id, resp_msg.args[0], |
| - resp_msg.args[1], resp_msg.args[2], |
| - resp_msg.args[3], resp_msg.args[4], |
| + ffa_msg_send_direct_resp_32(req_msg.destination_id, |
| + req_msg.source_id, resp_msg.args.args32[0], |
| + resp_msg.args.args32[1], resp_msg.args.args32[2], |
| + resp_msg.args.args32[3], resp_msg.args.args32[4], |
| &req_msg); |
| } |
| |
| -- |
| 2.17.1 |
| |