blob: 03ac754eb00e7096f5fe067b6771a5ba8c649ab1 [file] [log] [blame]
J-Alves7581c382020-05-07 18:34:20 +01001/*
Max Shvetsov103e0562021-02-04 16:58:31 +00002 * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
J-Alves7581c382020-05-07 18:34:20 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef FFA_HELPERS_H
8#define FFA_HELPERS_H
9
J-Alves8f08a052020-05-26 17:14:40 +010010#include <ffa_svc.h>
J-Alves7581c382020-05-07 18:34:20 +010011#include <tftf_lib.h>
12#include <utils_def.h>
13
14/* This error code must be different to the ones used by FFA */
15#define FFA_TFTF_ERROR -42
16
Daniel Boulbye79d2072021-03-03 11:34:53 +000017typedef unsigned short ffa_id_t;
J-Alves5aecd982020-06-11 10:25:33 +010018typedef unsigned short ffa_vm_count_t;
19typedef unsigned short ffa_vcpu_count_t;
J-Alvesf3a393c2020-10-23 16:00:39 +010020typedef uint64_t ffa_memory_handle_t;
21/** Flags to indicate properties of receivers during memory region retrieval. */
22typedef uint8_t ffa_memory_receiver_flags_t;
J-Alves5aecd982020-06-11 10:25:33 +010023
J-Alvesd708c032020-11-19 12:14:21 +000024struct ffa_uuid {
25 const uint32_t uuid[4];
26};
27
J-Alves7581c382020-05-07 18:34:20 +010028#ifndef __ASSEMBLY__
29
J-Alves18c28052021-03-09 09:58:53 +000030#include <cassert.h>
J-Alves7581c382020-05-07 18:34:20 +010031#include <stdint.h>
32
J-Alves4439ece2021-11-05 11:52:54 +000033/**
34 * FF-A Feature ID, to be used with interface FFA_FEATURES.
35 * As defined in the FF-A v1.1 Beta specification, table 13.10, in section
36 * 13.2.
37 */
38
39/** Query interrupt ID of Notification Pending Interrupt. */
40#define FFA_FEATURE_NPI 0x1U
41
42/** Query interrupt ID of Schedule Receiver Interrupt. */
43#define FFA_FEATURE_SRI 0x2U
44
45/** Query interrupt ID of the Managed Exit Interrupt. */
46#define FFA_FEATURE_MEI 0x3U
47
Max Shvetsov0b7d25f2021-03-05 13:46:42 +000048/** Partition property: partition supports receipt of direct requests. */
49#define FFA_PARTITION_DIRECT_REQ_RECV 0x1
50
51/** Partition property: partition can send direct requests. */
52#define FFA_PARTITION_DIRECT_REQ_SEND 0x2
53
54/** Partition property: partition can send and receive indirect messages. */
55#define FFA_PARTITION_INDIRECT_MSG 0x4
56
J-Alves4d05dec2021-11-02 11:52:27 +000057/** Partition property: partition can receive notifications. */
58#define FFA_PARTITION_NOTIFICATION 0x8
59
Max Shvetsovc32f4782020-06-23 09:41:15 +010060struct ffa_partition_info {
61 /** The ID of the VM the information is about */
Daniel Boulbye79d2072021-03-03 11:34:53 +000062 ffa_id_t id;
Max Shvetsovc32f4782020-06-23 09:41:15 +010063 /** The number of execution contexts implemented by the partition */
64 uint16_t exec_context;
65 /** The Partition's properties, e.g. supported messaging methods */
66 uint32_t properties;
67};
68
J-Alvesf156ae92021-10-08 12:10:05 +010069static inline uint32_t ffa_func_id(smc_ret_values val)
70{
J-Alves6cb21d92021-01-07 15:18:12 +000071 return (uint32_t) val.ret0;
72}
73
J-Alvesf156ae92021-10-08 12:10:05 +010074static inline int32_t ffa_error_code(smc_ret_values val)
75{
J-Alves6cb21d92021-01-07 15:18:12 +000076 return (int32_t) val.ret2;
77}
78
Daniel Boulby198deda2021-03-03 11:35:25 +000079static inline ffa_id_t ffa_endpoint_id(smc_ret_values val) {
80 return (ffa_id_t) val.ret2 & 0xffff;
81}
82
J-Alves4439ece2021-11-05 11:52:54 +000083static inline uint32_t ffa_feature_intid(smc_ret_values val)
84{
85 return (uint32_t)val.ret2;
86}
87
J-Alves18c28052021-03-09 09:58:53 +000088typedef uint64_t ffa_notification_bitmap_t;
89
90#define FFA_NOTIFICATION(ID) (UINT64_C(1) << ID)
91
92#define MAX_FFA_NOTIFICATIONS UINT32_C(64)
93
94#define FFA_NOTIFICATIONS_FLAG_PER_VCPU UINT32_C(0x1 << 0)
95
J-Alvesb0cb5d02021-07-08 11:19:33 +010096/** Flag to delay Schedule Receiver Interrupt. */
97#define FFA_NOTIFICATIONS_FLAG_DELAY_SRI UINT32_C(0x1 << 1)
98
J-Alves18c28052021-03-09 09:58:53 +000099#define FFA_NOTIFICATIONS_FLAGS_VCPU_ID(id) UINT32_C((id & 0xFFFF) << 16)
100
J-Alvesf156ae92021-10-08 12:10:05 +0100101#define FFA_NOTIFICATIONS_FLAG_BITMAP_SP UINT32_C(0x1 << 0)
102#define FFA_NOTIFICATIONS_FLAG_BITMAP_VM UINT32_C(0x1 << 1)
103#define FFA_NOTIFICATIONS_FLAG_BITMAP_SPM UINT32_C(0x1 << 2)
104#define FFA_NOTIFICATIONS_FLAG_BITMAP_HYP UINT32_C(0x1 << 3)
105
J-Alves269118a2021-09-22 09:46:11 +0100106/**
107 * The following is an SGI ID, that the SPMC configures as non-secure, as
108 * suggested by the FF-A v1.1 specification, in section 9.4.1.
109 */
110#define FFA_SCHEDULE_RECEIVER_INTERRUPT_ID 8
111
J-Alvesf156ae92021-10-08 12:10:05 +0100112#define FFA_NOTIFICATIONS_BITMAP(lo, hi) \
113 (ffa_notification_bitmap_t)(lo) | \
114 (((ffa_notification_bitmap_t)hi << 32) & 0xFFFFFFFF00000000ULL)
115
116#define FFA_NOTIFICATIONS_FLAGS_VCPU_ID(id) UINT32_C((id & 0xFFFF) << 16)
117
118static inline ffa_notification_bitmap_t ffa_notifications_get_from_sp(smc_ret_values val)
119{
120 return FFA_NOTIFICATIONS_BITMAP(val.ret2, val.ret3);
121}
122
123static inline ffa_notification_bitmap_t ffa_notifications_get_from_vm(smc_ret_values val)
124{
125 return FFA_NOTIFICATIONS_BITMAP(val.ret4, val.ret5);
126}
127
J-Alves5bce2502021-06-14 14:27:45 +0100128/*
129 * FFA_NOTIFICATION_INFO_GET is a SMC64 interface.
130 * The following macros are defined for SMC64 implementation.
131 */
132#define FFA_NOTIFICATIONS_INFO_GET_MAX_IDS 20U
133
134#define FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING UINT64_C(0x1)
135
136#define FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT 0x7U
137#define FFA_NOTIFICATIONS_LISTS_COUNT_MASK 0x1FU
138#define FFA_NOTIFICATIONS_LIST_SHIFT(l) (2 * (l - 1) + 12)
139#define FFA_NOTIFICATIONS_LIST_SIZE_MASK 0x3U
140
141static inline uint32_t ffa_notifications_info_get_lists_count(
142 smc_ret_values ret)
143{
144 return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT)
145 & FFA_NOTIFICATIONS_LISTS_COUNT_MASK;
146}
147
148static inline uint32_t ffa_notifications_info_get_list_size(
149 smc_ret_values ret, uint32_t list)
150{
151 return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LIST_SHIFT(list)) &
152 FFA_NOTIFICATIONS_LIST_SIZE_MASK;
153}
154
155static inline bool ffa_notifications_info_get_more_pending(smc_ret_values ret)
156{
157 return (ret.ret2 & FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING) != 0U;
158}
159
J-Alvesf3a393c2020-10-23 16:00:39 +0100160enum ffa_data_access {
161 FFA_DATA_ACCESS_NOT_SPECIFIED,
162 FFA_DATA_ACCESS_RO,
163 FFA_DATA_ACCESS_RW,
164 FFA_DATA_ACCESS_RESERVED,
165};
166
167enum ffa_instruction_access {
168 FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED,
169 FFA_INSTRUCTION_ACCESS_NX,
170 FFA_INSTRUCTION_ACCESS_X,
171 FFA_INSTRUCTION_ACCESS_RESERVED,
172};
173
174enum ffa_memory_type {
175 FFA_MEMORY_NOT_SPECIFIED_MEM,
176 FFA_MEMORY_DEVICE_MEM,
177 FFA_MEMORY_NORMAL_MEM,
178};
179
180enum ffa_memory_cacheability {
181 FFA_MEMORY_CACHE_RESERVED = 0x0,
182 FFA_MEMORY_CACHE_NON_CACHEABLE = 0x1,
183 FFA_MEMORY_CACHE_RESERVED_1 = 0x2,
184 FFA_MEMORY_CACHE_WRITE_BACK = 0x3,
185 FFA_MEMORY_DEV_NGNRNE = 0x0,
186 FFA_MEMORY_DEV_NGNRE = 0x1,
187 FFA_MEMORY_DEV_NGRE = 0x2,
188 FFA_MEMORY_DEV_GRE = 0x3,
189};
190
191enum ffa_memory_shareability {
192 FFA_MEMORY_SHARE_NON_SHAREABLE,
193 FFA_MEMORY_SHARE_RESERVED,
194 FFA_MEMORY_OUTER_SHAREABLE,
195 FFA_MEMORY_INNER_SHAREABLE,
196};
197
198typedef uint8_t ffa_memory_access_permissions_t;
199
200/**
201 * This corresponds to table "Memory region attributes descriptor" of the FF-A
202 * 1.0 specification.
203 */
204typedef uint8_t ffa_memory_attributes_t;
205
206#define FFA_DATA_ACCESS_OFFSET (0x0U)
207#define FFA_DATA_ACCESS_MASK ((0x3U) << FFA_DATA_ACCESS_OFFSET)
208
209#define FFA_INSTRUCTION_ACCESS_OFFSET (0x2U)
210#define FFA_INSTRUCTION_ACCESS_MASK ((0x3U) << FFA_INSTRUCTION_ACCESS_OFFSET)
211
212#define FFA_MEMORY_TYPE_OFFSET (0x4U)
213#define FFA_MEMORY_TYPE_MASK ((0x3U) << FFA_MEMORY_TYPE_OFFSET)
214
215#define FFA_MEMORY_CACHEABILITY_OFFSET (0x2U)
216#define FFA_MEMORY_CACHEABILITY_MASK ((0x3U) << FFA_MEMORY_CACHEABILITY_OFFSET)
217
218#define FFA_MEMORY_SHAREABILITY_OFFSET (0x0U)
219#define FFA_MEMORY_SHAREABILITY_MASK ((0x3U) << FFA_MEMORY_SHAREABILITY_OFFSET)
220
221#define ATTR_FUNCTION_SET(name, container_type, offset, mask) \
222 static inline void ffa_set_##name##_attr(container_type *attr, \
223 const enum ffa_##name perm) \
224 { \
225 *attr = (*attr & ~(mask)) | ((perm << offset) & mask); \
226 }
227
228#define ATTR_FUNCTION_GET(name, container_type, offset, mask) \
229 static inline enum ffa_##name ffa_get_##name##_attr( \
230 container_type attr) \
231 { \
232 return (enum ffa_##name)((attr & mask) >> offset); \
233 }
234
235ATTR_FUNCTION_SET(data_access, ffa_memory_access_permissions_t,
236 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
237ATTR_FUNCTION_GET(data_access, ffa_memory_access_permissions_t,
238 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
239
240ATTR_FUNCTION_SET(instruction_access, ffa_memory_access_permissions_t,
241 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
242ATTR_FUNCTION_GET(instruction_access, ffa_memory_access_permissions_t,
243 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
244
245ATTR_FUNCTION_SET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
246 FFA_MEMORY_TYPE_MASK)
247ATTR_FUNCTION_GET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
248 FFA_MEMORY_TYPE_MASK)
249
250ATTR_FUNCTION_SET(memory_cacheability, ffa_memory_attributes_t,
251 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
252ATTR_FUNCTION_GET(memory_cacheability, ffa_memory_attributes_t,
253 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
254
255ATTR_FUNCTION_SET(memory_shareability, ffa_memory_attributes_t,
256 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
257ATTR_FUNCTION_GET(memory_shareability, ffa_memory_attributes_t,
258 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
259
260#define FFA_MEMORY_HANDLE_ALLOCATOR_MASK \
261 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
262#define FFA_MEMORY_HANDLE_ALLOCATOR_HYPERVISOR \
263 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
264#define FFA_MEMORY_HANDLE_INVALID (~UINT64_C(0))
265
266/**
267 * A set of contiguous pages which is part of a memory region. This corresponds
268 * to table "Constituent memory region descriptor" of the FFA 1.0 specification.
269 */
270struct ffa_memory_region_constituent {
271 /**
272 * The base IPA of the constituent memory region, aligned to 4 kiB page
273 * size granularity.
274 */
275 void *address;
276 /** The number of 4 kiB pages in the constituent memory region. */
277 uint32_t page_count;
278 /** Reserved field, must be 0. */
279 uint32_t reserved;
280};
281
282/**
283 * A set of pages comprising a memory region. This corresponds to table
284 * "Composite memory region descriptor" of the FFA 1.0 specification.
285 */
286struct ffa_composite_memory_region {
287 /**
288 * The total number of 4 kiB pages included in this memory region. This
289 * must be equal to the sum of page counts specified in each
290 * `ffa_memory_region_constituent`.
291 */
292 uint32_t page_count;
293 /**
294 * The number of constituents (`ffa_memory_region_constituent`)
295 * included in this memory region range.
296 */
297 uint32_t constituent_count;
298 /** Reserved field, must be 0. */
299 uint64_t reserved_0;
300 /** An array of `constituent_count` memory region constituents. */
301 struct ffa_memory_region_constituent constituents[];
302};
303
304/**
305 * This corresponds to table "Memory access permissions descriptor" of the FFA
306 * 1.0 specification.
307 */
308struct ffa_memory_region_attributes {
309 /** The ID of the VM to which the memory is being given or shared. */
Daniel Boulbye79d2072021-03-03 11:34:53 +0000310 ffa_id_t receiver;
J-Alvesf3a393c2020-10-23 16:00:39 +0100311 /**
312 * The permissions with which the memory region should be mapped in the
313 * receiver's page table.
314 */
315 ffa_memory_access_permissions_t permissions;
316 /**
317 * Flags used during FFA_MEM_RETRIEVE_REQ and FFA_MEM_RETRIEVE_RESP
318 * for memory regions with multiple borrowers.
319 */
320 ffa_memory_receiver_flags_t flags;
321};
322
323/** Flags to control the behaviour of a memory sharing transaction. */
324typedef uint32_t ffa_memory_region_flags_t;
325
326/**
327 * Clear memory region contents after unmapping it from the sender and before
328 * mapping it for any receiver.
329 */
330#define FFA_MEMORY_REGION_FLAG_CLEAR 0x1U
331
332/**
333 * Whether the hypervisor may time slice the memory sharing or retrieval
334 * operation.
335 */
336#define FFA_MEMORY_REGION_FLAG_TIME_SLICE 0x2U
337
338/**
339 * Whether the hypervisor should clear the memory region after the receiver
340 * relinquishes it or is aborted.
341 */
342#define FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH 0x4U
343
344#define FFA_MEMORY_REGION_TRANSACTION_TYPE_MASK ((0x3U) << 3)
345#define FFA_MEMORY_REGION_TRANSACTION_TYPE_UNSPECIFIED ((0x0U) << 3)
346#define FFA_MEMORY_REGION_TRANSACTION_TYPE_SHARE ((0x1U) << 3)
347#define FFA_MEMORY_REGION_TRANSACTION_TYPE_LEND ((0x2U) << 3)
348#define FFA_MEMORY_REGION_TRANSACTION_TYPE_DONATE ((0x3U) << 3)
349
J-Alves0435cae2020-11-06 10:49:56 +0000350/** The maximum number of recipients a memory region may be sent to. */
351#define MAX_MEM_SHARE_RECIPIENTS 1U
352
J-Alvesf3a393c2020-10-23 16:00:39 +0100353/**
354 * This corresponds to table "Endpoint memory access descriptor" of the FFA 1.0
355 * specification.
356 */
357struct ffa_memory_access {
358 struct ffa_memory_region_attributes receiver_permissions;
359 /**
360 * Offset in bytes from the start of the outer `ffa_memory_region` to
361 * an `ffa_composite_memory_region` struct.
362 */
363 uint32_t composite_memory_region_offset;
364 uint64_t reserved_0;
365};
366
367/**
368 * Information about a set of pages which are being shared. This corresponds to
369 * table "Lend, donate or share memory transaction descriptor" of the FFA
370 * 1.0 specification. Note that it is also used for retrieve requests and
371 * responses.
372 */
373struct ffa_memory_region {
374 /**
375 * The ID of the VM which originally sent the memory region, i.e. the
376 * owner.
377 */
Daniel Boulbye79d2072021-03-03 11:34:53 +0000378 ffa_id_t sender;
J-Alvesf3a393c2020-10-23 16:00:39 +0100379 ffa_memory_attributes_t attributes;
380 /** Reserved field, must be 0. */
381 uint8_t reserved_0;
382 /** Flags to control behaviour of the transaction. */
383 ffa_memory_region_flags_t flags;
384 ffa_memory_handle_t handle;
385 /**
386 * An implementation defined value associated with the receiver and the
387 * memory region.
388 */
389 uint64_t tag;
390 /** Reserved field, must be 0. */
391 uint32_t reserved_1;
392 /**
393 * The number of `ffa_memory_access` entries included in this
394 * transaction.
395 */
396 uint32_t receiver_count;
397 /**
398 * An array of `attribute_count` endpoint memory access descriptors.
399 * Each one specifies a memory region offset, an endpoint and the
400 * attributes with which this memory region should be mapped in that
401 * endpoint's page table.
402 */
403 struct ffa_memory_access receivers[];
404};
405
406/**
407 * Descriptor used for FFA_MEM_RELINQUISH requests. This corresponds to table
408 * "Descriptor to relinquish a memory region" of the FFA 1.0 specification.
409 */
410struct ffa_mem_relinquish {
411 ffa_memory_handle_t handle;
412 ffa_memory_region_flags_t flags;
413 uint32_t endpoint_count;
Daniel Boulbye79d2072021-03-03 11:34:53 +0000414 ffa_id_t endpoints[];
J-Alvesf3a393c2020-10-23 16:00:39 +0100415};
416
417static inline ffa_memory_handle_t ffa_assemble_handle(uint32_t h1, uint32_t h2)
418{
J-Alves18c28052021-03-09 09:58:53 +0000419 return (ffa_notification_bitmap_t)h1 |
420 (ffa_notification_bitmap_t)h2 << 32;
J-Alvesf3a393c2020-10-23 16:00:39 +0100421}
422
423static inline ffa_memory_handle_t ffa_mem_success_handle(smc_ret_values r)
424{
425 return ffa_assemble_handle(r.ret2, r.ret3);
426}
427
428/**
429 * Gets the `ffa_composite_memory_region` for the given receiver from an
430 * `ffa_memory_region`, or NULL if it is not valid.
431 */
432static inline struct ffa_composite_memory_region *
433ffa_memory_region_get_composite(struct ffa_memory_region *memory_region,
434 uint32_t receiver_index)
435{
436 uint32_t offset = memory_region->receivers[receiver_index]
437 .composite_memory_region_offset;
438
439 if (offset == 0) {
440 return NULL;
441 }
442
443 return (struct ffa_composite_memory_region *)((uint8_t *)memory_region +
444 offset);
445}
446
447static inline uint32_t ffa_mem_relinquish_init(
448 struct ffa_mem_relinquish *relinquish_request,
449 ffa_memory_handle_t handle, ffa_memory_region_flags_t flags,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000450 ffa_id_t sender)
J-Alvesf3a393c2020-10-23 16:00:39 +0100451{
452 relinquish_request->handle = handle;
453 relinquish_request->flags = flags;
454 relinquish_request->endpoint_count = 1;
455 relinquish_request->endpoints[0] = sender;
Daniel Boulbye79d2072021-03-03 11:34:53 +0000456 return sizeof(struct ffa_mem_relinquish) + sizeof(ffa_id_t);
J-Alvesf3a393c2020-10-23 16:00:39 +0100457}
458
459uint32_t ffa_memory_retrieve_request_init(
460 struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000461 ffa_id_t sender, ffa_id_t receiver, uint32_t tag,
J-Alvesf3a393c2020-10-23 16:00:39 +0100462 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
463 enum ffa_instruction_access instruction_access,
464 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
465 enum ffa_memory_shareability shareability);
466
467uint32_t ffa_memory_region_init(
468 struct ffa_memory_region *memory_region, size_t memory_region_max_size,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000469 ffa_id_t sender, ffa_id_t receiver,
J-Alvesf3a393c2020-10-23 16:00:39 +0100470 const struct ffa_memory_region_constituent constituents[],
471 uint32_t constituent_count, uint32_t tag,
472 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
473 enum ffa_instruction_access instruction_access,
474 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
475 enum ffa_memory_shareability shareability, uint32_t *total_length,
476 uint32_t *fragment_length);
477
Daniel Boulbye79d2072021-03-03 11:34:53 +0000478static inline ffa_id_t ffa_dir_msg_dest(smc_ret_values val) {
479 return (ffa_id_t)val.ret1 & U(0xFFFF);
J-Alves6cb21d92021-01-07 15:18:12 +0000480}
481
Daniel Boulbye79d2072021-03-03 11:34:53 +0000482static inline ffa_id_t ffa_dir_msg_source(smc_ret_values val) {
483 return (ffa_id_t)(val.ret1 >> 16U);
J-Alves6cb21d92021-01-07 15:18:12 +0000484}
485
Daniel Boulbye79d2072021-03-03 11:34:53 +0000486smc_ret_values ffa_msg_send_direct_req64(ffa_id_t source_id,
487 ffa_id_t dest_id, uint64_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000488 uint64_t arg1, uint64_t arg2,
489 uint64_t arg3, uint64_t arg4);
J-Alvesd1aae292020-10-08 17:16:58 +0100490
Daniel Boulbye79d2072021-03-03 11:34:53 +0000491smc_ret_values ffa_msg_send_direct_req32(ffa_id_t source_id,
492 ffa_id_t dest_id, uint32_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000493 uint32_t arg1, uint32_t arg2,
494 uint32_t arg3, uint32_t arg4);
495
Daniel Boulbye79d2072021-03-03 11:34:53 +0000496smc_ret_values ffa_msg_send_direct_resp64(ffa_id_t source_id,
497 ffa_id_t dest_id, uint64_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000498 uint64_t arg1, uint64_t arg2,
499 uint64_t arg3, uint64_t arg4);
500
Daniel Boulbye79d2072021-03-03 11:34:53 +0000501smc_ret_values ffa_msg_send_direct_resp32(ffa_id_t source_id,
502 ffa_id_t dest_id, uint32_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000503 uint32_t arg1, uint32_t arg2,
504 uint32_t arg3, uint32_t arg4);
J-Alves035b7d02021-02-11 10:40:35 +0000505
J-Alves7581c382020-05-07 18:34:20 +0100506smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
J-Alves8f08a052020-05-26 17:14:40 +0100507smc_ret_values ffa_version(uint32_t input_version);
J-Alves5aecd982020-06-11 10:25:33 +0100508smc_ret_values ffa_id_get(void);
Daniel Boulby198deda2021-03-03 11:35:25 +0000509smc_ret_values ffa_spm_id_get(void);
J-Alves5aecd982020-06-11 10:25:33 +0100510smc_ret_values ffa_msg_wait(void);
J-Alves5aecd982020-06-11 10:25:33 +0100511smc_ret_values ffa_error(int32_t error_code);
Max Shvetsovc17c1d32020-06-11 15:03:01 +0100512smc_ret_values ffa_features(uint32_t feature);
Max Shvetsov0b7d25f2021-03-05 13:46:42 +0000513smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid);
Max Shvetsovc32f4782020-06-23 09:41:15 +0100514smc_ret_values ffa_rx_release(void);
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100515smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
Daniel Boulbye0602902021-07-07 11:14:39 +0100516smc_ret_values ffa_rxtx_unmap(void);
J-Alves3ea46d12020-09-09 11:13:05 +0100517smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
518 uint32_t fragment_length);
519smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
520 uint32_t fragment_length);
521smc_ret_values ffa_mem_share(uint32_t descriptor_length,
522 uint32_t fragment_length);
523smc_ret_values ffa_mem_retrieve_req(uint32_t descriptor_length,
524 uint32_t fragment_length);
525smc_ret_values ffa_mem_relinquish(void);
526smc_ret_values ffa_mem_reclaim(uint64_t handle, uint32_t flags);
J-Alvesbcb1f972021-03-11 14:03:54 +0000527smc_ret_values ffa_notification_bitmap_create(ffa_id_t vm_id,
528 ffa_vcpu_count_t vcpu_count);
529smc_ret_values ffa_notification_bitmap_destroy(ffa_id_t vm_id);
J-Alves18c28052021-03-09 09:58:53 +0000530smc_ret_values ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
531 uint32_t flags,
532 ffa_notification_bitmap_t notifications);
533smc_ret_values ffa_notification_unbind(ffa_id_t sender, ffa_id_t receiver,
534 ffa_notification_bitmap_t notifications);
J-Alvesf156ae92021-10-08 12:10:05 +0100535smc_ret_values ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
536 uint32_t flags,
537 ffa_notification_bitmap_t bitmap);
538smc_ret_values ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
539 uint32_t flags);
J-Alves5bce2502021-06-14 14:27:45 +0100540smc_ret_values ffa_notification_info_get(void);
J-Alves7581c382020-05-07 18:34:20 +0100541#endif /* __ASSEMBLY__ */
542
543#endif /* FFA_HELPERS_H */