blob: 9eb3686e6e6c0e702fae09f9a9178929fcf82e37 [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 Recanati25053ee2022-03-14 15:01:53 +0100102bool plat_ffa_is_indirect_msg_supported(struct vm_locked sender_locked,
103 struct vm_locked receiver_locked)
104{
105 (void)sender_locked;
106 (void)receiver_locked;
107
108 return false;
109}
110
111bool plat_ffa_msg_send2_forward(ffa_vm_id_t receiver_vm_id,
112 ffa_vm_id_t sender_vm_id, struct ffa_value *ret)
113{
114 (void)receiver_vm_id;
115 (void)sender_vm_id;
116 (void)ret;
117
118 return false;
119}
120
Olivier Deprez55a189e2021-06-09 15:45:27 +0200121ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index)
122{
123 return index;
124}
125
126bool plat_ffa_memory_handle_allocated_by_current_world(
127 ffa_memory_handle_t handle)
128{
129 (void)handle;
130 return false;
131}
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100132
J-Alves7db32002021-12-14 14:44:50 +0000133uint32_t plat_ffa_other_world_mode(void)
134{
135 return 0U;
136}
137
138uint32_t plat_ffa_owner_world_mode(ffa_vm_id_t owner_id)
139{
140 (void)owner_id;
141 return 0U;
142}
143
J-Alvesc003a7a2021-03-18 13:06:53 +0000144bool plat_ffa_is_notifications_bind_valid(struct vcpu *current,
145 ffa_vm_id_t sender_id,
146 ffa_vm_id_t receiver_id)
147{
148 (void)current;
149 (void)sender_id;
150 (void)receiver_id;
151 return false;
152}
153
J-Alvesb15e9402021-09-08 11:44:42 +0100154bool plat_ffa_notifications_update_bindings_forward(
155 ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags,
156 ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret)
157{
158 (void)ret;
159 (void)receiver_id;
160 (void)sender_id;
161 (void)flags;
162 (void)bitmap;
163 (void)is_bind;
164 (void)ret;
165
166 return false;
167}
168
Federico Recanati8d8b1cf2022-04-14 13:16:00 +0200169void plat_ffa_rxtx_map_forward(struct vm_locked vm_locked)
170{
171 (void)vm_locked;
172}
173
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100174ffa_partition_properties_t plat_ffa_partition_properties(
J-Alvesfa782092021-10-13 16:02:16 +0100175 ffa_vm_id_t vm_id, const struct vm *target)
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100176{
J-Alvesfa782092021-10-13 16:02:16 +0100177 (void)vm_id;
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100178 (void)target;
179 return 0;
180}
Maksims Svecovs9ddf86a2021-05-06 17:17:21 +0100181
182bool plat_ffa_vm_managed_exit_supported(struct vm *vm)
183{
184 (void)vm;
185 return false;
186}
J-Alvesa0f317d2021-06-09 13:31:59 +0100187
188bool plat_ffa_is_notifications_create_valid(struct vcpu *current,
189 ffa_vm_id_t vm_id)
190{
191 (void)current;
192 (void)vm_id;
193
194 return false;
195}
196
J-Alvesaa79c012021-07-09 14:29:45 +0100197bool plat_ffa_is_notification_set_valid(struct vcpu *current,
198 ffa_vm_id_t sender_id,
199 ffa_vm_id_t receiver_id)
200{
201 (void)current;
202 (void)sender_id;
203 (void)receiver_id;
204 return false;
205}
206
207bool plat_ffa_is_notification_get_valid(struct vcpu *current,
J-Alvesfc95a302022-04-22 14:18:23 +0100208 ffa_vm_id_t receiver_id, uint32_t flags)
J-Alvesaa79c012021-07-09 14:29:45 +0100209{
J-Alvesfc95a302022-04-22 14:18:23 +0100210 (void)flags;
J-Alvesaa79c012021-07-09 14:29:45 +0100211 (void)current;
212 (void)receiver_id;
213 return false;
214}
215
J-Alves98ff9562021-09-09 14:39:41 +0100216bool plat_ffa_notifications_get_from_sp(
217 struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id,
J-Alvesfa782092021-10-13 16:02:16 +0100218 ffa_notifications_bitmap_t *from_sp, // NOLINT
219 struct ffa_value *ret) // NOLINT
J-Alves98ff9562021-09-09 14:39:41 +0100220{
221 (void)receiver_locked;
222 (void)vcpu_id;
223 (void)from_sp;
224 (void)ret;
225
226 return false;
227}
228
J-Alvesd605a092022-03-28 14:20:48 +0100229bool plat_ffa_notifications_get_framework_notifications(
230 struct vm_locked receiver_locked,
231 ffa_notifications_bitmap_t *from_fwk, // NOLINT
232 uint32_t flags, ffa_vcpu_index_t vcpu_id, struct ffa_value *ret)
233{
234 (void)receiver_locked;
235 (void)from_fwk;
236 (void)flags;
237 (void)vcpu_id;
238 (void)ret;
239
240 return false;
241}
242
J-Alvesde7bd2f2021-09-09 19:54:35 +0100243bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id,
244 ffa_vm_id_t receiver_vm_id,
245 uint32_t flags,
246 ffa_notifications_bitmap_t bitmap,
247 struct ffa_value *ret)
248{
249 (void)sender_vm_id;
250 (void)receiver_vm_id;
251 (void)flags;
252 (void)bitmap;
253 (void)ret;
254
255 return false;
256}
257
J-Alvesa0f317d2021-06-09 13:31:59 +0100258struct ffa_value plat_ffa_notifications_bitmap_create(
259 ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count)
260{
261 (void)vm_id;
262 (void)vcpu_count;
263
264 return ffa_error(FFA_NOT_SUPPORTED);
265}
266
267struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id)
268{
269 (void)vm_id;
270
271 return ffa_error(FFA_NOT_SUPPORTED);
272}
J-Alvesc003a7a2021-03-18 13:06:53 +0000273
274struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id)
275{
276 (void)vm_id;
277 return (struct vm_locked){.vm = NULL};
278}
279
Federico Recanati8d8b1cf2022-04-14 13:16:00 +0200280struct vm_locked plat_ffa_vm_find_locked_create(ffa_vm_id_t vm_id)
281{
282 (void)vm_id;
283 return (struct vm_locked){.vm = NULL};
284}
285
J-Alvesc003a7a2021-03-18 13:06:53 +0000286bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id)
287{
288 (void)vm_id;
289 return false;
290}
J-Alvesc8e8a222021-06-08 17:33:52 +0100291
J-Alvesfa782092021-10-13 16:02:16 +0100292bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE
293 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
294 uint32_t *lists_sizes, // NOLINTNEXTLINE
295 uint32_t *lists_count, const uint32_t ids_count_max)
J-Alvesc8e8a222021-06-08 17:33:52 +0100296{
297 (void)ids;
298 (void)ids_count;
299 (void)lists_sizes;
300 (void)lists_count;
301 (void)ids_count_max;
302
303 return false;
304}
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700305
306bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current)
307{
308 (void)current;
309 return false;
310}
311
312bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current)
313{
314 (void)current;
315 return false;
316}
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500317
318/**
319 * Check if current VM can resume target VM/SP using FFA_RUN ABI.
320 */
321bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id,
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800322 ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret,
323 struct vcpu **next)
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500324{
325 (void)current;
326 (void)target_vm_id;
327 (void)run_ret;
328 (void)next;
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800329 (void)vcpu_idx;
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500330 return true;
331}
J-Alvesca058c22021-09-10 14:02:07 +0100332
333void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE
334 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
335 uint32_t *lists_sizes, uint32_t *lists_count,
336 const uint32_t ids_count_max)
337{
338 (void)ids;
339 (void)ids_count;
340 (void)lists_sizes;
341 (void)lists_count;
342 (void)ids_count_max;
343}
J-Alves13394022021-06-30 13:48:49 +0100344
345void plat_ffa_sri_state_set(enum plat_ffa_sri_state state)
346{
347 (void)state;
348}
349
350void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu)
351{
352 (void)cpu;
353}
354
355void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu)
356{
357 (void)cpu;
358}
359
360void plat_ffa_sri_init(struct cpu *cpu)
361{
362 (void)cpu;
363}
J-Alves7461ef22021-10-18 17:21:33 +0100364
J-Alves6e2abc62021-12-02 14:58:56 +0000365bool plat_ffa_inject_notification_pending_interrupt(
366 struct vcpu_locked target_locked, struct vcpu *current,
367 struct vm_locked receiver_locked)
J-Alves7461ef22021-10-18 17:21:33 +0100368{
J-Alves6e2abc62021-12-02 14:58:56 +0000369 (void)target_locked;
J-Alves7461ef22021-10-18 17:21:33 +0100370 (void)current;
J-Alves6e2abc62021-12-02 14:58:56 +0000371 (void)receiver_locked;
372
373 return false;
J-Alves7461ef22021-10-18 17:21:33 +0100374}
Olivier Depreze562e542020-06-11 17:31:54 +0200375
376void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE
377 const struct ffa_uuid *uuid, // NOLINTNEXTLINE
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000378 const uint32_t flags, // NOLINTNEXTLINE
Olivier Depreze562e542020-06-11 17:31:54 +0200379 struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count)
380{
381 (void)uuid;
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000382 (void)flags;
Olivier Depreze562e542020-06-11 17:31:54 +0200383 (void)partitions;
384 (void)ret_count;
385}
Olivier Deprezd614d322021-06-18 15:21:00 +0200386
387bool plat_ffa_is_secondary_ep_register_supported(void)
388{
389 return false;
390}
Madhukar Pappireddy5522c672021-12-17 16:35:51 -0600391bool plat_ffa_msg_wait_prepare(struct vcpu *current, struct vcpu **next,
392 struct ffa_value *ret_args)
393{
394 (void)current;
395 (void)next;
396 (void)ret_args;
397
398 return false;
399}