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