blob: 2537dc06d9d0181e56d6a9ced39b6e1b694e0baf [file] [log] [blame]
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +00001/*
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-Alvesfa782092021-10-13 16:02:16 +010011#include "hf/arch/plat/ffa.h"
12
J-Alvesa0f317d2021-06-09 13:31:59 +010013#include "hf/ffa_internal.h"
Olivier Deprez55a189e2021-06-09 15:45:27 +020014#include "hf/vcpu.h"
J-Alvesc003a7a2021-03-18 13:06:53 +000015#include "hf/vm.h"
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +000016
Daniel Boulby87b2dc82021-08-04 14:07:43 +010017struct ffa_value arch_ffa_features(uint32_t function_id)
18{
19 (void)function_id;
20 return ffa_error(FFA_NOT_SUPPORTED);
21}
22
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +000023ffa_vm_id_t arch_ffa_spmc_id_get(void)
24{
25 return HF_SPMC_VM_ID;
26}
Olivier Deprez55a189e2021-06-09 15:45:27 +020027
28void plat_ffa_log_init(void)
29{
30}
31
Maksims Svecovsa3d570c2021-12-08 11:16:32 +000032bool plat_ffa_is_memory_send_valid(ffa_vm_id_t receiver_vm_id,
33 uint32_t share_func)
34{
35 (void)receiver_vm_id;
36 (void)share_func;
37
38 return true;
39}
40
Olivier Deprez55a189e2021-06-09 15:45:27 +020041bool plat_ffa_is_direct_request_valid(struct vcpu *current,
42 ffa_vm_id_t sender_vm_id,
43 ffa_vm_id_t receiver_vm_id)
44{
45 (void)current;
46 (void)sender_vm_id;
47 (void)receiver_vm_id;
48
49 return true;
50}
51
J-Alves439ac972021-11-18 17:32:03 +000052bool plat_ffa_is_direct_request_supported(struct vm *sender_vm,
53 struct vm *receiver_vm)
54{
55 (void)sender_vm;
56 (void)receiver_vm;
57
58 return false;
59}
60
Olivier Deprez55a189e2021-06-09 15:45:27 +020061bool plat_ffa_is_direct_response_valid(struct vcpu *current,
62 ffa_vm_id_t sender_vm_id,
63 ffa_vm_id_t receiver_vm_id)
64{
65 (void)current;
66 (void)sender_vm_id;
67 (void)receiver_vm_id;
68
69 return true;
70}
71
Raghu Krishnamurthy62f97a72021-07-27 02:14:59 -070072bool plat_ffa_run_forward(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx,
73 struct ffa_value *ret)
74{
75 (void)vm_id;
76 (void)vcpu_idx;
77 (void)ret;
78
79 return false;
80}
81
Federico Recanati10bd06c2022-02-23 17:32:59 +010082void plat_ffa_vm_destroy(struct vm_locked to_destroy_locked)
83{
84 (void)to_destroy_locked;
85}
86
Federico Recanati8da9e332022-02-10 11:00:17 +010087void plat_ffa_rxtx_unmap_forward(ffa_vm_id_t id)
88{
89 (void)id;
90}
91
Olivier Deprez55a189e2021-06-09 15:45:27 +020092bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id,
93 struct ffa_value args,
94 struct ffa_value *ret)
95{
96 (void)receiver_vm_id;
97 (void)args;
98 (void)ret;
99 return false;
100}
101
Federico Recanati644f0462022-03-17 12:04:00 +0100102bool plat_ffa_acquire_receiver_rx(struct vm_locked to_locked,
103 struct ffa_value *ret)
104{
105 (void)to_locked;
106 (void)ret;
107
108 return false;
109}
110
Federico Recanati25053ee2022-03-14 15:01:53 +0100111bool plat_ffa_is_indirect_msg_supported(struct vm_locked sender_locked,
112 struct vm_locked receiver_locked)
113{
114 (void)sender_locked;
115 (void)receiver_locked;
116
117 return false;
118}
119
120bool plat_ffa_msg_send2_forward(ffa_vm_id_t receiver_vm_id,
121 ffa_vm_id_t sender_vm_id, struct ffa_value *ret)
122{
123 (void)receiver_vm_id;
124 (void)sender_vm_id;
125 (void)ret;
126
127 return false;
128}
129
Olivier Deprez55a189e2021-06-09 15:45:27 +0200130ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index)
131{
132 return index;
133}
134
135bool plat_ffa_memory_handle_allocated_by_current_world(
136 ffa_memory_handle_t handle)
137{
138 (void)handle;
139 return false;
140}
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100141
J-Alves7db32002021-12-14 14:44:50 +0000142uint32_t plat_ffa_other_world_mode(void)
143{
144 return 0U;
145}
146
147uint32_t plat_ffa_owner_world_mode(ffa_vm_id_t owner_id)
148{
149 (void)owner_id;
150 return 0U;
151}
152
J-Alvesc003a7a2021-03-18 13:06:53 +0000153bool plat_ffa_is_notifications_bind_valid(struct vcpu *current,
154 ffa_vm_id_t sender_id,
155 ffa_vm_id_t receiver_id)
156{
157 (void)current;
158 (void)sender_id;
159 (void)receiver_id;
160 return false;
161}
162
J-Alvesb15e9402021-09-08 11:44:42 +0100163bool plat_ffa_notifications_update_bindings_forward(
164 ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags,
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 Recanati8d8b1cf2022-04-14 13:16:00 +0200178void plat_ffa_rxtx_map_forward(struct vm_locked vm_locked)
179{
180 (void)vm_locked;
181}
182
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100183ffa_partition_properties_t plat_ffa_partition_properties(
J-Alvesfa782092021-10-13 16:02:16 +0100184 ffa_vm_id_t vm_id, const struct vm *target)
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100185{
J-Alvesfa782092021-10-13 16:02:16 +0100186 (void)vm_id;
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100187 (void)target;
188 return 0;
189}
Maksims Svecovs9ddf86a2021-05-06 17:17:21 +0100190
191bool plat_ffa_vm_managed_exit_supported(struct vm *vm)
192{
193 (void)vm;
194 return false;
195}
J-Alvesa0f317d2021-06-09 13:31:59 +0100196
197bool plat_ffa_is_notifications_create_valid(struct vcpu *current,
198 ffa_vm_id_t vm_id)
199{
200 (void)current;
201 (void)vm_id;
202
203 return false;
204}
205
J-Alvesaa79c012021-07-09 14:29:45 +0100206bool plat_ffa_is_notification_set_valid(struct vcpu *current,
207 ffa_vm_id_t sender_id,
208 ffa_vm_id_t receiver_id)
209{
210 (void)current;
211 (void)sender_id;
212 (void)receiver_id;
213 return false;
214}
215
216bool plat_ffa_is_notification_get_valid(struct vcpu *current,
J-Alvesfc95a302022-04-22 14:18:23 +0100217 ffa_vm_id_t receiver_id, uint32_t flags)
J-Alvesaa79c012021-07-09 14:29:45 +0100218{
J-Alvesfc95a302022-04-22 14:18:23 +0100219 (void)flags;
J-Alvesaa79c012021-07-09 14:29:45 +0100220 (void)current;
221 (void)receiver_id;
222 return false;
223}
224
J-Alves98ff9562021-09-09 14:39:41 +0100225bool plat_ffa_notifications_get_from_sp(
226 struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id,
J-Alvesfa782092021-10-13 16:02:16 +0100227 ffa_notifications_bitmap_t *from_sp, // NOLINT
228 struct ffa_value *ret) // NOLINT
J-Alves98ff9562021-09-09 14:39:41 +0100229{
230 (void)receiver_locked;
231 (void)vcpu_id;
232 (void)from_sp;
233 (void)ret;
234
235 return false;
236}
237
J-Alvesd605a092022-03-28 14:20:48 +0100238bool plat_ffa_notifications_get_framework_notifications(
239 struct vm_locked receiver_locked,
240 ffa_notifications_bitmap_t *from_fwk, // NOLINT
241 uint32_t flags, ffa_vcpu_index_t vcpu_id, struct ffa_value *ret)
242{
243 (void)receiver_locked;
244 (void)from_fwk;
245 (void)flags;
246 (void)vcpu_id;
247 (void)ret;
248
249 return false;
250}
251
J-Alvesde7bd2f2021-09-09 19:54:35 +0100252bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id,
253 ffa_vm_id_t receiver_vm_id,
254 uint32_t flags,
255 ffa_notifications_bitmap_t bitmap,
256 struct ffa_value *ret)
257{
258 (void)sender_vm_id;
259 (void)receiver_vm_id;
260 (void)flags;
261 (void)bitmap;
262 (void)ret;
263
264 return false;
265}
266
J-Alvesa0f317d2021-06-09 13:31:59 +0100267struct ffa_value plat_ffa_notifications_bitmap_create(
268 ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count)
269{
270 (void)vm_id;
271 (void)vcpu_count;
272
273 return ffa_error(FFA_NOT_SUPPORTED);
274}
275
276struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id)
277{
278 (void)vm_id;
279
280 return ffa_error(FFA_NOT_SUPPORTED);
281}
J-Alvesc003a7a2021-03-18 13:06:53 +0000282
283struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id)
284{
285 (void)vm_id;
286 return (struct vm_locked){.vm = NULL};
287}
288
Federico Recanati8d8b1cf2022-04-14 13:16:00 +0200289struct vm_locked plat_ffa_vm_find_locked_create(ffa_vm_id_t vm_id)
290{
291 (void)vm_id;
292 return (struct vm_locked){.vm = NULL};
293}
294
J-Alvesc003a7a2021-03-18 13:06:53 +0000295bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id)
296{
297 (void)vm_id;
298 return false;
299}
J-Alvesc8e8a222021-06-08 17:33:52 +0100300
J-Alvesfa782092021-10-13 16:02:16 +0100301bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE
302 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
303 uint32_t *lists_sizes, // NOLINTNEXTLINE
304 uint32_t *lists_count, const uint32_t ids_count_max)
J-Alvesc8e8a222021-06-08 17:33:52 +0100305{
306 (void)ids;
307 (void)ids_count;
308 (void)lists_sizes;
309 (void)lists_count;
310 (void)ids_count_max;
311
312 return false;
313}
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700314
315bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current)
316{
317 (void)current;
318 return false;
319}
320
321bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current)
322{
323 (void)current;
324 return false;
325}
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500326
327/**
328 * Check if current VM can resume target VM/SP using FFA_RUN ABI.
329 */
330bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id,
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800331 ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret,
332 struct vcpu **next)
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500333{
334 (void)current;
335 (void)target_vm_id;
336 (void)run_ret;
337 (void)next;
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800338 (void)vcpu_idx;
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500339 return true;
340}
J-Alvesca058c22021-09-10 14:02:07 +0100341
342void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE
343 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
344 uint32_t *lists_sizes, uint32_t *lists_count,
345 const uint32_t ids_count_max)
346{
347 (void)ids;
348 (void)ids_count;
349 (void)lists_sizes;
350 (void)lists_count;
351 (void)ids_count_max;
352}
J-Alves13394022021-06-30 13:48:49 +0100353
354void plat_ffa_sri_state_set(enum plat_ffa_sri_state state)
355{
356 (void)state;
357}
358
359void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu)
360{
361 (void)cpu;
362}
363
364void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu)
365{
366 (void)cpu;
367}
368
369void plat_ffa_sri_init(struct cpu *cpu)
370{
371 (void)cpu;
372}
J-Alves7461ef22021-10-18 17:21:33 +0100373
J-Alves6e2abc62021-12-02 14:58:56 +0000374bool plat_ffa_inject_notification_pending_interrupt(
375 struct vcpu_locked target_locked, struct vcpu *current,
376 struct vm_locked receiver_locked)
J-Alves7461ef22021-10-18 17:21:33 +0100377{
J-Alves6e2abc62021-12-02 14:58:56 +0000378 (void)target_locked;
J-Alves7461ef22021-10-18 17:21:33 +0100379 (void)current;
J-Alves6e2abc62021-12-02 14:58:56 +0000380 (void)receiver_locked;
381
382 return false;
J-Alves7461ef22021-10-18 17:21:33 +0100383}
Olivier Depreze562e542020-06-11 17:31:54 +0200384
385void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE
386 const struct ffa_uuid *uuid, // NOLINTNEXTLINE
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000387 const uint32_t flags, // NOLINTNEXTLINE
Olivier Depreze562e542020-06-11 17:31:54 +0200388 struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count)
389{
390 (void)uuid;
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000391 (void)flags;
Olivier Depreze562e542020-06-11 17:31:54 +0200392 (void)partitions;
393 (void)ret_count;
394}
Olivier Deprezd614d322021-06-18 15:21:00 +0200395
396bool plat_ffa_is_secondary_ep_register_supported(void)
397{
398 return false;
399}
Madhukar Pappireddy5522c672021-12-17 16:35:51 -0600400bool plat_ffa_msg_wait_prepare(struct vcpu *current, struct vcpu **next,
401 struct ffa_value *ret_args)
402{
403 (void)current;
404 (void)next;
405 (void)ret_args;
406
407 return false;
408}