blob: 177484873393c87df6e3be7876ec18df70a360bf [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
Max Shvetsov0b7d25f2021-03-05 13:46:42 +000033/** Partition property: partition supports receipt of direct requests. */
34#define FFA_PARTITION_DIRECT_REQ_RECV 0x1
35
36/** Partition property: partition can send direct requests. */
37#define FFA_PARTITION_DIRECT_REQ_SEND 0x2
38
39/** Partition property: partition can send and receive indirect messages. */
40#define FFA_PARTITION_INDIRECT_MSG 0x4
41
Max Shvetsovc32f4782020-06-23 09:41:15 +010042struct ffa_partition_info {
43 /** The ID of the VM the information is about */
Daniel Boulbye79d2072021-03-03 11:34:53 +000044 ffa_id_t id;
Max Shvetsovc32f4782020-06-23 09:41:15 +010045 /** The number of execution contexts implemented by the partition */
46 uint16_t exec_context;
47 /** The Partition's properties, e.g. supported messaging methods */
48 uint32_t properties;
49};
50
J-Alvesf156ae92021-10-08 12:10:05 +010051static inline uint32_t ffa_func_id(smc_ret_values val)
52{
J-Alves6cb21d92021-01-07 15:18:12 +000053 return (uint32_t) val.ret0;
54}
55
J-Alvesf156ae92021-10-08 12:10:05 +010056static inline int32_t ffa_error_code(smc_ret_values val)
57{
J-Alves6cb21d92021-01-07 15:18:12 +000058 return (int32_t) val.ret2;
59}
60
Daniel Boulby198deda2021-03-03 11:35:25 +000061static inline ffa_id_t ffa_endpoint_id(smc_ret_values val) {
62 return (ffa_id_t) val.ret2 & 0xffff;
63}
64
J-Alves18c28052021-03-09 09:58:53 +000065typedef uint64_t ffa_notification_bitmap_t;
66
67#define FFA_NOTIFICATION(ID) (UINT64_C(1) << ID)
68
69#define MAX_FFA_NOTIFICATIONS UINT32_C(64)
70
71#define FFA_NOTIFICATIONS_FLAG_PER_VCPU UINT32_C(0x1 << 0)
72
J-Alvesb0cb5d02021-07-08 11:19:33 +010073/** Flag to delay Schedule Receiver Interrupt. */
74#define FFA_NOTIFICATIONS_FLAG_DELAY_SRI UINT32_C(0x1 << 1)
75
J-Alves18c28052021-03-09 09:58:53 +000076#define FFA_NOTIFICATIONS_FLAGS_VCPU_ID(id) UINT32_C((id & 0xFFFF) << 16)
77
J-Alvesf156ae92021-10-08 12:10:05 +010078#define FFA_NOTIFICATIONS_FLAG_BITMAP_SP UINT32_C(0x1 << 0)
79#define FFA_NOTIFICATIONS_FLAG_BITMAP_VM UINT32_C(0x1 << 1)
80#define FFA_NOTIFICATIONS_FLAG_BITMAP_SPM UINT32_C(0x1 << 2)
81#define FFA_NOTIFICATIONS_FLAG_BITMAP_HYP UINT32_C(0x1 << 3)
82
J-Alves269118a2021-09-22 09:46:11 +010083/**
84 * The following is an SGI ID, that the SPMC configures as non-secure, as
85 * suggested by the FF-A v1.1 specification, in section 9.4.1.
86 */
87#define FFA_SCHEDULE_RECEIVER_INTERRUPT_ID 8
88
J-Alvesf156ae92021-10-08 12:10:05 +010089#define FFA_NOTIFICATIONS_BITMAP(lo, hi) \
90 (ffa_notification_bitmap_t)(lo) | \
91 (((ffa_notification_bitmap_t)hi << 32) & 0xFFFFFFFF00000000ULL)
92
93#define FFA_NOTIFICATIONS_FLAGS_VCPU_ID(id) UINT32_C((id & 0xFFFF) << 16)
94
95static inline ffa_notification_bitmap_t ffa_notifications_get_from_sp(smc_ret_values val)
96{
97 return FFA_NOTIFICATIONS_BITMAP(val.ret2, val.ret3);
98}
99
100static inline ffa_notification_bitmap_t ffa_notifications_get_from_vm(smc_ret_values val)
101{
102 return FFA_NOTIFICATIONS_BITMAP(val.ret4, val.ret5);
103}
104
J-Alves5bce2502021-06-14 14:27:45 +0100105/*
106 * FFA_NOTIFICATION_INFO_GET is a SMC64 interface.
107 * The following macros are defined for SMC64 implementation.
108 */
109#define FFA_NOTIFICATIONS_INFO_GET_MAX_IDS 20U
110
111#define FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING UINT64_C(0x1)
112
113#define FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT 0x7U
114#define FFA_NOTIFICATIONS_LISTS_COUNT_MASK 0x1FU
115#define FFA_NOTIFICATIONS_LIST_SHIFT(l) (2 * (l - 1) + 12)
116#define FFA_NOTIFICATIONS_LIST_SIZE_MASK 0x3U
117
118static inline uint32_t ffa_notifications_info_get_lists_count(
119 smc_ret_values ret)
120{
121 return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LISTS_COUNT_SHIFT)
122 & FFA_NOTIFICATIONS_LISTS_COUNT_MASK;
123}
124
125static inline uint32_t ffa_notifications_info_get_list_size(
126 smc_ret_values ret, uint32_t list)
127{
128 return (uint32_t)(ret.ret2 >> FFA_NOTIFICATIONS_LIST_SHIFT(list)) &
129 FFA_NOTIFICATIONS_LIST_SIZE_MASK;
130}
131
132static inline bool ffa_notifications_info_get_more_pending(smc_ret_values ret)
133{
134 return (ret.ret2 & FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING) != 0U;
135}
136
J-Alvesf3a393c2020-10-23 16:00:39 +0100137enum ffa_data_access {
138 FFA_DATA_ACCESS_NOT_SPECIFIED,
139 FFA_DATA_ACCESS_RO,
140 FFA_DATA_ACCESS_RW,
141 FFA_DATA_ACCESS_RESERVED,
142};
143
144enum ffa_instruction_access {
145 FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED,
146 FFA_INSTRUCTION_ACCESS_NX,
147 FFA_INSTRUCTION_ACCESS_X,
148 FFA_INSTRUCTION_ACCESS_RESERVED,
149};
150
151enum ffa_memory_type {
152 FFA_MEMORY_NOT_SPECIFIED_MEM,
153 FFA_MEMORY_DEVICE_MEM,
154 FFA_MEMORY_NORMAL_MEM,
155};
156
157enum ffa_memory_cacheability {
158 FFA_MEMORY_CACHE_RESERVED = 0x0,
159 FFA_MEMORY_CACHE_NON_CACHEABLE = 0x1,
160 FFA_MEMORY_CACHE_RESERVED_1 = 0x2,
161 FFA_MEMORY_CACHE_WRITE_BACK = 0x3,
162 FFA_MEMORY_DEV_NGNRNE = 0x0,
163 FFA_MEMORY_DEV_NGNRE = 0x1,
164 FFA_MEMORY_DEV_NGRE = 0x2,
165 FFA_MEMORY_DEV_GRE = 0x3,
166};
167
168enum ffa_memory_shareability {
169 FFA_MEMORY_SHARE_NON_SHAREABLE,
170 FFA_MEMORY_SHARE_RESERVED,
171 FFA_MEMORY_OUTER_SHAREABLE,
172 FFA_MEMORY_INNER_SHAREABLE,
173};
174
175typedef uint8_t ffa_memory_access_permissions_t;
176
177/**
178 * This corresponds to table "Memory region attributes descriptor" of the FF-A
179 * 1.0 specification.
180 */
181typedef uint8_t ffa_memory_attributes_t;
182
183#define FFA_DATA_ACCESS_OFFSET (0x0U)
184#define FFA_DATA_ACCESS_MASK ((0x3U) << FFA_DATA_ACCESS_OFFSET)
185
186#define FFA_INSTRUCTION_ACCESS_OFFSET (0x2U)
187#define FFA_INSTRUCTION_ACCESS_MASK ((0x3U) << FFA_INSTRUCTION_ACCESS_OFFSET)
188
189#define FFA_MEMORY_TYPE_OFFSET (0x4U)
190#define FFA_MEMORY_TYPE_MASK ((0x3U) << FFA_MEMORY_TYPE_OFFSET)
191
192#define FFA_MEMORY_CACHEABILITY_OFFSET (0x2U)
193#define FFA_MEMORY_CACHEABILITY_MASK ((0x3U) << FFA_MEMORY_CACHEABILITY_OFFSET)
194
195#define FFA_MEMORY_SHAREABILITY_OFFSET (0x0U)
196#define FFA_MEMORY_SHAREABILITY_MASK ((0x3U) << FFA_MEMORY_SHAREABILITY_OFFSET)
197
198#define ATTR_FUNCTION_SET(name, container_type, offset, mask) \
199 static inline void ffa_set_##name##_attr(container_type *attr, \
200 const enum ffa_##name perm) \
201 { \
202 *attr = (*attr & ~(mask)) | ((perm << offset) & mask); \
203 }
204
205#define ATTR_FUNCTION_GET(name, container_type, offset, mask) \
206 static inline enum ffa_##name ffa_get_##name##_attr( \
207 container_type attr) \
208 { \
209 return (enum ffa_##name)((attr & mask) >> offset); \
210 }
211
212ATTR_FUNCTION_SET(data_access, ffa_memory_access_permissions_t,
213 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
214ATTR_FUNCTION_GET(data_access, ffa_memory_access_permissions_t,
215 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
216
217ATTR_FUNCTION_SET(instruction_access, ffa_memory_access_permissions_t,
218 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
219ATTR_FUNCTION_GET(instruction_access, ffa_memory_access_permissions_t,
220 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
221
222ATTR_FUNCTION_SET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
223 FFA_MEMORY_TYPE_MASK)
224ATTR_FUNCTION_GET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
225 FFA_MEMORY_TYPE_MASK)
226
227ATTR_FUNCTION_SET(memory_cacheability, ffa_memory_attributes_t,
228 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
229ATTR_FUNCTION_GET(memory_cacheability, ffa_memory_attributes_t,
230 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
231
232ATTR_FUNCTION_SET(memory_shareability, ffa_memory_attributes_t,
233 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
234ATTR_FUNCTION_GET(memory_shareability, ffa_memory_attributes_t,
235 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
236
237#define FFA_MEMORY_HANDLE_ALLOCATOR_MASK \
238 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
239#define FFA_MEMORY_HANDLE_ALLOCATOR_HYPERVISOR \
240 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
241#define FFA_MEMORY_HANDLE_INVALID (~UINT64_C(0))
242
243/**
244 * A set of contiguous pages which is part of a memory region. This corresponds
245 * to table "Constituent memory region descriptor" of the FFA 1.0 specification.
246 */
247struct ffa_memory_region_constituent {
248 /**
249 * The base IPA of the constituent memory region, aligned to 4 kiB page
250 * size granularity.
251 */
252 void *address;
253 /** The number of 4 kiB pages in the constituent memory region. */
254 uint32_t page_count;
255 /** Reserved field, must be 0. */
256 uint32_t reserved;
257};
258
259/**
260 * A set of pages comprising a memory region. This corresponds to table
261 * "Composite memory region descriptor" of the FFA 1.0 specification.
262 */
263struct ffa_composite_memory_region {
264 /**
265 * The total number of 4 kiB pages included in this memory region. This
266 * must be equal to the sum of page counts specified in each
267 * `ffa_memory_region_constituent`.
268 */
269 uint32_t page_count;
270 /**
271 * The number of constituents (`ffa_memory_region_constituent`)
272 * included in this memory region range.
273 */
274 uint32_t constituent_count;
275 /** Reserved field, must be 0. */
276 uint64_t reserved_0;
277 /** An array of `constituent_count` memory region constituents. */
278 struct ffa_memory_region_constituent constituents[];
279};
280
281/**
282 * This corresponds to table "Memory access permissions descriptor" of the FFA
283 * 1.0 specification.
284 */
285struct ffa_memory_region_attributes {
286 /** The ID of the VM to which the memory is being given or shared. */
Daniel Boulbye79d2072021-03-03 11:34:53 +0000287 ffa_id_t receiver;
J-Alvesf3a393c2020-10-23 16:00:39 +0100288 /**
289 * The permissions with which the memory region should be mapped in the
290 * receiver's page table.
291 */
292 ffa_memory_access_permissions_t permissions;
293 /**
294 * Flags used during FFA_MEM_RETRIEVE_REQ and FFA_MEM_RETRIEVE_RESP
295 * for memory regions with multiple borrowers.
296 */
297 ffa_memory_receiver_flags_t flags;
298};
299
300/** Flags to control the behaviour of a memory sharing transaction. */
301typedef uint32_t ffa_memory_region_flags_t;
302
303/**
304 * Clear memory region contents after unmapping it from the sender and before
305 * mapping it for any receiver.
306 */
307#define FFA_MEMORY_REGION_FLAG_CLEAR 0x1U
308
309/**
310 * Whether the hypervisor may time slice the memory sharing or retrieval
311 * operation.
312 */
313#define FFA_MEMORY_REGION_FLAG_TIME_SLICE 0x2U
314
315/**
316 * Whether the hypervisor should clear the memory region after the receiver
317 * relinquishes it or is aborted.
318 */
319#define FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH 0x4U
320
321#define FFA_MEMORY_REGION_TRANSACTION_TYPE_MASK ((0x3U) << 3)
322#define FFA_MEMORY_REGION_TRANSACTION_TYPE_UNSPECIFIED ((0x0U) << 3)
323#define FFA_MEMORY_REGION_TRANSACTION_TYPE_SHARE ((0x1U) << 3)
324#define FFA_MEMORY_REGION_TRANSACTION_TYPE_LEND ((0x2U) << 3)
325#define FFA_MEMORY_REGION_TRANSACTION_TYPE_DONATE ((0x3U) << 3)
326
J-Alves0435cae2020-11-06 10:49:56 +0000327/** The maximum number of recipients a memory region may be sent to. */
328#define MAX_MEM_SHARE_RECIPIENTS 1U
329
J-Alvesf3a393c2020-10-23 16:00:39 +0100330/**
331 * This corresponds to table "Endpoint memory access descriptor" of the FFA 1.0
332 * specification.
333 */
334struct ffa_memory_access {
335 struct ffa_memory_region_attributes receiver_permissions;
336 /**
337 * Offset in bytes from the start of the outer `ffa_memory_region` to
338 * an `ffa_composite_memory_region` struct.
339 */
340 uint32_t composite_memory_region_offset;
341 uint64_t reserved_0;
342};
343
344/**
345 * Information about a set of pages which are being shared. This corresponds to
346 * table "Lend, donate or share memory transaction descriptor" of the FFA
347 * 1.0 specification. Note that it is also used for retrieve requests and
348 * responses.
349 */
350struct ffa_memory_region {
351 /**
352 * The ID of the VM which originally sent the memory region, i.e. the
353 * owner.
354 */
Daniel Boulbye79d2072021-03-03 11:34:53 +0000355 ffa_id_t sender;
J-Alvesf3a393c2020-10-23 16:00:39 +0100356 ffa_memory_attributes_t attributes;
357 /** Reserved field, must be 0. */
358 uint8_t reserved_0;
359 /** Flags to control behaviour of the transaction. */
360 ffa_memory_region_flags_t flags;
361 ffa_memory_handle_t handle;
362 /**
363 * An implementation defined value associated with the receiver and the
364 * memory region.
365 */
366 uint64_t tag;
367 /** Reserved field, must be 0. */
368 uint32_t reserved_1;
369 /**
370 * The number of `ffa_memory_access` entries included in this
371 * transaction.
372 */
373 uint32_t receiver_count;
374 /**
375 * An array of `attribute_count` endpoint memory access descriptors.
376 * Each one specifies a memory region offset, an endpoint and the
377 * attributes with which this memory region should be mapped in that
378 * endpoint's page table.
379 */
380 struct ffa_memory_access receivers[];
381};
382
383/**
384 * Descriptor used for FFA_MEM_RELINQUISH requests. This corresponds to table
385 * "Descriptor to relinquish a memory region" of the FFA 1.0 specification.
386 */
387struct ffa_mem_relinquish {
388 ffa_memory_handle_t handle;
389 ffa_memory_region_flags_t flags;
390 uint32_t endpoint_count;
Daniel Boulbye79d2072021-03-03 11:34:53 +0000391 ffa_id_t endpoints[];
J-Alvesf3a393c2020-10-23 16:00:39 +0100392};
393
394static inline ffa_memory_handle_t ffa_assemble_handle(uint32_t h1, uint32_t h2)
395{
J-Alves18c28052021-03-09 09:58:53 +0000396 return (ffa_notification_bitmap_t)h1 |
397 (ffa_notification_bitmap_t)h2 << 32;
J-Alvesf3a393c2020-10-23 16:00:39 +0100398}
399
400static inline ffa_memory_handle_t ffa_mem_success_handle(smc_ret_values r)
401{
402 return ffa_assemble_handle(r.ret2, r.ret3);
403}
404
405/**
406 * Gets the `ffa_composite_memory_region` for the given receiver from an
407 * `ffa_memory_region`, or NULL if it is not valid.
408 */
409static inline struct ffa_composite_memory_region *
410ffa_memory_region_get_composite(struct ffa_memory_region *memory_region,
411 uint32_t receiver_index)
412{
413 uint32_t offset = memory_region->receivers[receiver_index]
414 .composite_memory_region_offset;
415
416 if (offset == 0) {
417 return NULL;
418 }
419
420 return (struct ffa_composite_memory_region *)((uint8_t *)memory_region +
421 offset);
422}
423
424static inline uint32_t ffa_mem_relinquish_init(
425 struct ffa_mem_relinquish *relinquish_request,
426 ffa_memory_handle_t handle, ffa_memory_region_flags_t flags,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000427 ffa_id_t sender)
J-Alvesf3a393c2020-10-23 16:00:39 +0100428{
429 relinquish_request->handle = handle;
430 relinquish_request->flags = flags;
431 relinquish_request->endpoint_count = 1;
432 relinquish_request->endpoints[0] = sender;
Daniel Boulbye79d2072021-03-03 11:34:53 +0000433 return sizeof(struct ffa_mem_relinquish) + sizeof(ffa_id_t);
J-Alvesf3a393c2020-10-23 16:00:39 +0100434}
435
436uint32_t ffa_memory_retrieve_request_init(
437 struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000438 ffa_id_t sender, ffa_id_t receiver, uint32_t tag,
J-Alvesf3a393c2020-10-23 16:00:39 +0100439 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
440 enum ffa_instruction_access instruction_access,
441 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
442 enum ffa_memory_shareability shareability);
443
444uint32_t ffa_memory_region_init(
445 struct ffa_memory_region *memory_region, size_t memory_region_max_size,
Daniel Boulbye79d2072021-03-03 11:34:53 +0000446 ffa_id_t sender, ffa_id_t receiver,
J-Alvesf3a393c2020-10-23 16:00:39 +0100447 const struct ffa_memory_region_constituent constituents[],
448 uint32_t constituent_count, uint32_t tag,
449 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
450 enum ffa_instruction_access instruction_access,
451 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
452 enum ffa_memory_shareability shareability, uint32_t *total_length,
453 uint32_t *fragment_length);
454
Daniel Boulbye79d2072021-03-03 11:34:53 +0000455static inline ffa_id_t ffa_dir_msg_dest(smc_ret_values val) {
456 return (ffa_id_t)val.ret1 & U(0xFFFF);
J-Alves6cb21d92021-01-07 15:18:12 +0000457}
458
Daniel Boulbye79d2072021-03-03 11:34:53 +0000459static inline ffa_id_t ffa_dir_msg_source(smc_ret_values val) {
460 return (ffa_id_t)(val.ret1 >> 16U);
J-Alves6cb21d92021-01-07 15:18:12 +0000461}
462
Daniel Boulbye79d2072021-03-03 11:34:53 +0000463smc_ret_values ffa_msg_send_direct_req64(ffa_id_t source_id,
464 ffa_id_t dest_id, uint64_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000465 uint64_t arg1, uint64_t arg2,
466 uint64_t arg3, uint64_t arg4);
J-Alvesd1aae292020-10-08 17:16:58 +0100467
Daniel Boulbye79d2072021-03-03 11:34:53 +0000468smc_ret_values ffa_msg_send_direct_req32(ffa_id_t source_id,
469 ffa_id_t dest_id, uint32_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000470 uint32_t arg1, uint32_t arg2,
471 uint32_t arg3, uint32_t arg4);
472
Daniel Boulbye79d2072021-03-03 11:34:53 +0000473smc_ret_values ffa_msg_send_direct_resp64(ffa_id_t source_id,
474 ffa_id_t dest_id, uint64_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000475 uint64_t arg1, uint64_t arg2,
476 uint64_t arg3, uint64_t arg4);
477
Daniel Boulbye79d2072021-03-03 11:34:53 +0000478smc_ret_values ffa_msg_send_direct_resp32(ffa_id_t source_id,
479 ffa_id_t dest_id, uint32_t arg0,
J-Alvesecd30742021-02-19 18:31:06 +0000480 uint32_t arg1, uint32_t arg2,
481 uint32_t arg3, uint32_t arg4);
J-Alves035b7d02021-02-11 10:40:35 +0000482
J-Alves7581c382020-05-07 18:34:20 +0100483smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
J-Alves8f08a052020-05-26 17:14:40 +0100484smc_ret_values ffa_version(uint32_t input_version);
J-Alves5aecd982020-06-11 10:25:33 +0100485smc_ret_values ffa_id_get(void);
Daniel Boulby198deda2021-03-03 11:35:25 +0000486smc_ret_values ffa_spm_id_get(void);
J-Alves5aecd982020-06-11 10:25:33 +0100487smc_ret_values ffa_msg_wait(void);
J-Alves5aecd982020-06-11 10:25:33 +0100488smc_ret_values ffa_error(int32_t error_code);
Max Shvetsovc17c1d32020-06-11 15:03:01 +0100489smc_ret_values ffa_features(uint32_t feature);
Max Shvetsov0b7d25f2021-03-05 13:46:42 +0000490smc_ret_values ffa_partition_info_get(const struct ffa_uuid uuid);
Max Shvetsovc32f4782020-06-23 09:41:15 +0100491smc_ret_values ffa_rx_release(void);
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100492smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
Daniel Boulbye0602902021-07-07 11:14:39 +0100493smc_ret_values ffa_rxtx_unmap(void);
J-Alves3ea46d12020-09-09 11:13:05 +0100494smc_ret_values ffa_mem_donate(uint32_t descriptor_length,
495 uint32_t fragment_length);
496smc_ret_values ffa_mem_lend(uint32_t descriptor_length,
497 uint32_t fragment_length);
498smc_ret_values ffa_mem_share(uint32_t descriptor_length,
499 uint32_t fragment_length);
500smc_ret_values ffa_mem_retrieve_req(uint32_t descriptor_length,
501 uint32_t fragment_length);
502smc_ret_values ffa_mem_relinquish(void);
503smc_ret_values ffa_mem_reclaim(uint64_t handle, uint32_t flags);
J-Alvesbcb1f972021-03-11 14:03:54 +0000504smc_ret_values ffa_notification_bitmap_create(ffa_id_t vm_id,
505 ffa_vcpu_count_t vcpu_count);
506smc_ret_values ffa_notification_bitmap_destroy(ffa_id_t vm_id);
J-Alves18c28052021-03-09 09:58:53 +0000507smc_ret_values ffa_notification_bind(ffa_id_t sender, ffa_id_t receiver,
508 uint32_t flags,
509 ffa_notification_bitmap_t notifications);
510smc_ret_values ffa_notification_unbind(ffa_id_t sender, ffa_id_t receiver,
511 ffa_notification_bitmap_t notifications);
J-Alvesf156ae92021-10-08 12:10:05 +0100512smc_ret_values ffa_notification_set(ffa_id_t sender, ffa_id_t receiver,
513 uint32_t flags,
514 ffa_notification_bitmap_t bitmap);
515smc_ret_values ffa_notification_get(ffa_id_t receiver, uint32_t vcpu_id,
516 uint32_t flags);
J-Alves5bce2502021-06-14 14:27:45 +0100517smc_ret_values ffa_notification_info_get(void);
J-Alves7581c382020-05-07 18:34:20 +0100518#endif /* __ASSEMBLY__ */
519
520#endif /* FFA_HELPERS_H */