blob: 91bebd45bb98d9ff8702397fac1319b82ef0e4b9 [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
32bool 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
J-Alves439ac972021-11-18 17:32:03 +000043bool plat_ffa_is_direct_request_supported(struct vm *sender_vm,
44 struct vm *receiver_vm)
45{
46 (void)sender_vm;
47 (void)receiver_vm;
48
49 return false;
50}
51
Olivier Deprez55a189e2021-06-09 15:45:27 +020052bool plat_ffa_is_direct_response_valid(struct vcpu *current,
53 ffa_vm_id_t sender_vm_id,
54 ffa_vm_id_t receiver_vm_id)
55{
56 (void)current;
57 (void)sender_vm_id;
58 (void)receiver_vm_id;
59
60 return true;
61}
62
Raghu Krishnamurthy62f97a72021-07-27 02:14:59 -070063bool plat_ffa_run_forward(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx,
64 struct ffa_value *ret)
65{
66 (void)vm_id;
67 (void)vcpu_idx;
68 (void)ret;
69
70 return false;
71}
72
Olivier Deprez55a189e2021-06-09 15:45:27 +020073bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id,
74 struct ffa_value args,
75 struct ffa_value *ret)
76{
77 (void)receiver_vm_id;
78 (void)args;
79 (void)ret;
80 return false;
81}
82
83ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index)
84{
85 return index;
86}
87
88bool plat_ffa_memory_handle_allocated_by_current_world(
89 ffa_memory_handle_t handle)
90{
91 (void)handle;
92 return false;
93}
Maksims Svecovsb596eab2021-04-27 00:52:27 +010094
J-Alvesc003a7a2021-03-18 13:06:53 +000095bool plat_ffa_is_notifications_bind_valid(struct vcpu *current,
96 ffa_vm_id_t sender_id,
97 ffa_vm_id_t receiver_id)
98{
99 (void)current;
100 (void)sender_id;
101 (void)receiver_id;
102 return false;
103}
104
J-Alvesb15e9402021-09-08 11:44:42 +0100105bool plat_ffa_notifications_update_bindings_forward(
106 ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags,
107 ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret)
108{
109 (void)ret;
110 (void)receiver_id;
111 (void)sender_id;
112 (void)flags;
113 (void)bitmap;
114 (void)is_bind;
115 (void)ret;
116
117 return false;
118}
119
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100120ffa_partition_properties_t plat_ffa_partition_properties(
J-Alvesfa782092021-10-13 16:02:16 +0100121 ffa_vm_id_t vm_id, const struct vm *target)
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100122{
J-Alvesfa782092021-10-13 16:02:16 +0100123 (void)vm_id;
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100124 (void)target;
125 return 0;
126}
Maksims Svecovs9ddf86a2021-05-06 17:17:21 +0100127
128bool plat_ffa_vm_managed_exit_supported(struct vm *vm)
129{
130 (void)vm;
131 return false;
132}
J-Alvesa0f317d2021-06-09 13:31:59 +0100133
134bool plat_ffa_is_notifications_create_valid(struct vcpu *current,
135 ffa_vm_id_t vm_id)
136{
137 (void)current;
138 (void)vm_id;
139
140 return false;
141}
142
J-Alvesaa79c012021-07-09 14:29:45 +0100143bool plat_ffa_is_notification_set_valid(struct vcpu *current,
144 ffa_vm_id_t sender_id,
145 ffa_vm_id_t receiver_id)
146{
147 (void)current;
148 (void)sender_id;
149 (void)receiver_id;
150 return false;
151}
152
153bool plat_ffa_is_notification_get_valid(struct vcpu *current,
154 ffa_vm_id_t receiver_id)
155{
156 (void)current;
157 (void)receiver_id;
158 return false;
159}
160
J-Alves98ff9562021-09-09 14:39:41 +0100161bool plat_ffa_notifications_get_from_sp(
162 struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id,
J-Alvesfa782092021-10-13 16:02:16 +0100163 ffa_notifications_bitmap_t *from_sp, // NOLINT
164 struct ffa_value *ret) // NOLINT
J-Alves98ff9562021-09-09 14:39:41 +0100165{
166 (void)receiver_locked;
167 (void)vcpu_id;
168 (void)from_sp;
169 (void)ret;
170
171 return false;
172}
173
J-Alvesde7bd2f2021-09-09 19:54:35 +0100174bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id,
175 ffa_vm_id_t receiver_vm_id,
176 uint32_t flags,
177 ffa_notifications_bitmap_t bitmap,
178 struct ffa_value *ret)
179{
180 (void)sender_vm_id;
181 (void)receiver_vm_id;
182 (void)flags;
183 (void)bitmap;
184 (void)ret;
185
186 return false;
187}
188
J-Alvesa0f317d2021-06-09 13:31:59 +0100189struct ffa_value plat_ffa_notifications_bitmap_create(
190 ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count)
191{
192 (void)vm_id;
193 (void)vcpu_count;
194
195 return ffa_error(FFA_NOT_SUPPORTED);
196}
197
198struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id)
199{
200 (void)vm_id;
201
202 return ffa_error(FFA_NOT_SUPPORTED);
203}
J-Alvesc003a7a2021-03-18 13:06:53 +0000204
205struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id)
206{
207 (void)vm_id;
208 return (struct vm_locked){.vm = NULL};
209}
210
211bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id)
212{
213 (void)vm_id;
214 return false;
215}
J-Alvesc8e8a222021-06-08 17:33:52 +0100216
J-Alvesfa782092021-10-13 16:02:16 +0100217bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE
218 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
219 uint32_t *lists_sizes, // NOLINTNEXTLINE
220 uint32_t *lists_count, const uint32_t ids_count_max)
J-Alvesc8e8a222021-06-08 17:33:52 +0100221{
222 (void)ids;
223 (void)ids_count;
224 (void)lists_sizes;
225 (void)lists_count;
226 (void)ids_count_max;
227
228 return false;
229}
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700230
231bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current)
232{
233 (void)current;
234 return false;
235}
236
237bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current)
238{
239 (void)current;
240 return false;
241}
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500242
243/**
244 * Check if current VM can resume target VM/SP using FFA_RUN ABI.
245 */
246bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id,
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800247 ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret,
248 struct vcpu **next)
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500249{
250 (void)current;
251 (void)target_vm_id;
252 (void)run_ret;
253 (void)next;
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800254 (void)vcpu_idx;
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500255 return true;
256}
J-Alvesca058c22021-09-10 14:02:07 +0100257
258void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE
259 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
260 uint32_t *lists_sizes, uint32_t *lists_count,
261 const uint32_t ids_count_max)
262{
263 (void)ids;
264 (void)ids_count;
265 (void)lists_sizes;
266 (void)lists_count;
267 (void)ids_count_max;
268}
J-Alves13394022021-06-30 13:48:49 +0100269
270void plat_ffa_sri_state_set(enum plat_ffa_sri_state state)
271{
272 (void)state;
273}
274
275void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu)
276{
277 (void)cpu;
278}
279
280void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu)
281{
282 (void)cpu;
283}
284
285void plat_ffa_sri_init(struct cpu *cpu)
286{
287 (void)cpu;
288}
J-Alves7461ef22021-10-18 17:21:33 +0100289
290void plat_ffa_inject_notification_pending_interrupt_context_switch(
291 struct vcpu *next, struct vcpu *current)
292{
293 (void)next;
294 (void)current;
295}
Olivier Depreze562e542020-06-11 17:31:54 +0200296
297void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE
298 const struct ffa_uuid *uuid, // NOLINTNEXTLINE
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000299 const uint32_t flags, // NOLINTNEXTLINE
Olivier Depreze562e542020-06-11 17:31:54 +0200300 struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count)
301{
302 (void)uuid;
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000303 (void)flags;
Olivier Depreze562e542020-06-11 17:31:54 +0200304 (void)partitions;
305 (void)ret_count;
306}