diff options
20 files changed, 142 insertions, 105 deletions
diff --git a/include/runtime_services/ffa_endpoints.h b/include/runtime_services/ffa_endpoints.h index 7a6cd4f..06b5abc 100644 --- a/include/runtime_services/ffa_endpoints.h +++ b/include/runtime_services/ffa_endpoints.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited. All rights reserved. + * Copyright (c) 2020-2021, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,11 +7,19 @@ #ifndef FFA_ENDPOINTS_H #define FFA_ENDPOINTS_H +#include <platform_def.h> + /* UUID of cactus SPs as defined in the respective manifests. */ #define PRIMARY_UUID {0xb4b5671e, 0x4a904fe1, 0xb81ffb13, 0xdae1dacb} #define SECONDARY_UUID {0xd1582309, 0xf02347b9, 0x827c4464, 0xf5578fc8} #define TERTIARY_UUID {0x79b55c73, 0x1d8c44b9, 0x859361e1, 0x770ad8d2} +/* vcpu_count of cactus SPs. */ +#define PRIMARY_EXEC_CTX_COUNT PLATFORM_CORE_COUNT +#define SECONDARY_EXEC_CTX_COUNT PLATFORM_CORE_COUNT +#define TERTIARY_EXEC_CTX_COUNT (1) +#define IVY_EXEC_CTX_COUNT (1) + /* UUID of OPTEE SP as defined in the respective manifest. */ #define OPTEE_UUID {0x486178e0, 0xe7f811e3, 0xbc5e0002, 0xa5d5c51b} diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h index 3ca9c82..a17f115 100644 --- a/include/runtime_services/ffa_helpers.h +++ b/include/runtime_services/ffa_helpers.h @@ -29,6 +29,15 @@ struct ffa_uuid { #include <stdint.h> +/** Partition property: partition supports receipt of direct requests. */ +#define FFA_PARTITION_DIRECT_REQ_RECV 0x1 + +/** Partition property: partition can send direct requests. */ +#define FFA_PARTITION_DIRECT_REQ_SEND 0x2 + +/** Partition property: partition can send and receive indirect messages. */ +#define FFA_PARTITION_INDIRECT_MSG 0x4 + struct ffa_partition_info { /** The ID of the VM the information is about */ ffa_id_t id; @@ -402,7 +411,7 @@ smc_ret_values ffa_spm_id_get(void); smc_ret_values ffa_msg_wait(void); smc_ret_values ffa_error(int32_t error_code); smc_ret_values ffa_features(uint32_t feature); -smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]); +smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid); smc_ret_values ffa_rx_release(void); smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages); smc_ret_values ffa_mem_donate(uint32_t descriptor_length, diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h index 5ccf395..ffe666f 100644 --- a/include/runtime_services/spm_common.h +++ b/include/runtime_services/spm_common.h @@ -137,4 +137,9 @@ ffa_memory_handle_t memory_init_and_send( const struct ffa_memory_region_constituent* constituents, uint32_t constituents_count, uint32_t mem_func); +bool ffa_partition_info_helper(struct mailbox_buffers *mb, + const struct ffa_uuid uuid, + const struct ffa_partition_info *expected, + const uint16_t expected_size); + #endif /* SPM_COMMON_H */ diff --git a/plat/arm/fvp/platform.mk b/plat/arm/fvp/platform.mk index 4f8c4bd..c9bbe6e 100644 --- a/plat/arm/fvp/platform.mk +++ b/plat/arm/fvp/platform.mk @@ -56,9 +56,17 @@ ifneq ($(FVP_MAX_CPUS_PER_CLUSTER),$(filter $(FVP_MAX_CPUS_PER_CLUSTER),$(CPU))) endif # Pass FVP topology definitions to the build system -$(eval $(call add_define,TFTF_DEFINES,FVP_CLUSTER_COUNT)) -$(eval $(call add_define,TFTF_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) -$(eval $(call add_define,TFTF_DEFINES,FVP_MAX_PE_PER_CPU)) +$(eval $(call add_define,CACTUS_DEFINES,FVP_CLUSTER_COUNT)) +$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) +$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU)) + +$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_CLUSTER_COUNT)) +$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) +$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_MAX_PE_PER_CPU)) + +$(eval $(call add_define,IVY_DEFINES,FVP_CLUSTER_COUNT)) +$(eval $(call add_define,IVY_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) +$(eval $(call add_define,IVY_DEFINES,FVP_MAX_PE_PER_CPU)) $(eval $(call add_define,NS_BL1U_DEFINES,FVP_CLUSTER_COUNT)) $(eval $(call add_define,NS_BL1U_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) @@ -68,6 +76,10 @@ $(eval $(call add_define,NS_BL2U_DEFINES,FVP_CLUSTER_COUNT)) $(eval $(call add_define,NS_BL2U_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) $(eval $(call add_define,NS_BL2U_DEFINES,FVP_MAX_PE_PER_CPU)) +$(eval $(call add_define,TFTF_DEFINES,FVP_CLUSTER_COUNT)) +$(eval $(call add_define,TFTF_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) +$(eval $(call add_define,TFTF_DEFINES,FVP_MAX_PE_PER_CPU)) + PLAT_INCLUDES += -Iplat/arm/fvp/include/ PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \ diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk index 5247fde..c21f44b 100644 --- a/spm/cactus/cactus.mk +++ b/spm/cactus/cactus.mk @@ -80,9 +80,6 @@ $(eval $(call add_define,CACTUS_DEFINES,DEBUG)) $(eval $(call add_define,CACTUS_DEFINES,ENABLE_ASSERTIONS)) $(eval $(call add_define,CACTUS_DEFINES,ENABLE_BTI)) $(eval $(call add_define,CACTUS_DEFINES,ENABLE_PAUTH)) -$(eval $(call add_define,CACTUS_DEFINES,FVP_CLUSTER_COUNT)) -$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) -$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU)) $(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL)) $(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT})) $(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC)) diff --git a/spm/cactus/cactus_tests/cactus_test_ffa.c b/spm/cactus/cactus_tests/cactus_test_ffa.c index 93f0403..ba069d0 100644 --- a/spm/cactus/cactus_tests/cactus_test_ffa.c +++ b/spm/cactus/cactus_tests/cactus_test_ffa.c @@ -22,10 +22,37 @@ static uint32_t spm_version; -static const uint32_t primary_uuid[4] = PRIMARY_UUID; -static const uint32_t secondary_uuid[4] = SECONDARY_UUID; -static const uint32_t tertiary_uuid[4] = TERTIARY_UUID; -static const uint32_t null_uuid[4] = {0}; +static const struct ffa_uuid sp_uuids[] = { + {PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID} + }; +static const struct ffa_uuid null_uuid = { .uuid = {0} }; + +static const struct ffa_partition_info ffa_expected_partition_info[] = { + /* Primary partition info */ + { + .id = SP_ID(1), + .exec_context = PRIMARY_EXEC_CTX_COUNT, + .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND) + }, + /* Secondary partition info */ + { + .id = SP_ID(2), + .exec_context = SECONDARY_EXEC_CTX_COUNT, + .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND) + }, + /* Tertiary partition info */ + { + .id = SP_ID(3), + .exec_context = TERTIARY_EXEC_CTX_COUNT, + .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND) + }, + /* Ivy partition info */ + { + .id = SP_ID(4), + .exec_context = IVY_EXEC_CTX_COUNT, + .properties = (FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND) + } +}; /* * Test FFA_FEATURES interface. @@ -64,29 +91,10 @@ static void ffa_features_test(void) announce_test_section_end(test_features); } -static void ffa_partition_info_helper(struct mailbox_buffers *mb, const uint32_t uuid[4], - const struct ffa_partition_info *expected, - const uint16_t expected_size) -{ - smc_ret_values ret = ffa_partition_info_get(uuid); - unsigned int i; - expect(ffa_func_id(ret), FFA_SUCCESS_SMC32); - - struct ffa_partition_info *info = (struct ffa_partition_info *)(mb->recv); - for (i = 0U; i < expected_size; i++) { - expect(info[i].id, expected[i].id); - expect(info[i].exec_context, expected[i].exec_context); - expect(info[i].properties, expected[i].properties); - } - - ret = ffa_rx_release(); - expect(ffa_func_id(ret), FFA_SUCCESS_SMC32); -} - static void ffa_partition_info_wrong_test(void) { const char *test_wrong_uuid = "Request wrong UUID"; - uint32_t uuid[4] = {1}; + const struct ffa_uuid uuid = { .uuid = {1} }; announce_test_start(test_wrong_uuid); @@ -100,50 +108,20 @@ static void ffa_partition_info_wrong_test(void) static void ffa_partition_info_get_test(struct mailbox_buffers *mb) { const char *test_partition_info = "FFA Partition info interface"; - const char *test_primary = "Get primary partition info"; - const char *test_secondary = "Get secondary partition info"; - const char *test_tertiary = "Get tertiary partition info"; - const char *test_all = "Get all partitions info"; - - const struct ffa_partition_info expected_info[] = { - /* Primary partition info */ - { - .id = SPM_VM_ID_FIRST, - .exec_context = CACTUS_PRIMARY_EC_COUNT, - /* Supports receipt of direct message requests. */ - .properties = 1U - }, - /* Secondary partition info */ - { - .id = SPM_VM_ID_FIRST + 1U, - .exec_context = CACTUS_SECONDARY_EC_COUNT, - .properties = 1U - }, - /* Tertiary partition info */ - { - .id = SPM_VM_ID_FIRST + 2U, - .exec_context = CACTUS_TERTIARY_EC_COUNT, - .properties = 1U - } - }; announce_test_section_start(test_partition_info); - announce_test_start(test_tertiary); - ffa_partition_info_helper(mb, tertiary_uuid, &expected_info[2], 1); - announce_test_end(test_tertiary); + expect(ffa_partition_info_helper(mb, sp_uuids[2], + &ffa_expected_partition_info[2], 1), true); - announce_test_start(test_secondary); - ffa_partition_info_helper(mb, secondary_uuid, &expected_info[1], 1); - announce_test_end(test_secondary); + expect(ffa_partition_info_helper(mb, sp_uuids[1], + &ffa_expected_partition_info[1], 1), true); - announce_test_start(test_primary); - ffa_partition_info_helper(mb, primary_uuid, &expected_info[0], 1); - announce_test_end(test_primary); + expect(ffa_partition_info_helper(mb, sp_uuids[0], + &ffa_expected_partition_info[0], 1), true); - announce_test_start(test_all); - ffa_partition_info_helper(mb, null_uuid, expected_info, 3); - announce_test_end(test_all); + expect(ffa_partition_info_helper(mb, null_uuid, + ffa_expected_partition_info, 4), true); ffa_partition_info_wrong_test(); diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts index 661684b..2841b7c 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, Arm Limited. All rights reserved. + * Copyright (c) 2019-2021, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -27,7 +27,7 @@ entrypoint-offset = <0x00001000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; - messaging-method = <0>; /* Direct messaging only */ + messaging-method = <3>; /* Direct messaging only */ run-time-model = <0>; /* Run to completion */ /* Boot protocol */ diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts index ea7d5d6..37b0576 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited. All rights reserved. + * Copyright (c) 2020-2021, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -27,7 +27,7 @@ entrypoint-offset = <0x00001000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; - messaging-method = <0>; /* Direct messaging only */ + messaging-method = <3>; /* Direct messaging only */ run-time-model = <0>; /* Run to completion */ /* Boot protocol */ diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus.dts b/spm/cactus/plat/arm/fvp/fdts/cactus.dts index 1c28fde..2db86c7 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus.dts @@ -27,7 +27,7 @@ entrypoint-offset = <0x00001000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; - messaging-method = <3>; /* Direct messaging with managed exit */ + messaging-method = <11>; /* Direct messaging with managed exit */ run-time-model = <0>; /* Run to completion */ /* Boot protocol */ diff --git a/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h index 8940c83..d35194d 100644 --- a/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h +++ b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h @@ -22,10 +22,6 @@ #define PLAT_CACTUS_MEMCPY_BASE ULL(0x7400000) #define PLAT_CACTUS_MEMCPY_RANGE ULL(0x8000) -#define CACTUS_PRIMARY_EC_COUNT (8U) -#define CACTUS_SECONDARY_EC_COUNT (8U) -#define CACTUS_TERTIARY_EC_COUNT (1U) - /* Base address of user and PRIV frames in SMMUv3TestEngine */ #define USR_BASE_FRAME ULL(0x2BFE0000) #define PRIV_BASE_FRAME ULL(0x2BFF0000) diff --git a/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h b/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h index 585391d..62cb3ed 100644 --- a/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h +++ b/spm/cactus/plat/arm/tc0/include/cactus_platform_def.h @@ -18,10 +18,6 @@ #define PLAT_CACTUS_RX_BASE ULL(0xfe300000) #define PLAT_CACTUS_CORE_COUNT (8) -#define CACTUS_PRIMARY_EC_COUNT (8U) -#define CACTUS_SECONDARY_EC_COUNT (8U) -#define CACTUS_TERTIARY_EC_COUNT (1U) - /* Scratch memory used for SMMUv3 driver testing purposes in Cactus SP */ /* SMMUv3 tests are disabled for TC platform */ #define PLAT_CACTUS_MEMCPY_BASE ULL(0xfe400000) diff --git a/spm/cactus_mm/cactus_mm.mk b/spm/cactus_mm/cactus_mm.mk index 3156c1c..9d98d62 100644 --- a/spm/cactus_mm/cactus_mm.mk +++ b/spm/cactus_mm/cactus_mm.mk @@ -59,9 +59,6 @@ $(eval $(call add_define,CACTUS_MM_DEFINES,ARM_ARCH_MINOR)) $(eval $(call add_define,CACTUS_MM_DEFINES,DEBUG)) $(eval $(call add_define,CACTUS_MM_DEFINES,ENABLE_BTI)) $(eval $(call add_define,CACTUS_MM_DEFINES,ENABLE_PAUTH)) -$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_CLUSTER_COUNT)) -$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) -$(eval $(call add_define,CACTUS_MM_DEFINES,FVP_MAX_PE_PER_CPU)) $(eval $(call add_define,CACTUS_MM_DEFINES,LOG_LEVEL)) $(eval $(call add_define,CACTUS_MM_DEFINES,PLAT_${PLAT})) diff --git a/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts b/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts index 49a84bd..a6d0064 100644 --- a/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts +++ b/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts @@ -24,7 +24,7 @@ entrypoint-offset = <0x00001000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; - messaging-method = <0>; /* Direct messaging only */ + messaging-method = <3>; /* Direct messaging only */ run-time-model = <1>; /* SP pre-emptible */ /* Boot protocol */ diff --git a/spm/ivy/app/plat/arm/fvp/include/ivy_platform_def.h b/spm/ivy/app/plat/arm/fvp/include/ivy_platform_def.h index 3658c83..49c8231 100644 --- a/spm/ivy/app/plat/arm/fvp/include/ivy_platform_def.h +++ b/spm/ivy/app/plat/arm/fvp/include/ivy_platform_def.h @@ -17,8 +17,4 @@ #define PLAT_CACTUS_RX_BASE ULL(0x7300000) -#define CACTUS_PRIMARY_EC_COUNT (8U) -#define CACTUS_SECONDARY_EC_COUNT (8U) -#define CACTUS_TERTIARY_EC_COUNT (8U) - #endif /* CACTUS_PLATFORM_DEF_H */ diff --git a/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts b/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts index 2a22e20..42084f4 100644 --- a/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts +++ b/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts @@ -27,7 +27,7 @@ entrypoint-offset = <0x00001000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; - messaging-method = <0>; /* Direct messaging only */ + messaging-method = <3>; /* Direct messaging only */ run-time-model = <1>; /* SP pre-emptible */ /* Boot protocol */ diff --git a/spm/ivy/app/plat/arm/tc0/include/ivy_platform_def.h b/spm/ivy/app/plat/arm/tc0/include/ivy_platform_def.h index 3658c83..49c8231 100644 --- a/spm/ivy/app/plat/arm/tc0/include/ivy_platform_def.h +++ b/spm/ivy/app/plat/arm/tc0/include/ivy_platform_def.h @@ -17,8 +17,4 @@ #define PLAT_CACTUS_RX_BASE ULL(0x7300000) -#define CACTUS_PRIMARY_EC_COUNT (8U) -#define CACTUS_SECONDARY_EC_COUNT (8U) -#define CACTUS_TERTIARY_EC_COUNT (8U) - #endif /* CACTUS_PLATFORM_DEF_H */ diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk index d184097..f58422f 100644 --- a/spm/ivy/ivy.mk +++ b/spm/ivy/ivy.mk @@ -73,9 +73,6 @@ $(eval $(call add_define,IVY_DEFINES,DEBUG)) $(eval $(call add_define,IVY_DEFINES,ENABLE_ASSERTIONS)) $(eval $(call add_define,IVY_DEFINES,ENABLE_BTI)) $(eval $(call add_define,IVY_DEFINES,ENABLE_PAUTH)) -$(eval $(call add_define,IVY_DEFINES,FVP_CLUSTER_COUNT)) -$(eval $(call add_define,IVY_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) -$(eval $(call add_define,IVY_DEFINES,FVP_MAX_PE_PER_CPU)) $(eval $(call add_define,IVY_DEFINES,LOG_LEVEL)) $(eval $(call add_define,IVY_DEFINES,PLAT_${PLAT})) diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c index d794beb..fffad67 100644 --- a/tftf/tests/common/test_helpers.c +++ b/tftf/tests/common/test_helpers.c @@ -172,7 +172,7 @@ test_result_t check_spmc_testing_set_up( GET_TFTF_MAILBOX(mb); for (unsigned int i = 0U; i < ffa_uuids_size; i++) - SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(*mb, ffa_uuids[i].uuid); + SKIP_TEST_IF_FFA_ENDPOINT_NOT_DEPLOYED(*mb, ffa_uuids[i]); return TEST_RESULT_SUCCESS; } diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c index 4c69eb1..8d043a1 100644 --- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c +++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c @@ -357,14 +357,14 @@ smc_ret_values ffa_features(uint32_t feature) } /* Get information about VMs or SPs based on UUID */ -smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]) +smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid) { smc_args args = { .fid = FFA_PARTITION_INFO_GET, - .arg1 = uuid[0], - .arg2 = uuid[1], - .arg3 = uuid[2], - .arg4 = uuid[3] + .arg1 = uuid.uuid[0], + .arg2 = uuid.uuid[1], + .arg3 = uuid.uuid[2], + .arg4 = uuid.uuid[3] }; return tftf_smc(&args); diff --git a/tftf/tests/runtime_services/secure_service/spm_common.c b/tftf/tests/runtime_services/secure_service/spm_common.c index e2c7361..7aa4861 100644 --- a/tftf/tests/runtime_services/secure_service/spm_common.c +++ b/tftf/tests/runtime_services/secure_service/spm_common.c @@ -459,3 +459,53 @@ ffa_memory_handle_t memory_init_and_send( return memory_send(memory_region, mem_func, fragment_length, total_length); } + +/** + * Sends a ffa_partition_info request and checks the response against the + * target. + */ +bool ffa_partition_info_helper(struct mailbox_buffers *mb, + const struct ffa_uuid uuid, + const struct ffa_partition_info *expected, + const uint16_t expected_size) +{ + bool result = true; + smc_ret_values ret = ffa_partition_info_get(uuid); + + if (ffa_func_id(ret) == FFA_SUCCESS_SMC32) { + if (ret.ret2 != expected_size) { + ERROR("Unexpected number of partitions %ld\n", ret.ret2); + return false; + } + const struct ffa_partition_info *info = + (const struct ffa_partition_info *)(mb->recv); + + for (unsigned int i = 0U; i < expected_size; i++) { + if (info[i].id != expected[i].id) { + ERROR("Wrong ID. Expected %x, got %x\n", + expected[i].id, + info[i].id); + result = false; + } + if (info[i].exec_context != expected[i].exec_context) { + ERROR("Wrong context. Expected %d, got %d\n", + expected[i].exec_context, + info[i].exec_context); + result = false; + } + if (info[i].properties != expected[i].properties) { + ERROR("Wrong properties. Expected %d, got %d\n", + expected[i].properties, + info[i].properties); + result = false; + } + } + } + + ret = ffa_rx_release(); + if (is_ffa_call_error(ret)) { + ERROR("Failed to release RX buffer\n"); + result = false; + } + return result; +} |