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 | |
Daniel Boulby | b2fb80e | 2021-02-03 15:09:23 +0000 | [diff] [blame] | 23 | ffa_vm_id_t arch_ffa_spmc_id_get(void) |
| 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 | |
| 32 | bool plat_ffa_is_direct_request_valid(struct vcpu *current, |
| 33 | ffa_vm_id_t sender_vm_id, |
| 34 | ffa_vm_id_t receiver_vm_id) |
| 35 | { |
| 36 | (void)current; |
| 37 | (void)sender_vm_id; |
| 38 | (void)receiver_vm_id; |
| 39 | |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | bool plat_ffa_is_direct_response_valid(struct vcpu *current, |
| 44 | ffa_vm_id_t sender_vm_id, |
| 45 | ffa_vm_id_t receiver_vm_id) |
| 46 | { |
| 47 | (void)current; |
| 48 | (void)sender_vm_id; |
| 49 | (void)receiver_vm_id; |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | |
Raghu Krishnamurthy | 62f97a7 | 2021-07-27 02:14:59 -0700 | [diff] [blame] | 54 | bool plat_ffa_run_forward(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx, |
| 55 | struct ffa_value *ret) |
| 56 | { |
| 57 | (void)vm_id; |
| 58 | (void)vcpu_idx; |
| 59 | (void)ret; |
| 60 | |
| 61 | return false; |
| 62 | } |
| 63 | |
Olivier Deprez | 55a189e | 2021-06-09 15:45:27 +0200 | [diff] [blame] | 64 | bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id, |
| 65 | struct ffa_value args, |
| 66 | struct ffa_value *ret) |
| 67 | { |
| 68 | (void)receiver_vm_id; |
| 69 | (void)args; |
| 70 | (void)ret; |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index) |
| 75 | { |
| 76 | return index; |
| 77 | } |
| 78 | |
| 79 | bool plat_ffa_memory_handle_allocated_by_current_world( |
| 80 | ffa_memory_handle_t handle) |
| 81 | { |
| 82 | (void)handle; |
| 83 | return false; |
| 84 | } |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 85 | |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 86 | bool plat_ffa_is_notifications_bind_valid(struct vcpu *current, |
| 87 | ffa_vm_id_t sender_id, |
| 88 | ffa_vm_id_t receiver_id) |
| 89 | { |
| 90 | (void)current; |
| 91 | (void)sender_id; |
| 92 | (void)receiver_id; |
| 93 | return false; |
| 94 | } |
| 95 | |
J-Alves | b15e940 | 2021-09-08 11:44:42 +0100 | [diff] [blame] | 96 | bool plat_ffa_notifications_update_bindings_forward( |
| 97 | ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags, |
| 98 | ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret) |
| 99 | { |
| 100 | (void)ret; |
| 101 | (void)receiver_id; |
| 102 | (void)sender_id; |
| 103 | (void)flags; |
| 104 | (void)bitmap; |
| 105 | (void)is_bind; |
| 106 | (void)ret; |
| 107 | |
| 108 | return false; |
| 109 | } |
| 110 | |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 111 | ffa_partition_properties_t plat_ffa_partition_properties( |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 112 | ffa_vm_id_t vm_id, const struct vm *target) |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 113 | { |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 114 | (void)vm_id; |
Maksims Svecovs | b596eab | 2021-04-27 00:52:27 +0100 | [diff] [blame] | 115 | (void)target; |
| 116 | return 0; |
| 117 | } |
Maksims Svecovs | 9ddf86a | 2021-05-06 17:17:21 +0100 | [diff] [blame] | 118 | |
| 119 | bool plat_ffa_vm_managed_exit_supported(struct vm *vm) |
| 120 | { |
| 121 | (void)vm; |
| 122 | return false; |
| 123 | } |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 124 | |
| 125 | bool plat_ffa_is_notifications_create_valid(struct vcpu *current, |
| 126 | ffa_vm_id_t vm_id) |
| 127 | { |
| 128 | (void)current; |
| 129 | (void)vm_id; |
| 130 | |
| 131 | return false; |
| 132 | } |
| 133 | |
J-Alves | aa79c01 | 2021-07-09 14:29:45 +0100 | [diff] [blame] | 134 | bool plat_ffa_is_notification_set_valid(struct vcpu *current, |
| 135 | ffa_vm_id_t sender_id, |
| 136 | ffa_vm_id_t receiver_id) |
| 137 | { |
| 138 | (void)current; |
| 139 | (void)sender_id; |
| 140 | (void)receiver_id; |
| 141 | return false; |
| 142 | } |
| 143 | |
| 144 | bool plat_ffa_is_notification_get_valid(struct vcpu *current, |
| 145 | ffa_vm_id_t receiver_id) |
| 146 | { |
| 147 | (void)current; |
| 148 | (void)receiver_id; |
| 149 | return false; |
| 150 | } |
| 151 | |
J-Alves | 98ff956 | 2021-09-09 14:39:41 +0100 | [diff] [blame] | 152 | bool plat_ffa_notifications_get_from_sp( |
| 153 | struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id, |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 154 | ffa_notifications_bitmap_t *from_sp, // NOLINT |
| 155 | struct ffa_value *ret) // NOLINT |
J-Alves | 98ff956 | 2021-09-09 14:39:41 +0100 | [diff] [blame] | 156 | { |
| 157 | (void)receiver_locked; |
| 158 | (void)vcpu_id; |
| 159 | (void)from_sp; |
| 160 | (void)ret; |
| 161 | |
| 162 | return false; |
| 163 | } |
| 164 | |
J-Alves | de7bd2f | 2021-09-09 19:54:35 +0100 | [diff] [blame] | 165 | bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id, |
| 166 | ffa_vm_id_t receiver_vm_id, |
| 167 | uint32_t flags, |
| 168 | ffa_notifications_bitmap_t bitmap, |
| 169 | struct ffa_value *ret) |
| 170 | { |
| 171 | (void)sender_vm_id; |
| 172 | (void)receiver_vm_id; |
| 173 | (void)flags; |
| 174 | (void)bitmap; |
| 175 | (void)ret; |
| 176 | |
| 177 | return false; |
| 178 | } |
| 179 | |
J-Alves | a0f317d | 2021-06-09 13:31:59 +0100 | [diff] [blame] | 180 | struct ffa_value plat_ffa_notifications_bitmap_create( |
| 181 | ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count) |
| 182 | { |
| 183 | (void)vm_id; |
| 184 | (void)vcpu_count; |
| 185 | |
| 186 | return ffa_error(FFA_NOT_SUPPORTED); |
| 187 | } |
| 188 | |
| 189 | struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id) |
| 190 | { |
| 191 | (void)vm_id; |
| 192 | |
| 193 | return ffa_error(FFA_NOT_SUPPORTED); |
| 194 | } |
J-Alves | c003a7a | 2021-03-18 13:06:53 +0000 | [diff] [blame] | 195 | |
| 196 | struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id) |
| 197 | { |
| 198 | (void)vm_id; |
| 199 | return (struct vm_locked){.vm = NULL}; |
| 200 | } |
| 201 | |
| 202 | bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id) |
| 203 | { |
| 204 | (void)vm_id; |
| 205 | return false; |
| 206 | } |
J-Alves | c8e8a22 | 2021-06-08 17:33:52 +0100 | [diff] [blame] | 207 | |
J-Alves | fa78209 | 2021-10-13 16:02:16 +0100 | [diff] [blame] | 208 | bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE |
| 209 | uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE |
| 210 | uint32_t *lists_sizes, // NOLINTNEXTLINE |
| 211 | uint32_t *lists_count, const uint32_t ids_count_max) |
J-Alves | c8e8a22 | 2021-06-08 17:33:52 +0100 | [diff] [blame] | 212 | { |
| 213 | (void)ids; |
| 214 | (void)ids_count; |
| 215 | (void)lists_sizes; |
| 216 | (void)lists_count; |
| 217 | (void)ids_count_max; |
| 218 | |
| 219 | return false; |
| 220 | } |
Raghu Krishnamurthy | ea6d25f | 2021-09-14 15:27:06 -0700 | [diff] [blame] | 221 | |
| 222 | bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current) |
| 223 | { |
| 224 | (void)current; |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current) |
| 229 | { |
| 230 | (void)current; |
| 231 | return false; |
| 232 | } |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 233 | |
| 234 | /** |
| 235 | * Check if current VM can resume target VM/SP using FFA_RUN ABI. |
| 236 | */ |
| 237 | bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id, |
Raghu Krishnamurthy | 048d63f | 2021-12-11 12:45:41 -0800 | [diff] [blame^] | 238 | ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret, |
| 239 | struct vcpu **next) |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 240 | { |
| 241 | (void)current; |
| 242 | (void)target_vm_id; |
| 243 | (void)run_ret; |
| 244 | (void)next; |
Raghu Krishnamurthy | 048d63f | 2021-12-11 12:45:41 -0800 | [diff] [blame^] | 245 | (void)vcpu_idx; |
Madhukar Pappireddy | b11e0d1 | 2021-08-02 19:44:35 -0500 | [diff] [blame] | 246 | return true; |
| 247 | } |
J-Alves | ca058c2 | 2021-09-10 14:02:07 +0100 | [diff] [blame] | 248 | |
| 249 | void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE |
| 250 | uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE |
| 251 | uint32_t *lists_sizes, uint32_t *lists_count, |
| 252 | const uint32_t ids_count_max) |
| 253 | { |
| 254 | (void)ids; |
| 255 | (void)ids_count; |
| 256 | (void)lists_sizes; |
| 257 | (void)lists_count; |
| 258 | (void)ids_count_max; |
| 259 | } |
J-Alves | 1339402 | 2021-06-30 13:48:49 +0100 | [diff] [blame] | 260 | |
| 261 | void plat_ffa_sri_state_set(enum plat_ffa_sri_state state) |
| 262 | { |
| 263 | (void)state; |
| 264 | } |
| 265 | |
| 266 | void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu) |
| 267 | { |
| 268 | (void)cpu; |
| 269 | } |
| 270 | |
| 271 | void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu) |
| 272 | { |
| 273 | (void)cpu; |
| 274 | } |
| 275 | |
| 276 | void plat_ffa_sri_init(struct cpu *cpu) |
| 277 | { |
| 278 | (void)cpu; |
| 279 | } |
J-Alves | 7461ef2 | 2021-10-18 17:21:33 +0100 | [diff] [blame] | 280 | |
| 281 | void plat_ffa_inject_notification_pending_interrupt_context_switch( |
| 282 | struct vcpu *next, struct vcpu *current) |
| 283 | { |
| 284 | (void)next; |
| 285 | (void)current; |
| 286 | } |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 287 | |
| 288 | void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE |
| 289 | const struct ffa_uuid *uuid, // NOLINTNEXTLINE |
Daniel Boulby | b46cad1 | 2021-12-13 17:47:21 +0000 | [diff] [blame] | 290 | const uint32_t flags, // NOLINTNEXTLINE |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 291 | struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count) |
| 292 | { |
| 293 | (void)uuid; |
Daniel Boulby | b46cad1 | 2021-12-13 17:47:21 +0000 | [diff] [blame] | 294 | (void)flags; |
Olivier Deprez | e562e54 | 2020-06-11 17:31:54 +0200 | [diff] [blame] | 295 | (void)partitions; |
| 296 | (void)ret_count; |
| 297 | } |