Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 The Hafnium Authors. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
| 7 | */ |
| 8 | |
| 9 | #include "hf/ffa.h" |
| 10 | |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 11 | #include "hf/arch/plat/ffa.h" |
| 12 | |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 13 | #include "hf/ffa_internal.h" |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 14 | #include "hf/vcpu.h" |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 15 | #include "hf/vm.h" |
Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 16 | |
Daniel Boulby | 87b2dc8 | 2021-08-04 14:07:43 +0100 | [diff] [blame] | 17 | struct ffa_value arch_ffa_features(uint32_t function_id) |
| 18 | { |
| 19 | (void)function_id; |
| 20 | return ffa_error(FFA_NOT_SUPPORTED); |
| 21 | } |
| 22 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 23 | ffa_id_t arch_ffa_spmc_id_get(void) |
Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 24 | { |
| 25 | return HF_SPMC_VM_ID; |
| 26 | } |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 27 | |
| 28 | void plat_ffa_log_init(void) |
| 29 | { |
| 30 | } |
| 31 | |
J-Alves | c9227c8 | 2024-04-24 21:00:58 +0100 | [diff] [blame^] | 32 | bool plat_ffa_is_memory_send_valid(ffa_id_t receiver, ffa_id_t sender, |
| 33 | uint32_t share_func, bool multiple_borrower) |
Maksims Svecovs | a3d570c | 2021-12-08 11:16:32 +0000 | [diff] [blame] | 34 | { |
Maksims Svecovs | a3d570c | 2021-12-08 11:16:32 +0000 | [diff] [blame] | 35 | (void)share_func; |
J-Alves | c9227c8 | 2024-04-24 21:00:58 +0100 | [diff] [blame^] | 36 | (void)receiver; |
| 37 | (void)sender; |
| 38 | (void)multiple_borrower; |
Maksims Svecovs | a3d570c | 2021-12-08 11:16:32 +0000 | [diff] [blame] | 39 | |
| 40 | return true; |
| 41 | } |
| 42 | |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 43 | bool plat_ffa_is_direct_request_valid(struct vcpu *current, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 44 | ffa_id_t sender_vm_id, |
| 45 | ffa_id_t receiver_vm_id) |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 46 | { |
| 47 | (void)current; |
| 48 | (void)sender_vm_id; |
| 49 | (void)receiver_vm_id; |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | |
J-Alves | 439ac97 | 2021-11-18 17:32:03 +0000 | [diff] [blame] | 54 | bool plat_ffa_is_direct_request_supported(struct vm *sender_vm, |
Kathleen Capella | 41fea93 | 2023-06-23 17:39:28 -0400 | [diff] [blame] | 55 | struct vm *receiver_vm, uint32_t func) |
J-Alves | 439ac97 | 2021-11-18 17:32:03 +0000 | [diff] [blame] | 56 | { |
| 57 | (void)sender_vm; |
| 58 | (void)receiver_vm; |
Kathleen Capella | 41fea93 | 2023-06-23 17:39:28 -0400 | [diff] [blame] | 59 | (void)func; |
J-Alves | 439ac97 | 2021-11-18 17:32:03 +0000 | [diff] [blame] | 60 | |
| 61 | return false; |
| 62 | } |
| 63 | |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 64 | bool plat_ffa_is_direct_response_valid(struct vcpu *current, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 65 | ffa_id_t sender_vm_id, |
| 66 | ffa_id_t receiver_vm_id) |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 67 | { |
| 68 | (void)current; |
| 69 | (void)sender_vm_id; |
| 70 | (void)receiver_vm_id; |
| 71 | |
| 72 | return true; |
| 73 | } |
| 74 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 75 | bool plat_ffa_run_forward(ffa_id_t vm_id, ffa_vcpu_index_t vcpu_idx, |
Raghu Krishnamurthy | 62f97a7 | 2021-07-27 02:14:59 -0700 | [diff] [blame] | 76 | struct ffa_value *ret) |
| 77 | { |
| 78 | (void)vm_id; |
| 79 | (void)vcpu_idx; |
| 80 | (void)ret; |
| 81 | |
| 82 | return false; |
| 83 | } |
| 84 | |
Federico Recanati | 10bd06c | 2022-02-23 17:32:59 +0100 | [diff] [blame] | 85 | void plat_ffa_vm_destroy(struct vm_locked to_destroy_locked) |
| 86 | { |
| 87 | (void)to_destroy_locked; |
| 88 | } |
| 89 | |
J-Alves | 7007993 | 2022-12-07 17:32:20 +0000 | [diff] [blame] | 90 | void plat_ffa_rxtx_unmap_forward(struct vm_locked vm_locked) |
Federico Recanati | 8da9e33 | 2022-02-10 11:00:17 +0100 | [diff] [blame] | 91 | { |
J-Alves | 7007993 | 2022-12-07 17:32:20 +0000 | [diff] [blame] | 92 | (void)vm_locked; |
Federico Recanati | 8da9e33 | 2022-02-10 11:00:17 +0100 | [diff] [blame] | 93 | } |
| 94 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 95 | bool plat_ffa_direct_request_forward(ffa_id_t receiver_vm_id, |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 96 | struct ffa_value args, |
| 97 | struct ffa_value *ret) |
| 98 | { |
| 99 | (void)receiver_vm_id; |
| 100 | (void)args; |
| 101 | (void)ret; |
| 102 | return false; |
| 103 | } |
| 104 | |
Federico Recanati | 7bef0b9 | 2022-03-17 14:56:22 +0100 | [diff] [blame] | 105 | bool plat_ffa_rx_release_forward(struct vm_locked vm_locked, |
| 106 | struct ffa_value *ret) |
| 107 | { |
| 108 | (void)vm_locked; |
| 109 | (void)ret; |
| 110 | |
| 111 | return false; |
| 112 | } |
| 113 | |
Federico Recanati | 644f046 | 2022-03-17 12:04:00 +0100 | [diff] [blame] | 114 | bool plat_ffa_acquire_receiver_rx(struct vm_locked to_locked, |
| 115 | struct ffa_value *ret) |
| 116 | { |
| 117 | (void)to_locked; |
| 118 | (void)ret; |
| 119 | |
| 120 | return false; |
| 121 | } |
| 122 | |
Federico Recanati | 25053ee | 2022-03-14 15:01:53 +0100 | [diff] [blame] | 123 | bool plat_ffa_is_indirect_msg_supported(struct vm_locked sender_locked, |
| 124 | struct vm_locked receiver_locked) |
| 125 | { |
| 126 | (void)sender_locked; |
| 127 | (void)receiver_locked; |
| 128 | |
| 129 | return false; |
| 130 | } |
| 131 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 132 | bool plat_ffa_msg_send2_forward(ffa_id_t receiver_vm_id, ffa_id_t sender_vm_id, |
| 133 | struct ffa_value *ret) |
Federico Recanati | 25053ee | 2022-03-14 15:01:53 +0100 | [diff] [blame] | 134 | { |
| 135 | (void)receiver_vm_id; |
| 136 | (void)sender_vm_id; |
| 137 | (void)ret; |
| 138 | |
| 139 | return false; |
| 140 | } |
| 141 | |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 142 | ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index) |
| 143 | { |
| 144 | return index; |
| 145 | } |
| 146 | |
| 147 | bool plat_ffa_memory_handle_allocated_by_current_world( |
| 148 | ffa_memory_handle_t handle) |
| 149 | { |
| 150 | (void)handle; |
| 151 | return false; |
| 152 | } |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 153 | |
J-Alves | 7db3200 | 2021-12-14 14:44:50 +0000 | [diff] [blame] | 154 | uint32_t plat_ffa_other_world_mode(void) |
| 155 | { |
| 156 | return 0U; |
| 157 | } |
| 158 | |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 159 | bool plat_ffa_is_notifications_bind_valid(struct vcpu *current, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 160 | ffa_id_t sender_id, |
| 161 | ffa_id_t receiver_id) |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 162 | { |
| 163 | (void)current; |
| 164 | (void)sender_id; |
| 165 | (void)receiver_id; |
| 166 | return false; |
| 167 | } |
| 168 | |
J-Alves | b15e940 | 2021-09-08 11:44:42 +0100 | [diff] [blame] | 169 | bool plat_ffa_notifications_update_bindings_forward( |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 170 | ffa_id_t receiver_id, ffa_id_t sender_id, uint32_t flags, |
J-Alves | b15e940 | 2021-09-08 11:44:42 +0100 | [diff] [blame] | 171 | ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret) |
| 172 | { |
| 173 | (void)ret; |
| 174 | (void)receiver_id; |
| 175 | (void)sender_id; |
| 176 | (void)flags; |
| 177 | (void)bitmap; |
| 178 | (void)is_bind; |
| 179 | (void)ret; |
| 180 | |
| 181 | return false; |
| 182 | } |
| 183 | |
Federico Recanati | 8d8b1cf | 2022-04-14 13:16:00 +0200 | [diff] [blame] | 184 | void plat_ffa_rxtx_map_forward(struct vm_locked vm_locked) |
| 185 | { |
| 186 | (void)vm_locked; |
| 187 | } |
| 188 | |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 189 | ffa_partition_properties_t plat_ffa_partition_properties( |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 190 | ffa_id_t vm_id, const struct vm *target) |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 191 | { |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 192 | (void)vm_id; |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 193 | (void)target; |
| 194 | return 0; |
| 195 | } |
Maksims Svecovs | 9ddf86a | 2021-05-06 17:17:21 +0100 | [diff] [blame] | 196 | |
| 197 | bool plat_ffa_vm_managed_exit_supported(struct vm *vm) |
| 198 | { |
| 199 | (void)vm; |
| 200 | return false; |
| 201 | } |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 202 | |
J-Alves | 7ccaccf | 2024-02-01 14:25:23 +0000 | [diff] [blame] | 203 | /** |
| 204 | * Check validity of the calls: |
| 205 | * FFA_NOTIFICATION_BITMAP_CREATE/FFA_NOTIFICATION_BITMAP_DESTROY. |
| 206 | */ |
| 207 | struct ffa_value plat_ffa_is_notifications_bitmap_access_valid( |
| 208 | struct vcpu *current, ffa_id_t vm_id) |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 209 | { |
J-Alves | 7ccaccf | 2024-02-01 14:25:23 +0000 | [diff] [blame] | 210 | /* |
| 211 | * Call should only be used by the Hypervisor, so any attempt of |
| 212 | * invocation from NWd FF-A endpoints should fail. |
| 213 | */ |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 214 | (void)current; |
| 215 | (void)vm_id; |
| 216 | |
J-Alves | 7ccaccf | 2024-02-01 14:25:23 +0000 | [diff] [blame] | 217 | return ffa_error(FFA_NOT_SUPPORTED); |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 218 | } |
| 219 | |
J-Alves | aa79c01 | 2021-07-09 14:29:45 +0100 | [diff] [blame] | 220 | bool plat_ffa_is_notification_set_valid(struct vcpu *current, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 221 | ffa_id_t sender_id, |
| 222 | ffa_id_t receiver_id) |
J-Alves | aa79c01 | 2021-07-09 14:29:45 +0100 | [diff] [blame] | 223 | { |
| 224 | (void)current; |
| 225 | (void)sender_id; |
| 226 | (void)receiver_id; |
| 227 | return false; |
| 228 | } |
| 229 | |
| 230 | bool plat_ffa_is_notification_get_valid(struct vcpu *current, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 231 | ffa_id_t receiver_id, uint32_t flags) |
J-Alves | aa79c01 | 2021-07-09 14:29:45 +0100 | [diff] [blame] | 232 | { |
J-Alves | fc95a30 | 2022-04-22 14:18:23 +0100 | [diff] [blame] | 233 | (void)flags; |
J-Alves | aa79c01 | 2021-07-09 14:29:45 +0100 | [diff] [blame] | 234 | (void)current; |
| 235 | (void)receiver_id; |
| 236 | return false; |
| 237 | } |
| 238 | |
J-Alves | 98ff956 | 2021-09-09 14:39:41 +0100 | [diff] [blame] | 239 | bool plat_ffa_notifications_get_from_sp( |
| 240 | struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id, |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 241 | ffa_notifications_bitmap_t *from_sp, // NOLINT |
| 242 | struct ffa_value *ret) // NOLINT |
J-Alves | 98ff956 | 2021-09-09 14:39:41 +0100 | [diff] [blame] | 243 | { |
| 244 | (void)receiver_locked; |
| 245 | (void)vcpu_id; |
| 246 | (void)from_sp; |
| 247 | (void)ret; |
| 248 | |
| 249 | return false; |
| 250 | } |
| 251 | |
J-Alves | d605a09 | 2022-03-28 14:20:48 +0100 | [diff] [blame] | 252 | bool plat_ffa_notifications_get_framework_notifications( |
| 253 | struct vm_locked receiver_locked, |
| 254 | ffa_notifications_bitmap_t *from_fwk, // NOLINT |
| 255 | uint32_t flags, ffa_vcpu_index_t vcpu_id, struct ffa_value *ret) |
| 256 | { |
| 257 | (void)receiver_locked; |
| 258 | (void)from_fwk; |
| 259 | (void)flags; |
| 260 | (void)vcpu_id; |
| 261 | (void)ret; |
| 262 | |
| 263 | return false; |
| 264 | } |
| 265 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 266 | bool plat_ffa_notification_set_forward(ffa_id_t sender_vm_id, |
| 267 | ffa_id_t receiver_vm_id, uint32_t flags, |
J-Alves | de7bd2f | 2021-09-09 19:54:35 +0100 | [diff] [blame] | 268 | ffa_notifications_bitmap_t bitmap, |
| 269 | struct ffa_value *ret) |
| 270 | { |
| 271 | (void)sender_vm_id; |
| 272 | (void)receiver_vm_id; |
| 273 | (void)flags; |
| 274 | (void)bitmap; |
| 275 | (void)ret; |
| 276 | |
| 277 | return false; |
| 278 | } |
| 279 | |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 280 | struct ffa_value plat_ffa_notifications_bitmap_create( |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 281 | ffa_id_t vm_id, ffa_vcpu_count_t vcpu_count) |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 282 | { |
| 283 | (void)vm_id; |
| 284 | (void)vcpu_count; |
| 285 | |
| 286 | return ffa_error(FFA_NOT_SUPPORTED); |
| 287 | } |
| 288 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 289 | struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_id_t vm_id) |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 290 | { |
| 291 | (void)vm_id; |
| 292 | |
| 293 | return ffa_error(FFA_NOT_SUPPORTED); |
| 294 | } |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 295 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 296 | struct vm_locked plat_ffa_vm_find_locked(ffa_id_t vm_id) |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 297 | { |
| 298 | (void)vm_id; |
| 299 | return (struct vm_locked){.vm = NULL}; |
| 300 | } |
| 301 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 302 | struct vm_locked plat_ffa_vm_find_locked_create(ffa_id_t vm_id) |
Federico Recanati | 8d8b1cf | 2022-04-14 13:16:00 +0200 | [diff] [blame] | 303 | { |
| 304 | (void)vm_id; |
| 305 | return (struct vm_locked){.vm = NULL}; |
| 306 | } |
| 307 | |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 308 | bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE |
| 309 | uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE |
| 310 | uint32_t *lists_sizes, // NOLINTNEXTLINE |
| 311 | uint32_t *lists_count, const uint32_t ids_count_max) |
J-Alves | c8e8a22 | 2021-06-08 17:33:52 +0100 | [diff] [blame] | 312 | { |
| 313 | (void)ids; |
| 314 | (void)ids_count; |
| 315 | (void)lists_sizes; |
| 316 | (void)lists_count; |
| 317 | (void)ids_count_max; |
| 318 | |
| 319 | return false; |
| 320 | } |
Raghu Krishnamurthy | ea6d25f | 2021-09-14 15:27:06 -0700 | [diff] [blame] | 321 | |
| 322 | bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current) |
| 323 | { |
| 324 | (void)current; |
| 325 | return false; |
| 326 | } |
| 327 | |
| 328 | bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current) |
| 329 | { |
| 330 | (void)current; |
| 331 | return false; |
| 332 | } |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 333 | |
| 334 | /** |
| 335 | * Check if current VM can resume target VM/SP using FFA_RUN ABI. |
| 336 | */ |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 337 | bool plat_ffa_run_checks(struct vcpu_locked current_locked, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 338 | ffa_id_t target_vm_id, ffa_vcpu_index_t vcpu_idx, |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 339 | struct ffa_value *run_ret, struct vcpu **next) |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 340 | { |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 341 | (void)current_locked; |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 342 | (void)target_vm_id; |
| 343 | (void)run_ret; |
| 344 | (void)next; |
Raghu Krishnamurthy | 048d63f | 2021-12-11 12:45:41 -0800 | [diff] [blame] | 345 | (void)vcpu_idx; |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 346 | return true; |
| 347 | } |
J-Alves | ca058c2 | 2021-09-10 14:02:07 +0100 | [diff] [blame] | 348 | |
| 349 | void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE |
| 350 | uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE |
| 351 | uint32_t *lists_sizes, uint32_t *lists_count, |
| 352 | const uint32_t ids_count_max) |
| 353 | { |
| 354 | (void)ids; |
| 355 | (void)ids_count; |
| 356 | (void)lists_sizes; |
| 357 | (void)lists_count; |
| 358 | (void)ids_count_max; |
| 359 | } |
J-Alves | 1339402 | 2021-06-30 13:48:49 +0100 | [diff] [blame] | 360 | |
| 361 | void plat_ffa_sri_state_set(enum plat_ffa_sri_state state) |
| 362 | { |
| 363 | (void)state; |
| 364 | } |
| 365 | |
| 366 | void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu) |
| 367 | { |
| 368 | (void)cpu; |
| 369 | } |
| 370 | |
| 371 | void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu) |
| 372 | { |
| 373 | (void)cpu; |
| 374 | } |
| 375 | |
J-Alves | 6e2abc6 | 2021-12-02 14:58:56 +0000 | [diff] [blame] | 376 | bool plat_ffa_inject_notification_pending_interrupt( |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 377 | struct vcpu_locked target_locked, struct vcpu_locked current_locked, |
J-Alves | 6e2abc6 | 2021-12-02 14:58:56 +0000 | [diff] [blame] | 378 | struct vm_locked receiver_locked) |
J-Alves | 7461ef2 | 2021-10-18 17:21:33 +0100 | [diff] [blame] | 379 | { |
J-Alves | 6e2abc6 | 2021-12-02 14:58:56 +0000 | [diff] [blame] | 380 | (void)target_locked; |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 381 | (void)current_locked; |
J-Alves | 6e2abc6 | 2021-12-02 14:58:56 +0000 | [diff] [blame] | 382 | (void)receiver_locked; |
| 383 | |
| 384 | return false; |
J-Alves | 7461ef2 | 2021-10-18 17:21:33 +0100 | [diff] [blame] | 385 | } |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 386 | |
Raghu Krishnamurthy | ef432cb | 2022-12-29 06:56:32 -0800 | [diff] [blame] | 387 | bool plat_ffa_partition_info_get_regs_forward( // NOLINTNEXTLINE |
| 388 | const struct ffa_uuid *uuid, |
| 389 | const uint16_t start_index, // NOLINTNEXTLINE |
| 390 | const uint16_t tag, |
| 391 | struct ffa_partition_info *partitions, // NOLINTNEXTLINE |
| 392 | uint16_t partitions_len, ffa_vm_count_t *ret_count) |
| 393 | { |
| 394 | (void)uuid; |
| 395 | (void)start_index; |
| 396 | (void)tag; |
| 397 | (void)partitions; |
| 398 | (void)partitions_len; |
| 399 | (void)ret_count; |
| 400 | return true; |
| 401 | } |
| 402 | |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 403 | void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE |
| 404 | const struct ffa_uuid *uuid, // NOLINTNEXTLINE |
Daniel Boulby | b46cad1 | 2021-12-13 17:47:21 +0000 | [diff] [blame] | 405 | const uint32_t flags, // NOLINTNEXTLINE |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 406 | struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count) |
| 407 | { |
| 408 | (void)uuid; |
Daniel Boulby | b46cad1 | 2021-12-13 17:47:21 +0000 | [diff] [blame] | 409 | (void)flags; |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 410 | (void)partitions; |
| 411 | (void)ret_count; |
| 412 | } |
Olivier Deprez | d614d32 | 2021-06-18 15:21:00 +0200 | [diff] [blame] | 413 | |
| 414 | bool plat_ffa_is_secondary_ep_register_supported(void) |
| 415 | { |
| 416 | return false; |
| 417 | } |
Madhukar Pappireddy | dd88320 | 2022-10-24 16:49:28 -0500 | [diff] [blame] | 418 | |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 419 | struct ffa_value plat_ffa_msg_wait_prepare(struct vcpu_locked current_locked, |
Madhukar Pappireddy | dd88320 | 2022-10-24 16:49:28 -0500 | [diff] [blame] | 420 | struct vcpu **next) |
Madhukar Pappireddy | 5522c67 | 2021-12-17 16:35:51 -0600 | [diff] [blame] | 421 | { |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 422 | (void)current_locked; |
Madhukar Pappireddy | 5522c67 | 2021-12-17 16:35:51 -0600 | [diff] [blame] | 423 | (void)next; |
Madhukar Pappireddy | 5522c67 | 2021-12-17 16:35:51 -0600 | [diff] [blame] | 424 | |
Madhukar Pappireddy | dd88320 | 2022-10-24 16:49:28 -0500 | [diff] [blame] | 425 | return (struct ffa_value){.func = FFA_INTERRUPT_32}; |
Madhukar Pappireddy | 5522c67 | 2021-12-17 16:35:51 -0600 | [diff] [blame] | 426 | } |
Madhukar Pappireddy | 0ea239a | 2022-06-21 17:26:57 -0500 | [diff] [blame] | 427 | |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 428 | bool plat_ffa_check_runtime_state_transition(struct vcpu_locked current_locked, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 429 | ffa_id_t vm_id, |
| 430 | ffa_id_t receiver_vm_id, |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 431 | struct vcpu_locked receiver_locked, |
Madhukar Pappireddy | 0ea239a | 2022-06-21 17:26:57 -0500 | [diff] [blame] | 432 | uint32_t func, // NOLINTNEXTLINE |
| 433 | enum vcpu_state *next_state) |
| 434 | { |
| 435 | /* Perform state transition checks only for Secure Partitions. */ |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 436 | (void)current_locked; |
Madhukar Pappireddy | 0ea239a | 2022-06-21 17:26:57 -0500 | [diff] [blame] | 437 | (void)vm_id; |
| 438 | (void)receiver_vm_id; |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 439 | (void)receiver_locked; |
Madhukar Pappireddy | 0ea239a | 2022-06-21 17:26:57 -0500 | [diff] [blame] | 440 | (void)func; |
| 441 | (void)next_state; |
| 442 | |
| 443 | return true; |
| 444 | } |
Madhukar Pappireddy | 49fe670 | 2022-06-21 17:52:23 -0500 | [diff] [blame] | 445 | |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 446 | void plat_ffa_init_schedule_mode_ffa_run(struct vcpu_locked current_locked, |
Madhukar Pappireddy | 1480fce | 2022-06-21 18:09:25 -0500 | [diff] [blame] | 447 | struct vcpu_locked target_locked) |
| 448 | { |
| 449 | /* Scheduling mode not supported in the Hypervisor/VMs. */ |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 450 | (void)current_locked; |
Madhukar Pappireddy | 1480fce | 2022-06-21 18:09:25 -0500 | [diff] [blame] | 451 | (void)target_locked; |
| 452 | } |
| 453 | |
Madhukar Pappireddy | 49fe670 | 2022-06-21 17:52:23 -0500 | [diff] [blame] | 454 | void plat_ffa_wind_call_chain_ffa_direct_req( |
| 455 | struct vcpu_locked current_locked, |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 456 | struct vcpu_locked receiver_vcpu_locked, ffa_id_t sender_vm_id) |
Madhukar Pappireddy | 49fe670 | 2022-06-21 17:52:23 -0500 | [diff] [blame] | 457 | { |
| 458 | /* Calls chains not supported in the Hypervisor/VMs. */ |
| 459 | (void)current_locked; |
| 460 | (void)receiver_vcpu_locked; |
Raghu Krishnamurthy | a9ccf12 | 2023-03-27 20:42:01 -0700 | [diff] [blame] | 461 | (void)sender_vm_id; |
Madhukar Pappireddy | 49fe670 | 2022-06-21 17:52:23 -0500 | [diff] [blame] | 462 | } |
Madhukar Pappireddy | c0fb87e | 2022-06-21 17:59:15 -0500 | [diff] [blame] | 463 | |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 464 | void plat_ffa_unwind_call_chain_ffa_direct_resp( |
| 465 | struct vcpu_locked current_locked, struct vcpu_locked next_locked) |
Madhukar Pappireddy | c0fb87e | 2022-06-21 17:59:15 -0500 | [diff] [blame] | 466 | { |
| 467 | /* Calls chains not supported in the Hypervisor/VMs. */ |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 468 | (void)current_locked; |
| 469 | (void)next_locked; |
Madhukar Pappireddy | c0fb87e | 2022-06-21 17:59:15 -0500 | [diff] [blame] | 470 | } |
Madhukar Pappireddy | 046dad0 | 2022-06-21 18:43:33 -0500 | [diff] [blame] | 471 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 472 | bool plat_ffa_is_spmd_lp_id(ffa_id_t vm_id) |
Raghu Krishnamurthy | a9ccf12 | 2023-03-27 20:42:01 -0700 | [diff] [blame] | 473 | { |
| 474 | (void)vm_id; |
| 475 | return false; |
| 476 | } |
| 477 | |
Madhukar Pappireddy | 2f76e49 | 2022-09-06 15:21:59 -0500 | [diff] [blame] | 478 | bool plat_ffa_intercept_direct_response(struct vcpu_locked current_locked, |
| 479 | struct vcpu **next, |
| 480 | struct ffa_value to_ret, |
| 481 | struct ffa_value *signal_interrupt) |
| 482 | { |
| 483 | /* |
| 484 | * Only applicable to SPMC as it signals virtual secure interrupt to |
| 485 | * S-EL0 partitions. |
| 486 | */ |
| 487 | (void)current_locked; |
| 488 | (void)next; |
| 489 | (void)to_ret; |
| 490 | (void)signal_interrupt; |
| 491 | |
| 492 | return false; |
| 493 | } |
| 494 | |
Madhukar Pappireddy | 486360d | 2022-09-06 15:32:24 -0500 | [diff] [blame] | 495 | void plat_ffa_enable_virtual_interrupts(struct vcpu_locked current_locked, |
| 496 | struct vm_locked vm_locked) |
Madhukar Pappireddy | 046dad0 | 2022-06-21 18:43:33 -0500 | [diff] [blame] | 497 | { |
| 498 | (void)current_locked; |
Madhukar Pappireddy | 486360d | 2022-09-06 15:32:24 -0500 | [diff] [blame] | 499 | (void)vm_locked; |
Madhukar Pappireddy | 046dad0 | 2022-06-21 18:43:33 -0500 | [diff] [blame] | 500 | } |
J-Alves | 6665225 | 2022-07-06 09:49:51 +0100 | [diff] [blame] | 501 | |
| 502 | struct ffa_value plat_ffa_other_world_mem_send( |
| 503 | struct vm *from, uint32_t share_func, |
| 504 | struct ffa_memory_region **memory_region, uint32_t length, |
| 505 | uint32_t fragment_length, struct mpool *page_pool) |
| 506 | { |
| 507 | (void)from; |
| 508 | (void)memory_region; |
| 509 | (void)length; |
| 510 | (void)fragment_length; |
| 511 | (void)page_pool; |
| 512 | (void)share_func; |
| 513 | |
| 514 | return (struct ffa_value){0}; |
| 515 | } |
J-Alves | fc19b37 | 2022-07-06 12:17:35 +0100 | [diff] [blame] | 516 | |
| 517 | struct ffa_value plat_ffa_other_world_mem_reclaim( |
| 518 | struct vm *to, ffa_memory_handle_t handle, |
| 519 | ffa_memory_region_flags_t flags, struct mpool *page_pool) |
| 520 | { |
| 521 | (void)handle; |
| 522 | (void)flags; |
| 523 | (void)page_pool; |
| 524 | (void)to; |
| 525 | |
| 526 | return ffa_error(FFA_INVALID_PARAMETERS); |
| 527 | } |
J-Alves | b5084cf | 2022-07-06 14:20:12 +0100 | [diff] [blame] | 528 | |
J-Alves | fdd2927 | 2022-07-19 13:16:31 +0100 | [diff] [blame] | 529 | struct ffa_value plat_ffa_other_world_mem_send_continue( |
| 530 | struct vm *from, void *fragment, uint32_t fragment_length, |
| 531 | ffa_memory_handle_t handle, struct mpool *page_pool) |
| 532 | { |
| 533 | (void)from; |
| 534 | (void)fragment; |
| 535 | (void)fragment_length; |
| 536 | (void)handle; |
| 537 | (void)page_pool; |
| 538 | |
| 539 | return ffa_error(FFA_INVALID_PARAMETERS); |
| 540 | } |
J-Alves | 27b7196 | 2022-12-12 15:29:58 +0000 | [diff] [blame] | 541 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 542 | struct ffa_value plat_ffa_msg_send(ffa_id_t sender_vm_id, |
| 543 | ffa_id_t receiver_vm_id, uint32_t size, |
J-Alves | 27b7196 | 2022-12-12 15:29:58 +0000 | [diff] [blame] | 544 | struct vcpu *current, struct vcpu **next) |
| 545 | { |
| 546 | (void)sender_vm_id; |
| 547 | (void)receiver_vm_id; |
| 548 | (void)size; |
| 549 | (void)current; |
| 550 | (void)next; |
| 551 | |
| 552 | return ffa_error(FFA_NOT_SUPPORTED); |
| 553 | } |
Madhukar Pappireddy | 1f2f213 | 2023-02-14 17:48:44 -0600 | [diff] [blame] | 554 | |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 555 | struct ffa_value plat_ffa_yield_prepare(struct vcpu_locked current_locked, |
Madhukar Pappireddy | 184501c | 2023-05-23 17:24:06 -0500 | [diff] [blame] | 556 | struct vcpu **next, |
| 557 | uint32_t timeout_low, |
| 558 | uint32_t timeout_high) |
Madhukar Pappireddy | 1f2f213 | 2023-02-14 17:48:44 -0600 | [diff] [blame] | 559 | { |
Madhukar Pappireddy | bd10e57 | 2023-03-06 16:39:49 -0600 | [diff] [blame] | 560 | (void)current_locked; |
Madhukar Pappireddy | b3fb871 | 2023-05-23 17:10:34 -0500 | [diff] [blame] | 561 | (void)next; |
Madhukar Pappireddy | 184501c | 2023-05-23 17:24:06 -0500 | [diff] [blame] | 562 | (void)timeout_low; |
| 563 | (void)timeout_high; |
Madhukar Pappireddy | b3fb871 | 2023-05-23 17:10:34 -0500 | [diff] [blame] | 564 | |
| 565 | return ffa_error(FFA_NOT_SUPPORTED); |
Madhukar Pappireddy | 1f2f213 | 2023-02-14 17:48:44 -0600 | [diff] [blame] | 566 | } |
Olivier Deprez | d9d409f | 2023-03-17 11:47:57 +0100 | [diff] [blame] | 567 | |
| 568 | bool arch_vm_init_mm(struct vm *vm, struct mpool *ppool) |
| 569 | { |
| 570 | (void)vm; |
| 571 | (void)ppool; |
| 572 | |
| 573 | return true; |
| 574 | } |
| 575 | |
Madhukar Pappireddy | 070f49e | 2024-01-12 13:02:27 -0600 | [diff] [blame] | 576 | bool arch_vm_iommu_init_mm(struct vm *vm, struct mpool *ppool) |
| 577 | { |
| 578 | (void)vm; |
| 579 | (void)ppool; |
| 580 | |
| 581 | return true; |
| 582 | } |
| 583 | |
Olivier Deprez | d9d409f | 2023-03-17 11:47:57 +0100 | [diff] [blame] | 584 | bool arch_vm_identity_prepare(struct vm_locked vm_locked, paddr_t begin, |
| 585 | paddr_t end, uint32_t mode, struct mpool *ppool) |
| 586 | { |
| 587 | (void)vm_locked; |
| 588 | (void)begin; |
| 589 | (void)end; |
| 590 | (void)mode; |
| 591 | (void)ppool; |
| 592 | |
| 593 | return true; |
| 594 | } |
| 595 | |
| 596 | void arch_vm_identity_commit(struct vm_locked vm_locked, paddr_t begin, |
| 597 | paddr_t end, uint32_t mode, struct mpool *ppool, |
| 598 | ipaddr_t *ipa) |
| 599 | { |
| 600 | (void)vm_locked; |
| 601 | (void)begin; |
| 602 | (void)end; |
| 603 | (void)mode; |
| 604 | (void)ppool; |
| 605 | (void)ipa; |
| 606 | } |
| 607 | |
| 608 | bool arch_vm_unmap(struct vm_locked vm_locked, paddr_t begin, paddr_t end, |
| 609 | struct mpool *ppool) |
| 610 | { |
| 611 | (void)vm_locked; |
| 612 | (void)begin; |
| 613 | (void)end; |
| 614 | (void)ppool; |
| 615 | |
| 616 | return true; |
| 617 | } |
| 618 | |
| 619 | void arch_vm_ptable_defrag(struct vm_locked vm_locked, struct mpool *ppool) |
| 620 | { |
| 621 | (void)vm_locked; |
| 622 | (void)ppool; |
| 623 | } |
| 624 | |
| 625 | bool arch_vm_mem_get_mode(struct vm_locked vm_locked, ipaddr_t begin, |
| 626 | ipaddr_t end, uint32_t *mode) // NOLINT |
| 627 | { |
| 628 | (void)vm_locked; |
| 629 | (void)begin; |
| 630 | (void)end; |
| 631 | (void)mode; |
| 632 | |
| 633 | return true; |
| 634 | } |
Olivier Deprez | 878bd5b | 2021-04-15 19:05:10 +0200 | [diff] [blame] | 635 | |
| 636 | ffa_memory_attributes_t plat_ffa_memory_security_mode( |
| 637 | ffa_memory_attributes_t attributes, uint32_t mode) |
| 638 | { |
| 639 | (void)mode; |
| 640 | |
| 641 | return attributes; |
| 642 | } |
Kathleen Capella | 6ab0513 | 2023-05-10 12:27:35 -0400 | [diff] [blame] | 643 | |
| 644 | struct ffa_value plat_ffa_error_32(struct vcpu *current, struct vcpu **next, |
Karl Meakin | 1064a9c | 2024-06-04 17:20:43 +0100 | [diff] [blame] | 645 | enum ffa_error error_code) |
Kathleen Capella | 6ab0513 | 2023-05-10 12:27:35 -0400 | [diff] [blame] | 646 | { |
| 647 | (void)current; |
| 648 | (void)next; |
| 649 | (void)error_code; |
J-Alves | 2ced167 | 2022-12-12 14:35:38 +0000 | [diff] [blame] | 650 | |
| 651 | return ffa_error(FFA_NOT_SUPPORTED); |
| 652 | } |
| 653 | |
J-Alves | 19e20cf | 2023-08-02 12:48:55 +0100 | [diff] [blame] | 654 | int64_t plat_ffa_mailbox_waiter_get(ffa_id_t vm_id, const struct vcpu *current) |
J-Alves | 2ced167 | 2022-12-12 14:35:38 +0000 | [diff] [blame] | 655 | { |
J-Alves | bc7ab4f | 2022-12-13 12:09:25 +0000 | [diff] [blame] | 656 | (void)vm_id; |
| 657 | (void)current; |
J-Alves | 2ced167 | 2022-12-12 14:35:38 +0000 | [diff] [blame] | 658 | |
J-Alves | bc7ab4f | 2022-12-13 12:09:25 +0000 | [diff] [blame] | 659 | return -1; |
| 660 | } |
| 661 | |
| 662 | int64_t plat_ffa_mailbox_writable_get(const struct vcpu *current) |
| 663 | { |
| 664 | (void)current; |
| 665 | |
| 666 | return -1; |
Kathleen Capella | 6ab0513 | 2023-05-10 12:27:35 -0400 | [diff] [blame] | 667 | } |
Raghu Krishnamurthy | e74d653 | 2023-06-07 12:21:54 -0700 | [diff] [blame] | 668 | |
| 669 | bool plat_ffa_partition_info_get_regs_forward_allowed(void) |
| 670 | { |
| 671 | return false; |
| 672 | } |
Madhukar Pappireddy | 9e09d7a | 2023-08-08 14:53:49 -0500 | [diff] [blame] | 673 | |
| 674 | void plat_ffa_free_vm_resources(struct vm_locked vm_locked) |
| 675 | { |
| 676 | (void)vm_locked; |
| 677 | } |
Madhukar Pappireddy | 0e57d3d | 2023-10-11 15:49:05 -0500 | [diff] [blame] | 678 | |
| 679 | bool arch_vm_iommu_mm_identity_map(struct vm_locked vm_locked, paddr_t begin, |
| 680 | paddr_t end, uint32_t mode, |
| 681 | struct mpool *ppool, ipaddr_t *ipa, |
| 682 | struct dma_device_properties *dma_prop) |
| 683 | { |
| 684 | (void)vm_locked; |
| 685 | (void)begin; |
| 686 | (void)end; |
| 687 | (void)mode; |
| 688 | (void)ppool; |
| 689 | (void)ipa; |
| 690 | (void)dma_prop; |
| 691 | |
| 692 | return true; |
| 693 | } |