J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 1 | /* |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2024, Arm Limited. All rights reserved. |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 6 | #include "ffa_helpers.h" |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 7 | #include <assert.h> |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 8 | #include <debug.h> |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 9 | #include <errno.h> |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 10 | |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 11 | #include <sp_def.h> |
J-Alves | 8f4a56f | 2020-10-28 10:29:05 +0000 | [diff] [blame] | 12 | #include <ffa_endpoints.h> |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 13 | #include <sp_helpers.h> |
Olivier Deprez | 6967c24 | 2021-04-09 09:24:08 +0200 | [diff] [blame] | 14 | #include <spm_helpers.h> |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 15 | #include <spm_common.h> |
J-Alves | 63cdaa7 | 2020-10-08 17:22:45 +0100 | [diff] [blame] | 16 | #include <lib/libc/string.h> |
J-Alves | 63cdaa7 | 2020-10-08 17:22:45 +0100 | [diff] [blame] | 17 | |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 18 | /* FFA version test helpers */ |
| 19 | #define FFA_MAJOR 1U |
Daniel Boulby | 899dced | 2024-01-12 14:46:54 +0000 | [diff] [blame] | 20 | #define FFA_MINOR 2U |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 21 | |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 22 | static uint32_t spm_version; |
| 23 | |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 24 | static const struct ffa_uuid sp_uuids[] = { |
Kathleen Capella | e8a17a9 | 2024-12-05 18:28:29 -0500 | [diff] [blame^] | 25 | {PRIMARY_UUID}, {SECONDARY_UUID}, {TERTIARY_UUID}, {IVY_UUID}, |
| 26 | {STMM_UUID}, {EL3_SPMD_LP_UUID} |
| 27 | }; |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 28 | |
| 29 | static const struct ffa_partition_info ffa_expected_partition_info[] = { |
| 30 | /* Primary partition info */ |
| 31 | { |
| 32 | .id = SP_ID(1), |
| 33 | .exec_context = PRIMARY_EXEC_CTX_COUNT, |
Kathleen Capella | 7774d6e | 2022-11-23 19:06:21 -0500 | [diff] [blame] | 34 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 35 | FFA_PARTITION_DIRECT_REQ_RECV | |
J-Alves | 4d05dec | 2021-11-02 11:52:27 +0000 | [diff] [blame] | 36 | FFA_PARTITION_DIRECT_REQ_SEND | |
J-Alves | d551d09 | 2024-10-30 11:09:47 +0000 | [diff] [blame] | 37 | FFA_PARTITION_INDIRECT_MSG | |
Daniel Boulby | 8aa994c | 2022-01-05 19:44:30 +0000 | [diff] [blame] | 38 | FFA_PARTITION_NOTIFICATION), |
Jayanth Dodderi Chidanand | d2a6364 | 2023-06-06 09:03:53 +0100 | [diff] [blame] | 39 | .uuid = {PRIMARY_UUID} |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 40 | }, |
| 41 | /* Secondary partition info */ |
| 42 | { |
| 43 | .id = SP_ID(2), |
| 44 | .exec_context = SECONDARY_EXEC_CTX_COUNT, |
Kathleen Capella | 7774d6e | 2022-11-23 19:06:21 -0500 | [diff] [blame] | 45 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 46 | FFA_PARTITION_DIRECT_REQ_RECV | |
J-Alves | 4d05dec | 2021-11-02 11:52:27 +0000 | [diff] [blame] | 47 | FFA_PARTITION_DIRECT_REQ_SEND | |
Daniel Boulby | 8aa994c | 2022-01-05 19:44:30 +0000 | [diff] [blame] | 48 | FFA_PARTITION_NOTIFICATION), |
Jayanth Dodderi Chidanand | d2a6364 | 2023-06-06 09:03:53 +0100 | [diff] [blame] | 49 | .uuid = {SECONDARY_UUID} |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 50 | }, |
| 51 | /* Tertiary partition info */ |
| 52 | { |
| 53 | .id = SP_ID(3), |
| 54 | .exec_context = TERTIARY_EXEC_CTX_COUNT, |
Kathleen Capella | 7774d6e | 2022-11-23 19:06:21 -0500 | [diff] [blame] | 55 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 56 | FFA_PARTITION_DIRECT_REQ_RECV | |
J-Alves | b69c8b4 | 2021-11-04 17:03:41 +0000 | [diff] [blame] | 57 | FFA_PARTITION_DIRECT_REQ_SEND | |
Daniel Boulby | 8aa994c | 2022-01-05 19:44:30 +0000 | [diff] [blame] | 58 | FFA_PARTITION_NOTIFICATION), |
Jayanth Dodderi Chidanand | d2a6364 | 2023-06-06 09:03:53 +0100 | [diff] [blame] | 59 | .uuid = {TERTIARY_UUID} |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 60 | }, |
| 61 | /* Ivy partition info */ |
| 62 | { |
| 63 | .id = SP_ID(4), |
| 64 | .exec_context = IVY_EXEC_CTX_COUNT, |
Kathleen Capella | 7774d6e | 2022-11-23 19:06:21 -0500 | [diff] [blame] | 65 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 66 | FFA_PARTITION_DIRECT_REQ_RECV | |
Daniel Boulby | 8aa994c | 2022-01-05 19:44:30 +0000 | [diff] [blame] | 67 | FFA_PARTITION_DIRECT_REQ_SEND), |
Jayanth Dodderi Chidanand | d2a6364 | 2023-06-06 09:03:53 +0100 | [diff] [blame] | 68 | .uuid = {IVY_UUID} |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 69 | }, |
Kathleen Capella | e8a17a9 | 2024-12-05 18:28:29 -0500 | [diff] [blame^] | 70 | { |
| 71 | .id = SP_ID(5), |
| 72 | .exec_context = 1, |
| 73 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 74 | FFA_PARTITION_DIRECT_REQ_RECV | |
| 75 | FFA_PARTITION_DIRECT_REQ_SEND), |
| 76 | .uuid = {STMM_UUID} |
| 77 | }, |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 78 | /* EL3 SPMD logical partition */ |
| 79 | { |
| 80 | .id = SP_ID(0x7FC0), |
| 81 | .exec_context = EL3_SPMD_LP_EXEC_CTX_COUNT, |
| 82 | .properties = (FFA_PARTITION_AARCH64_EXEC | |
| 83 | FFA_PARTITION_DIRECT_REQ_SEND), |
Jayanth Dodderi Chidanand | d2a6364 | 2023-06-06 09:03:53 +0100 | [diff] [blame] | 84 | .uuid = {EL3_SPMD_LP_UUID} |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 85 | }, |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 86 | }; |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 87 | |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 88 | /* |
| 89 | * Test FFA_FEATURES interface. |
| 90 | */ |
J-Alves | 367154e | 2024-05-13 18:01:02 +0100 | [diff] [blame] | 91 | static void ffa_features_test(bool el1_partition) |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 92 | { |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 93 | const struct ffa_features_test *func_id_targets; |
| 94 | /* Get common features between tftf and cactus. */ |
| 95 | unsigned int test_target_size = |
| 96 | get_ffa_feature_test_target(&func_id_targets); |
J-Alves | f855e9f | 2024-10-30 11:11:47 +0000 | [diff] [blame] | 97 | /* Specific to SPs. */ |
| 98 | struct ffa_features_test feature_id_targets[] = { |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 99 | {"FFA_FEATURE_MEI", FFA_FEATURE_MEI, FFA_SUCCESS_SMC32, 0, |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 100 | FFA_VERSION_1_1}, |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 101 | {"FFA_FEATURE_SRI", FFA_FEATURE_SRI, FFA_ERROR, 0, |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 102 | FFA_VERSION_1_1}, |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 103 | {"FFA_FEATURE_NPI", FFA_FEATURE_NPI, FFA_SUCCESS_SMC32, 0, |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 104 | FFA_VERSION_1_1}, |
J-Alves | f855e9f | 2024-10-30 11:11:47 +0000 | [diff] [blame] | 105 | {"FFA_YIELD_32", FFA_MSG_YIELD, FFA_SUCCESS_SMC32, |
| 106 | FFA_VERSION_1_0}, |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 107 | }; |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 108 | |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 109 | INFO("Test FFA_FEATURES.\n"); |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 110 | ffa_features_test_targets(func_id_targets, test_target_size); |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 111 | |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 112 | /* Features are expected to be different to tftf. */ |
J-Alves | 367154e | 2024-05-13 18:01:02 +0100 | [diff] [blame] | 113 | |
| 114 | /* EL0 partitions don't support NPI. */ |
| 115 | if (!el1_partition) { |
| 116 | feature_id_targets[2].expected_ret = FFA_ERROR; |
| 117 | } |
| 118 | |
J-Alves | 9668ba5 | 2024-05-13 11:49:45 +0100 | [diff] [blame] | 119 | ffa_features_test_targets(feature_id_targets, |
| 120 | ARRAY_SIZE(feature_id_targets)); |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 121 | } |
| 122 | |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 123 | static void ffa_partition_info_wrong_test(void) |
| 124 | { |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 125 | const struct ffa_uuid uuid = { .uuid = {1} }; |
Daniel Boulby | ce386b1 | 2022-03-29 18:36:36 +0100 | [diff] [blame] | 126 | struct ffa_value ret = ffa_partition_info_get(uuid); |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 127 | |
| 128 | VERBOSE("%s: test request wrong UUID.\n", __func__); |
| 129 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 130 | EXPECT(ffa_func_id(ret), FFA_ERROR); |
| 131 | EXPECT(ffa_error_code(ret), FFA_ERROR_INVALID_PARAMETER); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 132 | } |
| 133 | |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 134 | static void ffa_partition_info_get_regs_test(void) |
| 135 | { |
| 136 | struct ffa_value ret = { 0 }; |
| 137 | |
| 138 | VERBOSE("FF-A Partition Info regs interface tests\n"); |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 139 | ret = ffa_version(FFA_VERSION_1_2); |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 140 | uint32_t version = ret.fid; |
| 141 | |
| 142 | if (version == FFA_ERROR_NOT_SUPPORTED) { |
Daniel Boulby | 899dced | 2024-01-12 14:46:54 +0000 | [diff] [blame] | 143 | ERROR("FFA_VERSION 1.2 not supported, skipping" |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 144 | " FFA_PARTITION_INFO_GET_REGS test.\n"); |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | ret = ffa_features(FFA_PARTITION_INFO_GET_REGS_SMC64); |
| 149 | if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) { |
| 150 | ERROR("FFA_PARTITION_INFO_GET_REGS not supported skipping tests.\n"); |
| 151 | return; |
| 152 | } |
| 153 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 154 | EXPECT(ffa_partition_info_regs_helper(sp_uuids[3], |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 155 | &ffa_expected_partition_info[3], 1), true); |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 156 | EXPECT(ffa_partition_info_regs_helper(sp_uuids[2], |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 157 | &ffa_expected_partition_info[2], 1), true); |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 158 | EXPECT(ffa_partition_info_regs_helper(sp_uuids[1], |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 159 | &ffa_expected_partition_info[1], 1), true); |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 160 | EXPECT(ffa_partition_info_regs_helper(sp_uuids[0], |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 161 | &ffa_expected_partition_info[0], 1), true); |
| 162 | |
| 163 | /* |
| 164 | * Check partition information if there is support for SPMD EL3 |
| 165 | * partitions. calling partition_info_get_regs with the SPMD EL3 |
| 166 | * UUID successfully, indicates the presence of it (there is no |
| 167 | * spec defined way to discover presence of el3 spmd logical |
| 168 | * partitions). If the call fails with a not supported error, |
| 169 | * we assume they dont exist and skip further tests to avoid |
| 170 | * failures on platforms without el3 spmd logical partitions. |
| 171 | */ |
Kathleen Capella | e8a17a9 | 2024-12-05 18:28:29 -0500 | [diff] [blame^] | 172 | ret = ffa_partition_info_get_regs(sp_uuids[5], 0, 0); |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 173 | if ((ffa_func_id(ret) == FFA_ERROR) && |
| 174 | ((ffa_error_code(ret) == FFA_ERROR_NOT_SUPPORTED) || |
| 175 | (ffa_error_code(ret) == FFA_ERROR_INVALID_PARAMETER))) { |
| 176 | INFO("Skipping register based EL3 SPMD Logical partition" |
| 177 | " discovery\n"); |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 178 | EXPECT(ffa_partition_info_regs_helper(NULL_UUID, |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 179 | ffa_expected_partition_info, |
| 180 | (ARRAY_SIZE(ffa_expected_partition_info) - 1)), true); |
| 181 | } else { |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 182 | EXPECT(ffa_partition_info_regs_helper(sp_uuids[4], |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 183 | &ffa_expected_partition_info[4], 1), true); |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 184 | EXPECT(ffa_partition_info_regs_helper(NULL_UUID, |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 185 | ffa_expected_partition_info, |
| 186 | ARRAY_SIZE(ffa_expected_partition_info)), true); |
| 187 | } |
| 188 | } |
| 189 | |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 190 | static void ffa_partition_info_get_test(struct mailbox_buffers *mb) |
| 191 | { |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 192 | INFO("Test FFA_PARTITION_INFO_GET.\n"); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 193 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 194 | EXPECT(ffa_partition_info_helper(mb, sp_uuids[2], |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 195 | &ffa_expected_partition_info[2], 1), true); |
Ruari Phipps | d75596a | 2020-07-17 16:41:34 +0100 | [diff] [blame] | 196 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 197 | EXPECT(ffa_partition_info_helper(mb, sp_uuids[1], |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 198 | &ffa_expected_partition_info[1], 1), true); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 199 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 200 | EXPECT(ffa_partition_info_helper(mb, sp_uuids[0], |
Max Shvetsov | 0b7d25f | 2021-03-05 13:46:42 +0000 | [diff] [blame] | 201 | &ffa_expected_partition_info[0], 1), true); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 202 | |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 203 | /* |
| 204 | * TODO: ffa_partition_info_get_regs returns EL3 SPMD LP information |
| 205 | * but partition_info_get does not. Ignore the last entry, that is |
| 206 | * assumed to be the EL3 SPMD LP information. ffa_partition_info_get |
| 207 | * uses the rx/tx buffer and the SPMD does not support the use of |
| 208 | * rx/tx buffer to return SPMD logical partition information. |
| 209 | */ |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 210 | EXPECT(ffa_partition_info_helper(mb, NULL_UUID, |
Varun Wadekar | 5c35482 | 2021-09-27 06:01:09 -0700 | [diff] [blame] | 211 | ffa_expected_partition_info, |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 212 | (ARRAY_SIZE(ffa_expected_partition_info) - 1)), true); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 213 | |
| 214 | ffa_partition_info_wrong_test(); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 215 | } |
| 216 | |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 217 | static void ffa_version_test(void) |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 218 | { |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 219 | struct ffa_value ret = ffa_version(FFA_VERSION_COMPILED); |
Daniel Boulby | ce386b1 | 2022-03-29 18:36:36 +0100 | [diff] [blame] | 220 | |
| 221 | spm_version = (uint32_t)ret.fid; |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 222 | EXPECT(spm_version, FFA_VERSION_COMPILED); |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 223 | |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 224 | bool compatible = ffa_versions_are_compatible(spm_version, FFA_VERSION_COMPILED); |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 225 | |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 226 | INFO("Test FFA_VERSION. Return %u.%u; Compatible: %i\n", |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 227 | ffa_version_get_major(spm_version), |
| 228 | ffa_version_get_minor(spm_version), |
| 229 | (int)compatible); |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 230 | |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 231 | EXPECT((int)compatible, (int)true); |
Max Shvetsov | 57c6ddb | 2020-07-01 14:09:48 +0100 | [diff] [blame] | 232 | } |
| 233 | |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 234 | static void ffa_spm_id_get_test(void) |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 235 | { |
Karl Meakin | 7308b12 | 2024-04-16 14:02:25 +0100 | [diff] [blame] | 236 | if (spm_version >= FFA_VERSION_1_1) { |
Daniel Boulby | ce386b1 | 2022-03-29 18:36:36 +0100 | [diff] [blame] | 237 | struct ffa_value ret = ffa_spm_id_get(); |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 238 | |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 239 | EXPECT(ffa_func_id(ret), FFA_SUCCESS_SMC32); |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 240 | |
| 241 | ffa_id_t spm_id = ffa_endpoint_id(ret); |
| 242 | |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 243 | INFO("Test FFA_SPM_ID_GET. Return: 0x%x\n", spm_id); |
| 244 | |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 245 | /* |
| 246 | * Check the SPMC value given in the fvp_spmc_manifest |
| 247 | * is returned. |
| 248 | */ |
Karl Meakin | c884d6b | 2024-04-16 14:01:10 +0100 | [diff] [blame] | 249 | EXPECT(spm_id, SPMC_ID); |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 250 | } else { |
J-Alves | 2279c1d | 2023-05-05 17:03:28 +0100 | [diff] [blame] | 251 | INFO("FFA_SPM_ID_GET not supported in this version of FF-A." |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 252 | " Test skipped.\n"); |
| 253 | } |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 254 | } |
| 255 | |
J-Alves | 367154e | 2024-05-13 18:01:02 +0100 | [diff] [blame] | 256 | void ffa_tests(struct mailbox_buffers *mb, bool el1_partition) |
Max Shvetsov | 57c6ddb | 2020-07-01 14:09:48 +0100 | [diff] [blame] | 257 | { |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 258 | const char *test_ffa_str = "FF-A setup and discovery"; |
Max Shvetsov | 57c6ddb | 2020-07-01 14:09:48 +0100 | [diff] [blame] | 259 | |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 260 | announce_test_section_start(test_ffa_str); |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 261 | |
J-Alves | 367154e | 2024-05-13 18:01:02 +0100 | [diff] [blame] | 262 | ffa_features_test(el1_partition); |
Max Shvetsov | 57c6ddb | 2020-07-01 14:09:48 +0100 | [diff] [blame] | 263 | ffa_version_test(); |
Daniel Boulby | 198deda | 2021-03-03 11:35:25 +0000 | [diff] [blame] | 264 | ffa_spm_id_get_test(); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame] | 265 | ffa_partition_info_get_test(mb); |
Raghu Krishnamurthy | 9f86452 | 2023-04-23 16:19:10 -0700 | [diff] [blame] | 266 | ffa_partition_info_get_regs_test(); |
Max Shvetsov | 40eb6a2 | 2020-06-08 11:15:30 +0100 | [diff] [blame] | 267 | |
Olivier Deprez | 2661ba5 | 2024-02-19 18:50:53 +0100 | [diff] [blame] | 268 | announce_test_section_end(test_ffa_str); |
J-Alves | 9f6f014 | 2020-06-17 15:37:59 +0100 | [diff] [blame] | 269 | } |