blob: 830544aea977a0c349e43171fe8a770978aba1d0 [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 Recanati8da9e332022-02-10 11:00:17 +010082void plat_ffa_rxtx_unmap_forward(ffa_vm_id_t id)
83{
84 (void)id;
85}
86
Olivier Deprez55a189e2021-06-09 15:45:27 +020087bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id,
88 struct ffa_value args,
89 struct ffa_value *ret)
90{
91 (void)receiver_vm_id;
92 (void)args;
93 (void)ret;
94 return false;
95}
96
97ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index)
98{
99 return index;
100}
101
102bool plat_ffa_memory_handle_allocated_by_current_world(
103 ffa_memory_handle_t handle)
104{
105 (void)handle;
106 return false;
107}
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100108
J-Alves7db32002021-12-14 14:44:50 +0000109uint32_t plat_ffa_other_world_mode(void)
110{
111 return 0U;
112}
113
114uint32_t plat_ffa_owner_world_mode(ffa_vm_id_t owner_id)
115{
116 (void)owner_id;
117 return 0U;
118}
119
J-Alvesc003a7a2021-03-18 13:06:53 +0000120bool plat_ffa_is_notifications_bind_valid(struct vcpu *current,
121 ffa_vm_id_t sender_id,
122 ffa_vm_id_t receiver_id)
123{
124 (void)current;
125 (void)sender_id;
126 (void)receiver_id;
127 return false;
128}
129
J-Alvesb15e9402021-09-08 11:44:42 +0100130bool plat_ffa_notifications_update_bindings_forward(
131 ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags,
132 ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret)
133{
134 (void)ret;
135 (void)receiver_id;
136 (void)sender_id;
137 (void)flags;
138 (void)bitmap;
139 (void)is_bind;
140 (void)ret;
141
142 return false;
143}
144
Federico Recanati8d8b1cf2022-04-14 13:16:00 +0200145void plat_ffa_rxtx_map_forward(struct vm_locked vm_locked)
146{
147 (void)vm_locked;
148}
149
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100150ffa_partition_properties_t plat_ffa_partition_properties(
J-Alvesfa782092021-10-13 16:02:16 +0100151 ffa_vm_id_t vm_id, const struct vm *target)
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100152{
J-Alvesfa782092021-10-13 16:02:16 +0100153 (void)vm_id;
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100154 (void)target;
155 return 0;
156}
Maksims Svecovs9ddf86a2021-05-06 17:17:21 +0100157
158bool plat_ffa_vm_managed_exit_supported(struct vm *vm)
159{
160 (void)vm;
161 return false;
162}
J-Alvesa0f317d2021-06-09 13:31:59 +0100163
164bool plat_ffa_is_notifications_create_valid(struct vcpu *current,
165 ffa_vm_id_t vm_id)
166{
167 (void)current;
168 (void)vm_id;
169
170 return false;
171}
172
J-Alvesaa79c012021-07-09 14:29:45 +0100173bool plat_ffa_is_notification_set_valid(struct vcpu *current,
174 ffa_vm_id_t sender_id,
175 ffa_vm_id_t receiver_id)
176{
177 (void)current;
178 (void)sender_id;
179 (void)receiver_id;
180 return false;
181}
182
183bool plat_ffa_is_notification_get_valid(struct vcpu *current,
J-Alvesfc95a302022-04-22 14:18:23 +0100184 ffa_vm_id_t receiver_id, uint32_t flags)
J-Alvesaa79c012021-07-09 14:29:45 +0100185{
J-Alvesfc95a302022-04-22 14:18:23 +0100186 (void)flags;
J-Alvesaa79c012021-07-09 14:29:45 +0100187 (void)current;
188 (void)receiver_id;
189 return false;
190}
191
J-Alves98ff9562021-09-09 14:39:41 +0100192bool plat_ffa_notifications_get_from_sp(
193 struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id,
J-Alvesfa782092021-10-13 16:02:16 +0100194 ffa_notifications_bitmap_t *from_sp, // NOLINT
195 struct ffa_value *ret) // NOLINT
J-Alves98ff9562021-09-09 14:39:41 +0100196{
197 (void)receiver_locked;
198 (void)vcpu_id;
199 (void)from_sp;
200 (void)ret;
201
202 return false;
203}
204
J-Alvesde7bd2f2021-09-09 19:54:35 +0100205bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id,
206 ffa_vm_id_t receiver_vm_id,
207 uint32_t flags,
208 ffa_notifications_bitmap_t bitmap,
209 struct ffa_value *ret)
210{
211 (void)sender_vm_id;
212 (void)receiver_vm_id;
213 (void)flags;
214 (void)bitmap;
215 (void)ret;
216
217 return false;
218}
219
J-Alvesa0f317d2021-06-09 13:31:59 +0100220struct ffa_value plat_ffa_notifications_bitmap_create(
221 ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count)
222{
223 (void)vm_id;
224 (void)vcpu_count;
225
226 return ffa_error(FFA_NOT_SUPPORTED);
227}
228
229struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id)
230{
231 (void)vm_id;
232
233 return ffa_error(FFA_NOT_SUPPORTED);
234}
J-Alvesc003a7a2021-03-18 13:06:53 +0000235
236struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id)
237{
238 (void)vm_id;
239 return (struct vm_locked){.vm = NULL};
240}
241
Federico Recanati8d8b1cf2022-04-14 13:16:00 +0200242struct vm_locked plat_ffa_vm_find_locked_create(ffa_vm_id_t vm_id)
243{
244 (void)vm_id;
245 return (struct vm_locked){.vm = NULL};
246}
247
J-Alvesc003a7a2021-03-18 13:06:53 +0000248bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id)
249{
250 (void)vm_id;
251 return false;
252}
J-Alvesc8e8a222021-06-08 17:33:52 +0100253
J-Alvesfa782092021-10-13 16:02:16 +0100254bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE
255 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
256 uint32_t *lists_sizes, // NOLINTNEXTLINE
257 uint32_t *lists_count, const uint32_t ids_count_max)
J-Alvesc8e8a222021-06-08 17:33:52 +0100258{
259 (void)ids;
260 (void)ids_count;
261 (void)lists_sizes;
262 (void)lists_count;
263 (void)ids_count_max;
264
265 return false;
266}
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700267
268bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current)
269{
270 (void)current;
271 return false;
272}
273
274bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current)
275{
276 (void)current;
277 return false;
278}
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500279
280/**
281 * Check if current VM can resume target VM/SP using FFA_RUN ABI.
282 */
283bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id,
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800284 ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret,
285 struct vcpu **next)
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500286{
287 (void)current;
288 (void)target_vm_id;
289 (void)run_ret;
290 (void)next;
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800291 (void)vcpu_idx;
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500292 return true;
293}
J-Alvesca058c22021-09-10 14:02:07 +0100294
295void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE
296 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
297 uint32_t *lists_sizes, uint32_t *lists_count,
298 const uint32_t ids_count_max)
299{
300 (void)ids;
301 (void)ids_count;
302 (void)lists_sizes;
303 (void)lists_count;
304 (void)ids_count_max;
305}
J-Alves13394022021-06-30 13:48:49 +0100306
307void plat_ffa_sri_state_set(enum plat_ffa_sri_state state)
308{
309 (void)state;
310}
311
312void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu)
313{
314 (void)cpu;
315}
316
317void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu)
318{
319 (void)cpu;
320}
321
322void plat_ffa_sri_init(struct cpu *cpu)
323{
324 (void)cpu;
325}
J-Alves7461ef22021-10-18 17:21:33 +0100326
J-Alves6e2abc62021-12-02 14:58:56 +0000327bool plat_ffa_inject_notification_pending_interrupt(
328 struct vcpu_locked target_locked, struct vcpu *current,
329 struct vm_locked receiver_locked)
J-Alves7461ef22021-10-18 17:21:33 +0100330{
J-Alves6e2abc62021-12-02 14:58:56 +0000331 (void)target_locked;
J-Alves7461ef22021-10-18 17:21:33 +0100332 (void)current;
J-Alves6e2abc62021-12-02 14:58:56 +0000333 (void)receiver_locked;
334
335 return false;
J-Alves7461ef22021-10-18 17:21:33 +0100336}
Olivier Depreze562e542020-06-11 17:31:54 +0200337
338void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE
339 const struct ffa_uuid *uuid, // NOLINTNEXTLINE
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000340 const uint32_t flags, // NOLINTNEXTLINE
Olivier Depreze562e542020-06-11 17:31:54 +0200341 struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count)
342{
343 (void)uuid;
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000344 (void)flags;
Olivier Depreze562e542020-06-11 17:31:54 +0200345 (void)partitions;
346 (void)ret_count;
347}
Olivier Deprezd614d322021-06-18 15:21:00 +0200348
349bool plat_ffa_is_secondary_ep_register_supported(void)
350{
351 return false;
352}
Madhukar Pappireddy5522c672021-12-17 16:35:51 -0600353bool plat_ffa_msg_wait_prepare(struct vcpu *current, struct vcpu **next,
354 struct ffa_value *ret_args)
355{
356 (void)current;
357 (void)next;
358 (void)ret_args;
359
360 return false;
361}