blob: 4e09301a161165d729de28bc344ea5faea6bf0fa [file] [log] [blame]
Andrew Walbranb5ab43c2020-04-30 11:32:54 +01001/*
J-Alves13318e32021-02-22 17:21:00 +00002 * Copyright 2021 The Hafnium Authors.
Andrew Walbranb5ab43c2020-04-30 11:32:54 +01003 *
Andrew Walbrane959ec12020-06-17 15:01:09 +01004 * 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.
Andrew Walbranb5ab43c2020-04-30 11:32:54 +01007 */
8
9#pragma once
10
11#include "hf/types.h"
12
Olivier Deprez62d99e32020-01-09 15:58:07 +010013#define FFA_VERSION_MAJOR 0x1
14#define FFA_VERSION_MINOR 0x0
15
16#define FFA_VERSION_MAJOR_OFFSET 16
17
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010018/* clang-format off */
19
20#define FFA_LOW_32_ID 0x84000060
21#define FFA_HIGH_32_ID 0x8400007F
22#define FFA_LOW_64_ID 0xC4000060
Fuad Tabbada72d142020-07-30 09:17:05 +010023#define FFA_HIGH_64_ID 0xC400007F
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010024
25/* FF-A function identifiers. */
26#define FFA_ERROR_32 0x84000060
27#define FFA_SUCCESS_32 0x84000061
28#define FFA_INTERRUPT_32 0x84000062
29#define FFA_VERSION_32 0x84000063
30#define FFA_FEATURES_32 0x84000064
31#define FFA_RX_RELEASE_32 0x84000065
32#define FFA_RXTX_MAP_32 0x84000066
33#define FFA_RXTX_MAP_64 0xC4000066
34#define FFA_RXTX_UNMAP_32 0x84000067
35#define FFA_PARTITION_INFO_GET_32 0x84000068
36#define FFA_ID_GET_32 0x84000069
37#define FFA_MSG_POLL_32 0x8400006A
38#define FFA_MSG_WAIT_32 0x8400006B
39#define FFA_YIELD_32 0x8400006C
40#define FFA_RUN_32 0x8400006D
41#define FFA_MSG_SEND_32 0x8400006E
42#define FFA_MSG_SEND_DIRECT_REQ_32 0x8400006F
43#define FFA_MSG_SEND_DIRECT_RESP_32 0x84000070
44#define FFA_MEM_DONATE_32 0x84000071
45#define FFA_MEM_LEND_32 0x84000072
46#define FFA_MEM_SHARE_32 0x84000073
47#define FFA_MEM_RETRIEVE_REQ_32 0x84000074
48#define FFA_MEM_RETRIEVE_RESP_32 0x84000075
49#define FFA_MEM_RELINQUISH_32 0x84000076
50#define FFA_MEM_RECLAIM_32 0x84000077
Andrew Walbranca808b12020-05-15 17:22:28 +010051#define FFA_MEM_FRAG_RX_32 0x8400007A
52#define FFA_MEM_FRAG_TX_32 0x8400007B
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010053
54/* FF-A error codes. */
55#define FFA_NOT_SUPPORTED INT32_C(-1)
56#define FFA_INVALID_PARAMETERS INT32_C(-2)
57#define FFA_NO_MEMORY INT32_C(-3)
58#define FFA_BUSY INT32_C(-4)
59#define FFA_INTERRUPTED INT32_C(-5)
60#define FFA_DENIED INT32_C(-6)
61#define FFA_RETRY INT32_C(-7)
62#define FFA_ABORTED INT32_C(-8)
63
64/* clang-format on */
65
66/* FF-A function specific constants. */
67#define FFA_MSG_RECV_BLOCK 0x1
68#define FFA_MSG_RECV_BLOCK_MASK 0x1
69
70#define FFA_MSG_SEND_NOTIFY 0x1
71#define FFA_MSG_SEND_NOTIFY_MASK 0x1
72
73#define FFA_MEM_RECLAIM_CLEAR 0x1
74
75#define FFA_SLEEP_INDEFINITE 0
76
77/**
78 * For use where the FF-A specification refers explicitly to '4K pages'. Not to
79 * be confused with PAGE_SIZE, which is the translation granule Hafnium is
80 * configured to use.
81 */
82#define FFA_PAGE_SIZE 4096
83
84/* The maximum length possible for a single message. */
85#define FFA_MSG_PAYLOAD_MAX HF_MAILBOX_SIZE
86
87enum ffa_data_access {
88 FFA_DATA_ACCESS_NOT_SPECIFIED,
89 FFA_DATA_ACCESS_RO,
90 FFA_DATA_ACCESS_RW,
91 FFA_DATA_ACCESS_RESERVED,
92};
93
94enum ffa_instruction_access {
95 FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED,
96 FFA_INSTRUCTION_ACCESS_NX,
97 FFA_INSTRUCTION_ACCESS_X,
98 FFA_INSTRUCTION_ACCESS_RESERVED,
99};
100
101enum ffa_memory_type {
102 FFA_MEMORY_NOT_SPECIFIED_MEM,
103 FFA_MEMORY_DEVICE_MEM,
104 FFA_MEMORY_NORMAL_MEM,
105};
106
107enum ffa_memory_cacheability {
108 FFA_MEMORY_CACHE_RESERVED = 0x0,
109 FFA_MEMORY_CACHE_NON_CACHEABLE = 0x1,
110 FFA_MEMORY_CACHE_RESERVED_1 = 0x2,
111 FFA_MEMORY_CACHE_WRITE_BACK = 0x3,
112 FFA_MEMORY_DEV_NGNRNE = 0x0,
113 FFA_MEMORY_DEV_NGNRE = 0x1,
114 FFA_MEMORY_DEV_NGRE = 0x2,
115 FFA_MEMORY_DEV_GRE = 0x3,
116};
117
118enum ffa_memory_shareability {
119 FFA_MEMORY_SHARE_NON_SHAREABLE,
120 FFA_MEMORY_SHARE_RESERVED,
121 FFA_MEMORY_OUTER_SHAREABLE,
122 FFA_MEMORY_INNER_SHAREABLE,
123};
124
125typedef uint8_t ffa_memory_access_permissions_t;
126
127/**
128 * This corresponds to table 44 of the FF-A 1.0 EAC specification, "Memory
129 * region attributes descriptor".
130 */
131typedef uint8_t ffa_memory_attributes_t;
132
133#define FFA_DATA_ACCESS_OFFSET (0x0U)
134#define FFA_DATA_ACCESS_MASK ((0x3U) << FFA_DATA_ACCESS_OFFSET)
135
136#define FFA_INSTRUCTION_ACCESS_OFFSET (0x2U)
137#define FFA_INSTRUCTION_ACCESS_MASK ((0x3U) << FFA_INSTRUCTION_ACCESS_OFFSET)
138
139#define FFA_MEMORY_TYPE_OFFSET (0x4U)
140#define FFA_MEMORY_TYPE_MASK ((0x3U) << FFA_MEMORY_TYPE_OFFSET)
141
142#define FFA_MEMORY_CACHEABILITY_OFFSET (0x2U)
143#define FFA_MEMORY_CACHEABILITY_MASK ((0x3U) << FFA_MEMORY_CACHEABILITY_OFFSET)
144
145#define FFA_MEMORY_SHAREABILITY_OFFSET (0x0U)
146#define FFA_MEMORY_SHAREABILITY_MASK ((0x3U) << FFA_MEMORY_SHAREABILITY_OFFSET)
147
148#define ATTR_FUNCTION_SET(name, container_type, offset, mask) \
149 static inline void ffa_set_##name##_attr(container_type *attr, \
150 const enum ffa_##name perm) \
151 { \
152 *attr = (*attr & ~(mask)) | ((perm << offset) & mask); \
153 }
154
155#define ATTR_FUNCTION_GET(name, container_type, offset, mask) \
156 static inline enum ffa_##name ffa_get_##name##_attr( \
157 container_type attr) \
158 { \
159 return (enum ffa_##name)((attr & mask) >> offset); \
160 }
161
162ATTR_FUNCTION_SET(data_access, ffa_memory_access_permissions_t,
163 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
164ATTR_FUNCTION_GET(data_access, ffa_memory_access_permissions_t,
165 FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
166
167ATTR_FUNCTION_SET(instruction_access, ffa_memory_access_permissions_t,
168 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
169ATTR_FUNCTION_GET(instruction_access, ffa_memory_access_permissions_t,
170 FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
171
172ATTR_FUNCTION_SET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
173 FFA_MEMORY_TYPE_MASK)
174ATTR_FUNCTION_GET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
175 FFA_MEMORY_TYPE_MASK)
176
177ATTR_FUNCTION_SET(memory_cacheability, ffa_memory_attributes_t,
178 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
179ATTR_FUNCTION_GET(memory_cacheability, ffa_memory_attributes_t,
180 FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
181
182ATTR_FUNCTION_SET(memory_shareability, ffa_memory_attributes_t,
183 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
184ATTR_FUNCTION_GET(memory_shareability, ffa_memory_attributes_t,
185 FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
186
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100187/**
188 * A globally-unique ID assigned by the hypervisor for a region of memory being
189 * sent between VMs.
190 */
191typedef uint64_t ffa_memory_handle_t;
192
J-Alves917d2f22020-10-30 18:39:30 +0000193#define FFA_MEMORY_HANDLE_ALLOCATOR_MASK \
194 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
195#define FFA_MEMORY_HANDLE_ALLOCATOR_HYPERVISOR \
196 ((ffa_memory_handle_t)(UINT64_C(1) << 63))
197
198#define FFA_MEMORY_HANDLE_ALLOCATOR_SPMC (UINT64_C(0) << 63)
199#define FFA_MEMORY_HANDLE_INVALID (~UINT64_C(0))
200
201/** The ID of a VM. These are assigned sequentially starting with an offset. */
202typedef uint16_t ffa_vm_id_t;
203
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100204/**
205 * A count of VMs. This has the same range as the VM IDs but we give it a
206 * different name to make the different semantics clear.
207 */
208typedef ffa_vm_id_t ffa_vm_count_t;
209
210/** The index of a vCPU within a particular VM. */
211typedef uint16_t ffa_vcpu_index_t;
212
213/**
214 * A count of vCPUs. This has the same range as the vCPU indices but we give it
215 * a different name to make the different semantics clear.
216 */
217typedef ffa_vcpu_index_t ffa_vcpu_count_t;
218
219/** Parameter and return type of FF-A functions. */
220struct ffa_value {
221 uint64_t func;
222 uint64_t arg1;
223 uint64_t arg2;
224 uint64_t arg3;
225 uint64_t arg4;
226 uint64_t arg5;
227 uint64_t arg6;
228 uint64_t arg7;
229};
230
J-Alves13318e32021-02-22 17:21:00 +0000231static inline int32_t ffa_error_code(struct ffa_value val)
232{
233 return (int32_t)val.arg2;
234}
235
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100236static inline ffa_vm_id_t ffa_msg_send_sender(struct ffa_value args)
237{
238 return (args.arg1 >> 16) & 0xffff;
239}
240
241static inline ffa_vm_id_t ffa_msg_send_receiver(struct ffa_value args)
242{
243 return args.arg1 & 0xffff;
244}
245
246static inline uint32_t ffa_msg_send_size(struct ffa_value args)
247{
248 return args.arg3;
249}
250
251static inline uint32_t ffa_msg_send_attributes(struct ffa_value args)
252{
253 return args.arg4;
254}
255
Andrew Walbran1bbe9402020-04-30 16:47:13 +0100256static inline ffa_memory_handle_t ffa_assemble_handle(uint32_t a1, uint32_t a2)
257{
258 return (uint64_t)a1 | (uint64_t)a2 << 32;
259}
260
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100261static inline ffa_memory_handle_t ffa_mem_success_handle(struct ffa_value args)
262{
Andrew Walbran1bbe9402020-04-30 16:47:13 +0100263 return ffa_assemble_handle(args.arg2, args.arg3);
264}
265
Andrew Walbranca808b12020-05-15 17:22:28 +0100266static inline ffa_memory_handle_t ffa_frag_handle(struct ffa_value args)
267{
268 return ffa_assemble_handle(args.arg1, args.arg2);
269}
270
Andrew Walbran1bbe9402020-04-30 16:47:13 +0100271static inline struct ffa_value ffa_mem_success(ffa_memory_handle_t handle)
272{
273 return (struct ffa_value){.func = FFA_SUCCESS_32,
274 .arg2 = (uint32_t)handle,
275 .arg3 = (uint32_t)(handle >> 32)};
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100276}
277
278static inline ffa_vm_id_t ffa_vm_id(struct ffa_value args)
279{
280 return (args.arg1 >> 16) & 0xffff;
281}
282
283static inline ffa_vcpu_index_t ffa_vcpu_index(struct ffa_value args)
284{
285 return args.arg1 & 0xffff;
286}
287
288static inline uint64_t ffa_vm_vcpu(ffa_vm_id_t vm_id,
289 ffa_vcpu_index_t vcpu_index)
290{
291 return ((uint32_t)vm_id << 16) | vcpu_index;
292}
293
Andrew Walbranca808b12020-05-15 17:22:28 +0100294static inline ffa_vm_id_t ffa_frag_sender(struct ffa_value args)
295{
296 return (args.arg4 >> 16) & 0xffff;
297}
298
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100299/**
Fuad Tabbae4efcc32020-07-16 15:37:27 +0100300 * Holds the UUID in a struct that is mappable directly to the SMCC calling
301 * convention, which is used for FF-A calls.
302 *
303 * Refer to table 84 of the FF-A 1.0 EAC specification as well as section 5.3
304 * of the SMCC Spec 1.2.
305 */
306struct ffa_uuid {
307 uint32_t uuid[4];
308};
309
310static inline void ffa_uuid_init(uint32_t w0, uint32_t w1, uint32_t w2,
311 uint32_t w3, struct ffa_uuid *uuid)
312{
313 uuid->uuid[0] = w0;
314 uuid->uuid[1] = w1;
315 uuid->uuid[2] = w2;
316 uuid->uuid[3] = w3;
317}
318
319static inline bool ffa_uuid_equal(const struct ffa_uuid *uuid1,
320 const struct ffa_uuid *uuid2)
321{
322 return (uuid1->uuid[0] == uuid2->uuid[0]) &&
323 (uuid1->uuid[1] == uuid2->uuid[1]) &&
324 (uuid1->uuid[2] == uuid2->uuid[2]) &&
325 (uuid1->uuid[3] == uuid2->uuid[3]);
326}
327
328static inline bool ffa_uuid_is_null(const struct ffa_uuid *uuid)
329{
330 return (uuid->uuid[0] == 0) && (uuid->uuid[1] == 0) &&
331 (uuid->uuid[2] == 0) && (uuid->uuid[3] == 0);
332}
333
334/**
335 * Flags to determine the partition properties, as required by
336 * FFA_PARTITION_INFO_GET.
337 *
338 * The values of the flags are specified in table 82 of the FF-A 1.0 EAC
339 * specification, "Partition information descriptor, partition properties".
340 */
341typedef uint32_t ffa_partition_properties_t;
342
343/** Partition property: partition supports receipt of direct requests. */
344#define FFA_PARTITION_DIRECT_RECV 0x1
345
346/** Partition property: partition can send direct requests. */
347#define FFA_PARTITION_DIRECT_SEND 0x2
348
349/** Partition property: partition can send and receive indirect messages. */
350#define FFA_PARTITION_INDIRECT_MSG 0x4
351
352/**
353 * Holds information returned for each partition by the FFA_PARTITION_INFO_GET
354 * interface.
355 * This corresponds to table 82 of the FF-A 1.0 EAC specification, "Partition
356 * information descriptor".
357 */
358struct ffa_partition_info {
359 ffa_vm_id_t vm_id;
360 ffa_vcpu_count_t vcpu_count;
361 ffa_partition_properties_t properties;
362};
363
364/**
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100365 * A set of contiguous pages which is part of a memory region. This corresponds
366 * to table 40 of the FF-A 1.0 EAC specification, "Constituent memory region
367 * descriptor".
368 */
369struct ffa_memory_region_constituent {
370 /**
371 * The base IPA of the constituent memory region, aligned to 4 kiB page
372 * size granularity.
373 */
374 uint64_t address;
375 /** The number of 4 kiB pages in the constituent memory region. */
376 uint32_t page_count;
377 /** Reserved field, must be 0. */
378 uint32_t reserved;
379};
380
381/**
382 * A set of pages comprising a memory region. This corresponds to table 39 of
383 * the FF-A 1.0 EAC specification, "Composite memory region descriptor".
384 */
385struct ffa_composite_memory_region {
386 /**
387 * The total number of 4 kiB pages included in this memory region. This
388 * must be equal to the sum of page counts specified in each
389 * `ffa_memory_region_constituent`.
390 */
391 uint32_t page_count;
392 /**
393 * The number of constituents (`ffa_memory_region_constituent`)
394 * included in this memory region range.
395 */
396 uint32_t constituent_count;
397 /** Reserved field, must be 0. */
398 uint64_t reserved_0;
399 /** An array of `constituent_count` memory region constituents. */
400 struct ffa_memory_region_constituent constituents[];
401};
402
403/** Flags to indicate properties of receivers during memory region retrieval. */
404typedef uint8_t ffa_memory_receiver_flags_t;
405
406/**
407 * This corresponds to table 41 of the FF-A 1.0 EAC specification, "Memory
408 * access permissions descriptor".
409 */
410struct ffa_memory_region_attributes {
411 /** The ID of the VM to which the memory is being given or shared. */
412 ffa_vm_id_t receiver;
413 /**
414 * The permissions with which the memory region should be mapped in the
415 * receiver's page table.
416 */
417 ffa_memory_access_permissions_t permissions;
418 /**
419 * Flags used during FFA_MEM_RETRIEVE_REQ and FFA_MEM_RETRIEVE_RESP
420 * for memory regions with multiple borrowers.
421 */
422 ffa_memory_receiver_flags_t flags;
423};
424
425/** Flags to control the behaviour of a memory sharing transaction. */
426typedef uint32_t ffa_memory_region_flags_t;
427
428/**
429 * Clear memory region contents after unmapping it from the sender and before
430 * mapping it for any receiver.
431 */
432#define FFA_MEMORY_REGION_FLAG_CLEAR 0x1
433
434/**
435 * Whether the hypervisor may time slice the memory sharing or retrieval
436 * operation.
437 */
438#define FFA_MEMORY_REGION_FLAG_TIME_SLICE 0x2
439
440/**
441 * Whether the hypervisor should clear the memory region after the receiver
442 * relinquishes it or is aborted.
443 */
444#define FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH 0x4
445
446#define FFA_MEMORY_REGION_TRANSACTION_TYPE_MASK ((0x3U) << 3)
447#define FFA_MEMORY_REGION_TRANSACTION_TYPE_UNSPECIFIED ((0x0U) << 3)
448#define FFA_MEMORY_REGION_TRANSACTION_TYPE_SHARE ((0x1U) << 3)
449#define FFA_MEMORY_REGION_TRANSACTION_TYPE_LEND ((0x2U) << 3)
450#define FFA_MEMORY_REGION_TRANSACTION_TYPE_DONATE ((0x3U) << 3)
451
452/**
453 * This corresponds to table 42 of the FF-A 1.0 EAC specification, "Endpoint
454 * memory access descriptor".
455 */
456struct ffa_memory_access {
457 struct ffa_memory_region_attributes receiver_permissions;
458 /**
459 * Offset in bytes from the start of the outer `ffa_memory_region` to
460 * an `ffa_composite_memory_region` struct.
461 */
462 uint32_t composite_memory_region_offset;
463 uint64_t reserved_0;
464};
465
466/**
467 * Information about a set of pages which are being shared. This corresponds to
468 * table 45 of the FF-A 1.0 EAC specification, "Lend, donate or share memory
469 * transaction descriptor". Note that it is also used for retrieve requests and
470 * responses.
471 */
472struct ffa_memory_region {
473 /**
474 * The ID of the VM which originally sent the memory region, i.e. the
475 * owner.
476 */
477 ffa_vm_id_t sender;
478 ffa_memory_attributes_t attributes;
479 /** Reserved field, must be 0. */
480 uint8_t reserved_0;
481 /** Flags to control behaviour of the transaction. */
482 ffa_memory_region_flags_t flags;
483 ffa_memory_handle_t handle;
484 /**
485 * An implementation defined value associated with the receiver and the
486 * memory region.
487 */
488 uint64_t tag;
489 /** Reserved field, must be 0. */
490 uint32_t reserved_1;
491 /**
492 * The number of `ffa_memory_access` entries included in this
493 * transaction.
494 */
495 uint32_t receiver_count;
496 /**
497 * An array of `attribute_count` endpoint memory access descriptors.
498 * Each one specifies a memory region offset, an endpoint and the
499 * attributes with which this memory region should be mapped in that
500 * endpoint's page table.
501 */
502 struct ffa_memory_access receivers[];
503};
504
505/**
506 * Descriptor used for FFA_MEM_RELINQUISH requests. This corresponds to table
507 * 150 of the FF-A 1.0 EAC specification, "Descriptor to relinquish a memory
508 * region".
509 */
510struct ffa_mem_relinquish {
511 ffa_memory_handle_t handle;
512 ffa_memory_region_flags_t flags;
513 uint32_t endpoint_count;
514 ffa_vm_id_t endpoints[];
515};
516
517/**
518 * Gets the `ffa_composite_memory_region` for the given receiver from an
519 * `ffa_memory_region`, or NULL if it is not valid.
520 */
521static inline struct ffa_composite_memory_region *
522ffa_memory_region_get_composite(struct ffa_memory_region *memory_region,
523 uint32_t receiver_index)
524{
525 uint32_t offset = memory_region->receivers[receiver_index]
526 .composite_memory_region_offset;
527
528 if (offset == 0) {
529 return NULL;
530 }
531
532 return (struct ffa_composite_memory_region *)((uint8_t *)memory_region +
533 offset);
534}
535
536static inline uint32_t ffa_mem_relinquish_init(
537 struct ffa_mem_relinquish *relinquish_request,
538 ffa_memory_handle_t handle, ffa_memory_region_flags_t flags,
539 ffa_vm_id_t sender)
540{
541 relinquish_request->handle = handle;
542 relinquish_request->flags = flags;
543 relinquish_request->endpoint_count = 1;
544 relinquish_request->endpoints[0] = sender;
545 return sizeof(struct ffa_mem_relinquish) + sizeof(ffa_vm_id_t);
546}
547
548uint32_t ffa_memory_region_init(
Andrew Walbranca808b12020-05-15 17:22:28 +0100549 struct ffa_memory_region *memory_region, size_t memory_region_max_size,
550 ffa_vm_id_t sender, ffa_vm_id_t receiver,
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100551 const struct ffa_memory_region_constituent constituents[],
552 uint32_t constituent_count, uint32_t tag,
553 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
554 enum ffa_instruction_access instruction_access,
555 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
Andrew Walbranca808b12020-05-15 17:22:28 +0100556 enum ffa_memory_shareability shareability, uint32_t *fragment_length,
557 uint32_t *total_length);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100558uint32_t ffa_memory_retrieve_request_init(
559 struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
560 ffa_vm_id_t sender, ffa_vm_id_t receiver, uint32_t tag,
561 ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
562 enum ffa_instruction_access instruction_access,
563 enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
564 enum ffa_memory_shareability shareability);
565uint32_t ffa_memory_lender_retrieve_request_init(
566 struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
567 ffa_vm_id_t sender);
Andrew Walbranca808b12020-05-15 17:22:28 +0100568bool ffa_retrieved_memory_region_init(
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100569 struct ffa_memory_region *response, size_t response_max_size,
570 ffa_vm_id_t sender, ffa_memory_attributes_t attributes,
571 ffa_memory_region_flags_t flags, ffa_memory_handle_t handle,
572 ffa_vm_id_t receiver, ffa_memory_access_permissions_t permissions,
Andrew Walbranca808b12020-05-15 17:22:28 +0100573 uint32_t page_count, uint32_t total_constituent_count,
Andrew Walbranb5ab43c2020-04-30 11:32:54 +0100574 const struct ffa_memory_region_constituent constituents[],
Andrew Walbranca808b12020-05-15 17:22:28 +0100575 uint32_t fragment_constituent_count, uint32_t *total_length,
576 uint32_t *fragment_length);
577uint32_t ffa_memory_fragment_init(
578 struct ffa_memory_region_constituent *fragment,
579 size_t fragment_max_size,
580 const struct ffa_memory_region_constituent constituents[],
581 uint32_t constituent_count, uint32_t *fragment_length);