blob: 236fb169b8da6bea5b5cc3d1740373208bf976b7 [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
Olivier Deprez55a189e2021-06-09 15:45:27 +020082bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id,
83 struct ffa_value args,
84 struct ffa_value *ret)
85{
86 (void)receiver_vm_id;
87 (void)args;
88 (void)ret;
89 return false;
90}
91
92ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index)
93{
94 return index;
95}
96
97bool plat_ffa_memory_handle_allocated_by_current_world(
98 ffa_memory_handle_t handle)
99{
100 (void)handle;
101 return false;
102}
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100103
J-Alvesc003a7a2021-03-18 13:06:53 +0000104bool plat_ffa_is_notifications_bind_valid(struct vcpu *current,
105 ffa_vm_id_t sender_id,
106 ffa_vm_id_t receiver_id)
107{
108 (void)current;
109 (void)sender_id;
110 (void)receiver_id;
111 return false;
112}
113
J-Alvesb15e9402021-09-08 11:44:42 +0100114bool plat_ffa_notifications_update_bindings_forward(
115 ffa_vm_id_t receiver_id, ffa_vm_id_t sender_id, uint32_t flags,
116 ffa_notifications_bitmap_t bitmap, bool is_bind, struct ffa_value *ret)
117{
118 (void)ret;
119 (void)receiver_id;
120 (void)sender_id;
121 (void)flags;
122 (void)bitmap;
123 (void)is_bind;
124 (void)ret;
125
126 return false;
127}
128
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100129ffa_partition_properties_t plat_ffa_partition_properties(
J-Alvesfa782092021-10-13 16:02:16 +0100130 ffa_vm_id_t vm_id, const struct vm *target)
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100131{
J-Alvesfa782092021-10-13 16:02:16 +0100132 (void)vm_id;
Maksims Svecovsb596eab2021-04-27 00:52:27 +0100133 (void)target;
134 return 0;
135}
Maksims Svecovs9ddf86a2021-05-06 17:17:21 +0100136
137bool plat_ffa_vm_managed_exit_supported(struct vm *vm)
138{
139 (void)vm;
140 return false;
141}
J-Alvesa0f317d2021-06-09 13:31:59 +0100142
143bool plat_ffa_is_notifications_create_valid(struct vcpu *current,
144 ffa_vm_id_t vm_id)
145{
146 (void)current;
147 (void)vm_id;
148
149 return false;
150}
151
J-Alvesaa79c012021-07-09 14:29:45 +0100152bool plat_ffa_is_notification_set_valid(struct vcpu *current,
153 ffa_vm_id_t sender_id,
154 ffa_vm_id_t receiver_id)
155{
156 (void)current;
157 (void)sender_id;
158 (void)receiver_id;
159 return false;
160}
161
162bool plat_ffa_is_notification_get_valid(struct vcpu *current,
163 ffa_vm_id_t receiver_id)
164{
165 (void)current;
166 (void)receiver_id;
167 return false;
168}
169
J-Alves98ff9562021-09-09 14:39:41 +0100170bool plat_ffa_notifications_get_from_sp(
171 struct vm_locked receiver_locked, ffa_vcpu_index_t vcpu_id,
J-Alvesfa782092021-10-13 16:02:16 +0100172 ffa_notifications_bitmap_t *from_sp, // NOLINT
173 struct ffa_value *ret) // NOLINT
J-Alves98ff9562021-09-09 14:39:41 +0100174{
175 (void)receiver_locked;
176 (void)vcpu_id;
177 (void)from_sp;
178 (void)ret;
179
180 return false;
181}
182
J-Alvesde7bd2f2021-09-09 19:54:35 +0100183bool plat_ffa_notification_set_forward(ffa_vm_id_t sender_vm_id,
184 ffa_vm_id_t receiver_vm_id,
185 uint32_t flags,
186 ffa_notifications_bitmap_t bitmap,
187 struct ffa_value *ret)
188{
189 (void)sender_vm_id;
190 (void)receiver_vm_id;
191 (void)flags;
192 (void)bitmap;
193 (void)ret;
194
195 return false;
196}
197
J-Alvesa0f317d2021-06-09 13:31:59 +0100198struct ffa_value plat_ffa_notifications_bitmap_create(
199 ffa_vm_id_t vm_id, ffa_vcpu_count_t vcpu_count)
200{
201 (void)vm_id;
202 (void)vcpu_count;
203
204 return ffa_error(FFA_NOT_SUPPORTED);
205}
206
207struct ffa_value plat_ffa_notifications_bitmap_destroy(ffa_vm_id_t vm_id)
208{
209 (void)vm_id;
210
211 return ffa_error(FFA_NOT_SUPPORTED);
212}
J-Alvesc003a7a2021-03-18 13:06:53 +0000213
214struct vm_locked plat_ffa_vm_find_locked(ffa_vm_id_t vm_id)
215{
216 (void)vm_id;
217 return (struct vm_locked){.vm = NULL};
218}
219
220bool plat_ffa_is_vm_id(ffa_vm_id_t vm_id)
221{
222 (void)vm_id;
223 return false;
224}
J-Alvesc8e8a222021-06-08 17:33:52 +0100225
J-Alvesfa782092021-10-13 16:02:16 +0100226bool plat_ffa_vm_notifications_info_get( // NOLINTNEXTLINE
227 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
228 uint32_t *lists_sizes, // NOLINTNEXTLINE
229 uint32_t *lists_count, const uint32_t ids_count_max)
J-Alvesc8e8a222021-06-08 17:33:52 +0100230{
231 (void)ids;
232 (void)ids_count;
233 (void)lists_sizes;
234 (void)lists_count;
235 (void)ids_count_max;
236
237 return false;
238}
Raghu Krishnamurthyea6d25f2021-09-14 15:27:06 -0700239
240bool plat_ffa_is_mem_perm_get_valid(const struct vcpu *current)
241{
242 (void)current;
243 return false;
244}
245
246bool plat_ffa_is_mem_perm_set_valid(const struct vcpu *current)
247{
248 (void)current;
249 return false;
250}
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500251
252/**
253 * Check if current VM can resume target VM/SP using FFA_RUN ABI.
254 */
255bool plat_ffa_run_checks(struct vcpu *current, ffa_vm_id_t target_vm_id,
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800256 ffa_vcpu_index_t vcpu_idx, struct ffa_value *run_ret,
257 struct vcpu **next)
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500258{
259 (void)current;
260 (void)target_vm_id;
261 (void)run_ret;
262 (void)next;
Raghu Krishnamurthy048d63f2021-12-11 12:45:41 -0800263 (void)vcpu_idx;
Madhukar Pappireddyb11e0d12021-08-02 19:44:35 -0500264 return true;
265}
J-Alvesca058c22021-09-10 14:02:07 +0100266
267void plat_ffa_notification_info_get_forward( // NOLINTNEXTLINE
268 uint16_t *ids, uint32_t *ids_count, // NOLINTNEXTLINE
269 uint32_t *lists_sizes, uint32_t *lists_count,
270 const uint32_t ids_count_max)
271{
272 (void)ids;
273 (void)ids_count;
274 (void)lists_sizes;
275 (void)lists_count;
276 (void)ids_count_max;
277}
J-Alves13394022021-06-30 13:48:49 +0100278
279void plat_ffa_sri_state_set(enum plat_ffa_sri_state state)
280{
281 (void)state;
282}
283
284void plat_ffa_sri_trigger_if_delayed(struct cpu *cpu)
285{
286 (void)cpu;
287}
288
289void plat_ffa_sri_trigger_not_delayed(struct cpu *cpu)
290{
291 (void)cpu;
292}
293
294void plat_ffa_sri_init(struct cpu *cpu)
295{
296 (void)cpu;
297}
J-Alves7461ef22021-10-18 17:21:33 +0100298
299void plat_ffa_inject_notification_pending_interrupt_context_switch(
300 struct vcpu *next, struct vcpu *current)
301{
302 (void)next;
303 (void)current;
304}
Olivier Depreze562e542020-06-11 17:31:54 +0200305
306void plat_ffa_partition_info_get_forward( // NOLINTNEXTLINE
307 const struct ffa_uuid *uuid, // NOLINTNEXTLINE
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000308 const uint32_t flags, // NOLINTNEXTLINE
Olivier Depreze562e542020-06-11 17:31:54 +0200309 struct ffa_partition_info *partitions, ffa_vm_count_t *ret_count)
310{
311 (void)uuid;
Daniel Boulbyb46cad12021-12-13 17:47:21 +0000312 (void)flags;
Olivier Depreze562e542020-06-11 17:31:54 +0200313 (void)partitions;
314 (void)ret_count;
315}