SPCI is now called PSA FF-A.
Change-Id: Iaa10e0449edf5f6493ab21e648219392b17cc5ec
diff --git a/inc/hf/api.h b/inc/hf/api.h
index 07b9061..e56a2d2 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -21,15 +21,15 @@
#include "hf/vm.h"
#include "vmapi/hf/call.h"
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
void api_init(struct mpool *ppool);
-spci_vm_count_t api_vm_get_count(void);
-spci_vcpu_count_t api_vcpu_get_count(spci_vm_id_t vm_id,
- const struct vcpu *current);
+ffa_vm_count_t api_vm_get_count(void);
+ffa_vcpu_count_t api_vcpu_get_count(ffa_vm_id_t vm_id,
+ const struct vcpu *current);
void api_regs_state_saved(struct vcpu *vcpu);
int64_t api_mailbox_writable_get(const struct vcpu *current);
-int64_t api_mailbox_waiter_get(spci_vm_id_t vm_id, const struct vcpu *current);
+int64_t api_mailbox_waiter_get(ffa_vm_id_t vm_id, const struct vcpu *current);
int64_t api_debug_log(char c, struct vcpu *current);
struct vcpu *api_preempt(struct vcpu *current);
@@ -40,36 +40,35 @@
int64_t api_interrupt_enable(uint32_t intid, bool enable, struct vcpu *current);
uint32_t api_interrupt_get(struct vcpu *current);
-int64_t api_interrupt_inject(spci_vm_id_t target_vm_id,
- spci_vcpu_index_t target_vcpu_idx, uint32_t intid,
+int64_t api_interrupt_inject(ffa_vm_id_t target_vm_id,
+ ffa_vcpu_index_t target_vcpu_idx, uint32_t intid,
struct vcpu *current, struct vcpu **next);
-struct spci_value api_spci_msg_send(spci_vm_id_t sender_vm_id,
- spci_vm_id_t receiver_vm_id, uint32_t size,
- uint32_t attributes, struct vcpu *current,
- struct vcpu **next);
-struct spci_value api_spci_msg_recv(bool block, struct vcpu *current,
- struct vcpu **next);
-struct spci_value api_spci_rx_release(struct vcpu *current, struct vcpu **next);
-struct spci_value api_spci_rxtx_map(ipaddr_t send, ipaddr_t recv,
- uint32_t page_count, struct vcpu *current,
- struct vcpu **next);
+struct ffa_value api_ffa_msg_send(ffa_vm_id_t sender_vm_id,
+ ffa_vm_id_t receiver_vm_id, uint32_t size,
+ uint32_t attributes, struct vcpu *current,
+ struct vcpu **next);
+struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
+ struct vcpu **next);
+struct ffa_value api_ffa_rx_release(struct vcpu *current, struct vcpu **next);
+struct ffa_value api_ffa_rxtx_map(ipaddr_t send, ipaddr_t recv,
+ uint32_t page_count, struct vcpu *current,
+ struct vcpu **next);
void api_yield(struct vcpu *current, struct vcpu **next);
-struct spci_value api_spci_version(uint32_t requested_version);
-struct spci_value api_spci_id_get(const struct vcpu *current);
-struct spci_value api_spci_features(uint32_t function_id);
-struct spci_value api_spci_run(spci_vm_id_t vm_id, spci_vcpu_index_t vcpu_idx,
- const struct vcpu *current, struct vcpu **next);
-struct spci_value api_spci_mem_send(uint32_t share_func, uint32_t length,
- uint32_t fragment_length, ipaddr_t address,
- uint32_t page_count, struct vcpu *current,
- struct vcpu **next);
-struct spci_value api_spci_mem_retrieve_req(uint32_t length,
- uint32_t fragment_length,
- ipaddr_t address,
- uint32_t page_count,
- struct vcpu *current);
-struct spci_value api_spci_mem_relinquish(struct vcpu *current);
-struct spci_value api_spci_mem_reclaim(spci_memory_handle_t handle,
- spci_memory_region_flags_t flags,
- struct vcpu *current);
+struct ffa_value api_ffa_version(uint32_t requested_version);
+struct ffa_value api_ffa_id_get(const struct vcpu *current);
+struct ffa_value api_ffa_features(uint32_t function_id);
+struct ffa_value api_ffa_run(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx,
+ const struct vcpu *current, struct vcpu **next);
+struct ffa_value api_ffa_mem_send(uint32_t share_func, uint32_t length,
+ uint32_t fragment_length, ipaddr_t address,
+ uint32_t page_count, struct vcpu *current,
+ struct vcpu **next);
+struct ffa_value api_ffa_mem_retrieve_req(uint32_t length,
+ uint32_t fragment_length,
+ ipaddr_t address, uint32_t page_count,
+ struct vcpu *current);
+struct ffa_value api_ffa_mem_relinquish(struct vcpu *current);
+struct ffa_value api_ffa_mem_reclaim(ffa_memory_handle_t handle,
+ ffa_memory_region_flags_t flags,
+ struct vcpu *current);
diff --git a/inc/hf/arch/cpu.h b/inc/hf/arch/cpu.h
index a7fe5a8..171abaa 100644
--- a/inc/hf/arch/cpu.h
+++ b/inc/hf/arch/cpu.h
@@ -25,7 +25,7 @@
#include "hf/addr.h"
#include "hf/vcpu.h"
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
/**
* Reset the register values other than the PC and argument which are set with
@@ -48,7 +48,7 @@
* This function must only be called on an arch_regs that is known not be in use
* by any other physical CPU.
*/
-void arch_regs_set_retval(struct arch_regs *r, struct spci_value v);
+void arch_regs_set_retval(struct arch_regs *r, struct ffa_value v);
/**
* Initialize and reset CPU-wide register values.
diff --git a/inc/hf/arch/plat/smc.h b/inc/hf/arch/plat/smc.h
index 29493fc..4d5b9a0 100644
--- a/inc/hf/arch/plat/smc.h
+++ b/inc/hf/arch/plat/smc.h
@@ -16,11 +16,11 @@
#pragma once
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
/**
* Called after an SMC has been forwarded. `args` contains the arguments passed
* to the SMC and `ret` contains the return values that will be set in the vCPU
* registers after this call returns.
*/
-void plat_smc_post_forward(struct spci_value args, struct spci_value *ret);
+void plat_smc_post_forward(struct ffa_value args, struct ffa_value *ret);
diff --git a/inc/hf/arch/tee.h b/inc/hf/arch/tee.h
index f37fe0b..5cf4f81 100644
--- a/inc/hf/arch/tee.h
+++ b/inc/hf/arch/tee.h
@@ -16,7 +16,7 @@
#pragma once
-#include "hf/spci.h"
+#include "hf/ffa.h"
void arch_tee_init(void);
-struct spci_value arch_tee_call(struct spci_value args);
+struct ffa_value arch_tee_call(struct ffa_value args);
diff --git a/inc/hf/dlog.h b/inc/hf/dlog.h
index 5451f85..65b3ac2 100644
--- a/inc/hf/dlog.h
+++ b/inc/hf/dlog.h
@@ -19,7 +19,7 @@
#include <stdarg.h>
#include <stddef.h>
-#include "hf/spci.h"
+#include "hf/ffa.h"
#define DLOG_BUFFER_SIZE 8192
@@ -67,4 +67,4 @@
#define dlog_verbose(...)
#endif
-void dlog_flush_vm_buffer(spci_vm_id_t id, char buffer[], size_t length);
+void dlog_flush_vm_buffer(ffa_vm_id_t id, char buffer[], size_t length);
diff --git a/inc/hf/spci_internal.h b/inc/hf/ffa_internal.h
similarity index 67%
rename from inc/hf/spci_internal.h
rename to inc/hf/ffa_internal.h
index 1c2ccff..201f04f 100644
--- a/inc/hf/spci_internal.h
+++ b/inc/hf/ffa_internal.h
@@ -18,15 +18,15 @@
#include <stdint.h>
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
-#define SPCI_VERSION_MAJOR 0x1
-#define SPCI_VERSION_MINOR 0x0
+#define FFA_VERSION_MAJOR 0x1
+#define FFA_VERSION_MINOR 0x0
-#define SPCI_VERSION_MAJOR_OFFSET 16
-#define SPCI_VERSION_RESERVED_BIT UINT32_C(1U << 31)
+#define FFA_VERSION_MAJOR_OFFSET 16
+#define FFA_VERSION_RESERVED_BIT UINT32_C(1U << 31)
-static inline struct spci_value spci_error(uint64_t error_code)
+static inline struct ffa_value ffa_error(uint64_t error_code)
{
- return (struct spci_value){.func = SPCI_ERROR_32, .arg2 = error_code};
+ return (struct ffa_value){.func = FFA_ERROR_32, .arg2 = error_code};
}
diff --git a/inc/hf/ffa_memory.h b/inc/hf/ffa_memory.h
new file mode 100644
index 0000000..c133f76
--- /dev/null
+++ b/inc/hf/ffa_memory.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2019 The Hafnium Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "hf/mpool.h"
+#include "hf/vm.h"
+
+#include "vmapi/hf/ffa.h"
+
+struct ffa_value ffa_memory_send(struct vm *to, struct vm_locked from_locked,
+ struct ffa_memory_region *memory_region,
+ uint32_t memory_share_size,
+ uint32_t share_func, struct mpool *page_pool);
+struct ffa_value ffa_memory_retrieve(struct vm_locked to_locked,
+ struct ffa_memory_region *retrieve_request,
+ uint32_t retrieve_request_size,
+ struct mpool *page_pool);
+struct ffa_value ffa_memory_relinquish(
+ struct vm_locked from_locked,
+ struct ffa_mem_relinquish *relinquish_request, struct mpool *page_pool);
+struct ffa_value ffa_memory_reclaim(struct vm_locked to_locked,
+ ffa_memory_handle_t handle, bool clear,
+ struct mpool *page_pool);
+struct ffa_value ffa_memory_tee_reclaim(struct vm_locked to_locked,
+ ffa_memory_handle_t handle,
+ struct ffa_memory_region *memory_region,
+ bool clear, struct mpool *page_pool);
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
index 4c3c5dc..ab3a92f 100644
--- a/inc/hf/manifest.h
+++ b/inc/hf/manifest.h
@@ -16,8 +16,8 @@
#pragma once
+#include "hf/ffa.h"
#include "hf/memiter.h"
-#include "hf/spci.h"
#include "hf/string.h"
#include "hf/vm.h"
@@ -41,7 +41,7 @@
/* Properties specific to secondary VMs. */
struct {
uint64_t mem_size;
- spci_vcpu_count_t vcpu_count;
+ ffa_vcpu_count_t vcpu_count;
} secondary;
};
};
@@ -50,8 +50,8 @@
* Hafnium manifest parsed from FDT.
*/
struct manifest {
- bool spci_tee_enabled;
- spci_vm_count_t vm_count;
+ bool ffa_tee_enabled;
+ ffa_vm_count_t vm_count;
struct manifest_vm vm[MAX_VMS];
};
diff --git a/inc/hf/spci_memory.h b/inc/hf/spci_memory.h
deleted file mode 100644
index 7b6f086..0000000
--- a/inc/hf/spci_memory.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2019 The Hafnium Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "hf/mpool.h"
-#include "hf/vm.h"
-
-#include "vmapi/hf/spci.h"
-
-struct spci_value spci_memory_send(struct vm *to, struct vm_locked from_locked,
- struct spci_memory_region *memory_region,
- uint32_t memory_share_size,
- uint32_t share_func,
- struct mpool *page_pool);
-struct spci_value spci_memory_retrieve(
- struct vm_locked to_locked, struct spci_memory_region *retrieve_request,
- uint32_t retrieve_request_size, struct mpool *page_pool);
-struct spci_value spci_memory_relinquish(
- struct vm_locked from_locked,
- struct spci_mem_relinquish *relinquish_request,
- struct mpool *page_pool);
-struct spci_value spci_memory_reclaim(struct vm_locked to_locked,
- spci_memory_handle_t handle, bool clear,
- struct mpool *page_pool);
-struct spci_value spci_memory_tee_reclaim(
- struct vm_locked to_locked, spci_memory_handle_t handle,
- struct spci_memory_region *memory_region, bool clear,
- struct mpool *page_pool);
diff --git a/inc/hf/vcpu.h b/inc/hf/vcpu.h
index 87d5e8c..397ecff 100644
--- a/inc/hf/vcpu.h
+++ b/inc/hf/vcpu.h
@@ -19,7 +19,7 @@
#include "hf/addr.h"
#include "hf/spinlock.h"
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
/** The number of bits in each element of the interrupt bitfields. */
#define INTERRUPT_REGISTER_BITS 32
@@ -96,7 +96,7 @@
void vcpu_unlock(struct vcpu_locked *locked);
void vcpu_init(struct vcpu *vcpu, struct vm *vm);
void vcpu_on(struct vcpu_locked vcpu, ipaddr_t entry, uintreg_t arg);
-spci_vcpu_index_t vcpu_index(const struct vcpu *vcpu);
+ffa_vcpu_index_t vcpu_index(const struct vcpu *vcpu);
bool vcpu_is_off(struct vcpu_locked vcpu);
bool vcpu_secondary_reset_and_start(struct vcpu *vcpu, ipaddr_t entry,
uintreg_t arg);
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index 0d7735e..7803d3f 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -25,7 +25,7 @@
#include "hf/mm.h"
#include "hf/mpool.h"
-#include "vmapi/hf/spci.h"
+#include "vmapi/hf/ffa.h"
#define MAX_SMCS 32
#define LOG_BUFFER_SIZE 256
@@ -35,10 +35,10 @@
*
* EMPTY is the initial state. The follow state transitions are possible:
* * EMPTY → RECEIVED: message sent to the VM.
- * * RECEIVED → READ: secondary VM returns from SPCI_MSG_WAIT or
- * SPCI_MSG_POLL, or primary VM returns from SPCI_RUN with an SPCI_MSG_SEND
+ * * RECEIVED → READ: secondary VM returns from FFA_MSG_WAIT or
+ * FFA_MSG_POLL, or primary VM returns from FFA_RUN with an FFA_MSG_SEND
* where the receiver is itself.
- * * READ → EMPTY: VM called SPCI_RX_RELEASE.
+ * * READ → EMPTY: VM called FFA_RX_RELEASE.
*/
enum mailbox_state {
/** There is no message in the mailbox. */
@@ -74,13 +74,13 @@
const void *send;
/** The ID of the VM which sent the message currently in `recv`. */
- spci_vm_id_t recv_sender;
+ ffa_vm_id_t recv_sender;
/** The size of the message currently in `recv`. */
uint32_t recv_size;
/**
- * The SPCI function ID to use to deliver the message currently in
+ * The FF-A function ID to use to deliver the message currently in
* `recv`.
*/
uint32_t recv_func;
@@ -107,12 +107,12 @@
};
struct vm {
- spci_vm_id_t id;
+ ffa_vm_id_t id;
struct smc_whitelist smc_whitelist;
/** See api.c for the partial ordering on locks. */
struct spinlock lock;
- spci_vcpu_count_t vcpu_count;
+ ffa_vcpu_count_t vcpu_count;
struct vcpu vcpus[MAX_CPUS];
struct mm_ptable ptable;
struct mailbox mailbox;
@@ -142,18 +142,18 @@
struct vm_locked vm2;
};
-struct vm *vm_init(spci_vm_id_t id, spci_vcpu_count_t vcpu_count,
+struct vm *vm_init(ffa_vm_id_t id, ffa_vcpu_count_t vcpu_count,
struct mpool *ppool);
-bool vm_init_next(spci_vcpu_count_t vcpu_count, struct mpool *ppool,
+bool vm_init_next(ffa_vcpu_count_t vcpu_count, struct mpool *ppool,
struct vm **new_vm);
-spci_vm_count_t vm_get_count(void);
-struct vm *vm_find(spci_vm_id_t id);
+ffa_vm_count_t vm_get_count(void);
+struct vm *vm_find(ffa_vm_id_t id);
struct vm_locked vm_lock(struct vm *vm);
struct two_vm_locked vm_lock_both(struct vm *vm1, struct vm *vm2);
void vm_unlock(struct vm_locked *locked);
-struct vcpu *vm_get_vcpu(struct vm *vm, spci_vcpu_index_t vcpu_index);
-struct wait_entry *vm_get_wait_entry(struct vm *vm, spci_vm_id_t for_vm);
-spci_vm_id_t vm_id_for_wait_entry(struct vm *vm, struct wait_entry *entry);
+struct vcpu *vm_get_vcpu(struct vm *vm, ffa_vcpu_index_t vcpu_index);
+struct wait_entry *vm_get_wait_entry(struct vm *vm, ffa_vm_id_t for_vm);
+ffa_vm_id_t vm_id_for_wait_entry(struct vm *vm, struct wait_entry *entry);
bool vm_identity_map(struct vm_locked vm_locked, paddr_t begin, paddr_t end,
uint32_t mode, struct mpool *ppool, ipaddr_t *ipa);
diff --git a/inc/vmapi/hf/abi.h b/inc/vmapi/hf/abi.h
index ed004b7..cc6d14c 100644
--- a/inc/vmapi/hf/abi.h
+++ b/inc/vmapi/hf/abi.h
@@ -16,7 +16,7 @@
#pragma once
-#include "hf/spci.h"
+#include "hf/ffa.h"
#include "hf/types.h"
/* Keep macro alignment */
@@ -31,9 +31,9 @@
#define HF_INTERRUPT_GET 0xff06
#define HF_INTERRUPT_INJECT 0xff07
-/* Custom SPCI-like calls returned from SPCI_RUN. */
-#define HF_SPCI_RUN_WAIT_FOR_INTERRUPT 0xff09
-#define HF_SPCI_RUN_WAKE_UP 0xff0a
+/* Custom FF-A-like calls returned from FFA_RUN. */
+#define HF_FFA_RUN_WAIT_FOR_INTERRUPT 0xff09
+#define HF_FFA_RUN_WAKE_UP 0xff0a
/* This matches what Trusty and its ATF module currently use. */
#define HF_DEBUG_LOG 0xbd000000
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index 1fa31cf..1416f77 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -17,7 +17,7 @@
#pragma once
#include "hf/abi.h"
-#include "hf/spci.h"
+#include "hf/ffa.h"
#include "hf/types.h"
/**
@@ -25,28 +25,28 @@
* mechanism to call to the hypervisor.
*/
int64_t hf_call(uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3);
-struct spci_value spci_call(struct spci_value args);
+struct ffa_value ffa_call(struct ffa_value args);
/**
* Returns the VM's own ID.
*/
-static inline struct spci_value spci_id_get(void)
+static inline struct ffa_value ffa_id_get(void)
{
- return spci_call((struct spci_value){.func = SPCI_ID_GET_32});
+ return ffa_call((struct ffa_value){.func = FFA_ID_GET_32});
}
/**
* Returns the VM's own ID.
*/
-static inline spci_vm_id_t hf_vm_get_id(void)
+static inline ffa_vm_id_t hf_vm_get_id(void)
{
- return spci_id_get().arg2;
+ return ffa_id_get().arg2;
}
/**
* Returns the number of secondary VMs.
*/
-static inline spci_vm_count_t hf_vm_get_count(void)
+static inline ffa_vm_count_t hf_vm_get_count(void)
{
return hf_call(HF_VM_GET_COUNT, 0, 0, 0);
}
@@ -54,7 +54,7 @@
/**
* Returns the number of vCPUs configured in the given secondary VM.
*/
-static inline spci_vcpu_count_t hf_vcpu_get_count(spci_vm_id_t vm_id)
+static inline ffa_vcpu_count_t hf_vcpu_get_count(ffa_vm_id_t vm_id)
{
return hf_call(HF_VCPU_GET_COUNT, vm_id, 0, 0);
}
@@ -62,20 +62,20 @@
/**
* Runs the given vCPU of the given VM.
*/
-static inline struct spci_value spci_run(spci_vm_id_t vm_id,
- spci_vcpu_index_t vcpu_idx)
+static inline struct ffa_value ffa_run(ffa_vm_id_t vm_id,
+ ffa_vcpu_index_t vcpu_idx)
{
- return spci_call((struct spci_value){.func = SPCI_RUN_32,
- spci_vm_vcpu(vm_id, vcpu_idx)});
+ return ffa_call((struct ffa_value){.func = FFA_RUN_32,
+ ffa_vm_vcpu(vm_id, vcpu_idx)});
}
/**
* Hints that the vCPU is willing to yield its current use of the physical CPU.
- * This call always returns SPCI_SUCCESS.
+ * This call always returns FFA_SUCCESS.
*/
-static inline struct spci_value spci_yield(void)
+static inline struct ffa_value ffa_yield(void)
{
- return spci_call((struct spci_value){.func = SPCI_YIELD_32});
+ return ffa_call((struct ffa_value){.func = FFA_YIELD_32});
}
/**
@@ -83,24 +83,23 @@
* shared.
*
* Returns:
- * - SPCI_ERROR SPCI_INVALID_PARAMETERS if the given addresses are not properly
+ * - FFA_ERROR FFA_INVALID_PARAMETERS if the given addresses are not properly
* aligned or are the same.
- * - SPCI_ERROR SPCI_NO_MEMORY if the hypervisor was unable to map the buffers
+ * - FFA_ERROR FFA_NO_MEMORY if the hypervisor was unable to map the buffers
* due to insuffient page table memory.
- * - SPCI_ERROR SPCI_DENIED if the pages are already mapped or are not owned by
+ * - FFA_ERROR FFA_DENIED if the pages are already mapped or are not owned by
* the caller.
- * - SPCI_SUCCESS on success if no further action is needed.
- * - SPCI_RX_RELEASE if it was called by the primary VM and the primary VM now
+ * - FFA_SUCCESS on success if no further action is needed.
+ * - FFA_RX_RELEASE if it was called by the primary VM and the primary VM now
* needs to wake up or kick waiters.
*/
-static inline struct spci_value spci_rxtx_map(hf_ipaddr_t send,
- hf_ipaddr_t recv)
+static inline struct ffa_value ffa_rxtx_map(hf_ipaddr_t send, hf_ipaddr_t recv)
{
- return spci_call(
- (struct spci_value){.func = SPCI_RXTX_MAP_64,
- .arg1 = send,
- .arg2 = recv,
- .arg3 = HF_MAILBOX_SIZE / SPCI_PAGE_SIZE});
+ return ffa_call(
+ (struct ffa_value){.func = FFA_RXTX_MAP_64,
+ .arg1 = send,
+ .arg2 = recv,
+ .arg3 = HF_MAILBOX_SIZE / FFA_PAGE_SIZE});
}
/**
@@ -110,71 +109,70 @@
* caller to be notified when the recipient's receive buffer becomes available.
*
* Attributes may include:
- * - SPCI_MSG_SEND_NOTIFY, to notify the caller when it should try again.
- * - SPCI_MSG_SEND_LEGACY_MEMORY_*, to send a legacy architected memory sharing
+ * - FFA_MSG_SEND_NOTIFY, to notify the caller when it should try again.
+ * - FFA_MSG_SEND_LEGACY_MEMORY_*, to send a legacy architected memory sharing
* message.
*
- * Returns SPCI_SUCCESS if the message is sent, or an error code otherwise:
+ * Returns FFA_SUCCESS if the message is sent, or an error code otherwise:
* - INVALID_PARAMETERS: one or more of the parameters do not conform.
* - BUSY: the message could not be delivered either because the mailbox
* was full or the target VM is not yet set up.
*/
-static inline struct spci_value spci_msg_send(spci_vm_id_t sender_vm_id,
- spci_vm_id_t target_vm_id,
- uint32_t size,
- uint32_t attributes)
+static inline struct ffa_value ffa_msg_send(ffa_vm_id_t sender_vm_id,
+ ffa_vm_id_t target_vm_id,
+ uint32_t size, uint32_t attributes)
{
- return spci_call((struct spci_value){
- .func = SPCI_MSG_SEND_32,
+ return ffa_call((struct ffa_value){
+ .func = FFA_MSG_SEND_32,
.arg1 = ((uint64_t)sender_vm_id << 16) | target_vm_id,
.arg3 = size,
.arg4 = attributes});
}
-static inline struct spci_value spci_mem_donate(uint32_t length,
- uint32_t fragment_length)
-{
- return spci_call((struct spci_value){.func = SPCI_MEM_DONATE_32,
- .arg1 = length,
- .arg2 = fragment_length});
-}
-
-static inline struct spci_value spci_mem_lend(uint32_t length,
+static inline struct ffa_value ffa_mem_donate(uint32_t length,
uint32_t fragment_length)
{
- return spci_call((struct spci_value){.func = SPCI_MEM_LEND_32,
- .arg1 = length,
- .arg2 = fragment_length});
+ return ffa_call((struct ffa_value){.func = FFA_MEM_DONATE_32,
+ .arg1 = length,
+ .arg2 = fragment_length});
}
-static inline struct spci_value spci_mem_share(uint32_t length,
- uint32_t fragment_length)
+static inline struct ffa_value ffa_mem_lend(uint32_t length,
+ uint32_t fragment_length)
{
- return spci_call((struct spci_value){.func = SPCI_MEM_SHARE_32,
- .arg1 = length,
- .arg2 = fragment_length});
+ return ffa_call((struct ffa_value){.func = FFA_MEM_LEND_32,
+ .arg1 = length,
+ .arg2 = fragment_length});
}
-static inline struct spci_value spci_mem_retrieve_req(uint32_t length,
- uint32_t fragment_length)
+static inline struct ffa_value ffa_mem_share(uint32_t length,
+ uint32_t fragment_length)
{
- return spci_call((struct spci_value){.func = SPCI_MEM_RETRIEVE_REQ_32,
- .arg1 = length,
- .arg2 = fragment_length});
+ return ffa_call((struct ffa_value){.func = FFA_MEM_SHARE_32,
+ .arg1 = length,
+ .arg2 = fragment_length});
}
-static inline struct spci_value spci_mem_relinquish(void)
+static inline struct ffa_value ffa_mem_retrieve_req(uint32_t length,
+ uint32_t fragment_length)
{
- return spci_call((struct spci_value){.func = SPCI_MEM_RELINQUISH_32});
+ return ffa_call((struct ffa_value){.func = FFA_MEM_RETRIEVE_REQ_32,
+ .arg1 = length,
+ .arg2 = fragment_length});
}
-static inline struct spci_value spci_mem_reclaim(
- spci_memory_handle_t handle, spci_memory_region_flags_t flags)
+static inline struct ffa_value ffa_mem_relinquish(void)
{
- return spci_call((struct spci_value){.func = SPCI_MEM_RECLAIM_32,
- .arg1 = (uint32_t)handle,
- .arg2 = (uint32_t)(handle >> 32),
- .arg3 = flags});
+ return ffa_call((struct ffa_value){.func = FFA_MEM_RELINQUISH_32});
+}
+
+static inline struct ffa_value ffa_mem_reclaim(ffa_memory_handle_t handle,
+ ffa_memory_region_flags_t flags)
+{
+ return ffa_call((struct ffa_value){.func = FFA_MEM_RECLAIM_32,
+ .arg1 = (uint32_t)handle,
+ .arg2 = (uint32_t)(handle >> 32),
+ .arg3 = flags});
}
/**
@@ -190,13 +188,13 @@
* that a message becoming available is also treated like a wake-up event.
*
* Returns:
- * - SPCI_MSG_SEND if a message is successfully received.
- * - SPCI_ERROR SPCI_NOT_SUPPORTED if called from the primary VM.
- * - SPCI_ERROR SPCI_INTERRUPTED if an interrupt happened during the call.
+ * - FFA_MSG_SEND if a message is successfully received.
+ * - FFA_ERROR FFA_NOT_SUPPORTED if called from the primary VM.
+ * - FFA_ERROR FFA_INTERRUPTED if an interrupt happened during the call.
*/
-static inline struct spci_value spci_msg_wait(void)
+static inline struct ffa_value ffa_msg_wait(void)
{
- return spci_call((struct spci_value){.func = SPCI_MSG_WAIT_32});
+ return ffa_call((struct ffa_value){.func = FFA_MSG_WAIT_32});
}
/**
@@ -206,14 +204,14 @@
* The mailbox must be cleared before a new message can be received.
*
* Returns:
- * - SPCI_MSG_SEND if a message is successfully received.
- * - SPCI_ERROR SPCI_NOT_SUPPORTED if called from the primary VM.
- * - SPCI_ERROR SPCI_INTERRUPTED if an interrupt happened during the call.
- * - SPCI_ERROR SPCI_RETRY if there was no pending message.
+ * - FFA_MSG_SEND if a message is successfully received.
+ * - FFA_ERROR FFA_NOT_SUPPORTED if called from the primary VM.
+ * - FFA_ERROR FFA_INTERRUPTED if an interrupt happened during the call.
+ * - FFA_ERROR FFA_RETRY if there was no pending message.
*/
-static inline struct spci_value spci_msg_poll(void)
+static inline struct ffa_value ffa_msg_poll(void)
{
- return spci_call((struct spci_value){.func = SPCI_MSG_POLL_32});
+ return ffa_call((struct ffa_value){.func = FFA_MSG_POLL_32});
}
/**
@@ -222,15 +220,15 @@
* will overwrite the old and will arrive asynchronously.
*
* Returns:
- * - SPCI_ERROR SPCI_DENIED on failure, if the mailbox hasn't been read.
- * - SPCI_SUCCESS on success if no further action is needed.
- * - SPCI_RX_RELEASE if it was called by the primary VM and the primary VM now
+ * - FFA_ERROR FFA_DENIED on failure, if the mailbox hasn't been read.
+ * - FFA_SUCCESS on success if no further action is needed.
+ * - FFA_RX_RELEASE if it was called by the primary VM and the primary VM now
* needs to wake up or kick waiters. Waiters should be retrieved by calling
* hf_mailbox_waiter_get.
*/
-static inline struct spci_value spci_rx_release(void)
+static inline struct ffa_value ffa_rx_release(void)
{
- return spci_call((struct spci_value){.func = SPCI_RX_RELEASE_32});
+ return ffa_call((struct ffa_value){.func = FFA_RX_RELEASE_32});
}
/**
@@ -256,7 +254,7 @@
* Returns -1 on failure or if there are no waiters; the VM id of the next
* waiter otherwise.
*/
-static inline int64_t hf_mailbox_waiter_get(spci_vm_id_t vm_id)
+static inline int64_t hf_mailbox_waiter_get(ffa_vm_id_t vm_id)
{
return hf_call(HF_MAILBOX_WAITER_GET, vm_id, 0, 0);
}
@@ -294,8 +292,8 @@
* - 1 if it was called by the primary VM and the primary VM now needs to wake
* up or kick the target vCPU.
*/
-static inline int64_t hf_interrupt_inject(spci_vm_id_t target_vm_id,
- spci_vcpu_index_t target_vcpu_idx,
+static inline int64_t hf_interrupt_inject(ffa_vm_id_t target_vm_id,
+ ffa_vcpu_index_t target_vcpu_idx,
uint32_t intid)
{
return hf_call(HF_INTERRUPT_INJECT, target_vm_id, target_vcpu_idx,
@@ -312,26 +310,26 @@
return hf_call(HF_DEBUG_LOG, c, 0, 0);
}
-/** Obtains the Hafnium's version of the implemented SPCI specification. */
-static inline int32_t spci_version(uint32_t requested_version)
+/** Obtains the Hafnium's version of the implemented FF-A specification. */
+static inline int32_t ffa_version(uint32_t requested_version)
{
- return spci_call((struct spci_value){.func = SPCI_VERSION_32,
- .arg1 = requested_version})
+ return ffa_call((struct ffa_value){.func = FFA_VERSION_32,
+ .arg1 = requested_version})
.func;
}
/**
* Discovery function returning information about the implementation of optional
- * SPCI interfaces.
+ * FF-A interfaces.
*
* Returns:
- * - SPCI_SUCCESS in .func if the optional interface with function_id is
+ * - FFA_SUCCESS in .func if the optional interface with function_id is
* implemented.
- * - SPCI_ERROR in .func if the optional interface with function_id is not
+ * - FFA_ERROR in .func if the optional interface with function_id is not
* implemented.
*/
-static inline struct spci_value spci_features(uint32_t function_id)
+static inline struct ffa_value ffa_features(uint32_t function_id)
{
- return spci_call((struct spci_value){.func = SPCI_FEATURES_32,
- .arg1 = function_id});
+ return ffa_call((struct ffa_value){.func = FFA_FEATURES_32,
+ .arg1 = function_id});
}
diff --git a/inc/vmapi/hf/ffa.h b/inc/vmapi/hf/ffa.h
new file mode 100644
index 0000000..bd93f0c
--- /dev/null
+++ b/inc/vmapi/hf/ffa.h
@@ -0,0 +1,479 @@
+/*
+ * Copyright 2019 The Hafnium Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "hf/types.h"
+
+/* clang-format off */
+
+#define FFA_LOW_32_ID 0x84000060
+#define FFA_HIGH_32_ID 0x8400007F
+#define FFA_LOW_64_ID 0xC4000060
+#define FFA_HIGH_32_ID 0x8400007F
+
+/* FF-A function identifiers. */
+#define FFA_ERROR_32 0x84000060
+#define FFA_SUCCESS_32 0x84000061
+#define FFA_INTERRUPT_32 0x84000062
+#define FFA_VERSION_32 0x84000063
+#define FFA_FEATURES_32 0x84000064
+#define FFA_RX_RELEASE_32 0x84000065
+#define FFA_RXTX_MAP_32 0x84000066
+#define FFA_RXTX_MAP_64 0xC4000066
+#define FFA_RXTX_UNMAP_32 0x84000067
+#define FFA_PARTITION_INFO_GET_32 0x84000068
+#define FFA_ID_GET_32 0x84000069
+#define FFA_MSG_POLL_32 0x8400006A
+#define FFA_MSG_WAIT_32 0x8400006B
+#define FFA_YIELD_32 0x8400006C
+#define FFA_RUN_32 0x8400006D
+#define FFA_MSG_SEND_32 0x8400006E
+#define FFA_MSG_SEND_DIRECT_REQ_32 0x8400006F
+#define FFA_MSG_SEND_DIRECT_RESP_32 0x84000070
+#define FFA_MEM_DONATE_32 0x84000071
+#define FFA_MEM_LEND_32 0x84000072
+#define FFA_MEM_SHARE_32 0x84000073
+#define FFA_MEM_RETRIEVE_REQ_32 0x84000074
+#define FFA_MEM_RETRIEVE_RESP_32 0x84000075
+#define FFA_MEM_RELINQUISH_32 0x84000076
+#define FFA_MEM_RECLAIM_32 0x84000077
+
+/* FF-A error codes. */
+#define FFA_NOT_SUPPORTED INT32_C(-1)
+#define FFA_INVALID_PARAMETERS INT32_C(-2)
+#define FFA_NO_MEMORY INT32_C(-3)
+#define FFA_BUSY INT32_C(-4)
+#define FFA_INTERRUPTED INT32_C(-5)
+#define FFA_DENIED INT32_C(-6)
+#define FFA_RETRY INT32_C(-7)
+#define FFA_ABORTED INT32_C(-8)
+
+/* clang-format on */
+
+/* FF-A function specific constants. */
+#define FFA_MSG_RECV_BLOCK 0x1
+#define FFA_MSG_RECV_BLOCK_MASK 0x1
+
+#define FFA_MSG_SEND_NOTIFY 0x1
+#define FFA_MSG_SEND_NOTIFY_MASK 0x1
+
+#define FFA_MEM_RECLAIM_CLEAR 0x1
+
+#define FFA_SLEEP_INDEFINITE 0
+
+/**
+ * For use where the FF-A specification refers explicitly to '4K pages'. Not to
+ * be confused with PAGE_SIZE, which is the translation granule Hafnium is
+ * configured to use.
+ */
+#define FFA_PAGE_SIZE 4096
+
+/* The maximum length possible for a single message. */
+#define FFA_MSG_PAYLOAD_MAX HF_MAILBOX_SIZE
+
+enum ffa_data_access {
+ FFA_DATA_ACCESS_NOT_SPECIFIED,
+ FFA_DATA_ACCESS_RO,
+ FFA_DATA_ACCESS_RW,
+ FFA_DATA_ACCESS_RESERVED,
+};
+
+enum ffa_instruction_access {
+ FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED,
+ FFA_INSTRUCTION_ACCESS_NX,
+ FFA_INSTRUCTION_ACCESS_X,
+ FFA_INSTRUCTION_ACCESS_RESERVED,
+};
+
+enum ffa_memory_type {
+ FFA_MEMORY_NOT_SPECIFIED_MEM,
+ FFA_MEMORY_DEVICE_MEM,
+ FFA_MEMORY_NORMAL_MEM,
+};
+
+enum ffa_memory_cacheability {
+ FFA_MEMORY_CACHE_RESERVED = 0x0,
+ FFA_MEMORY_CACHE_NON_CACHEABLE = 0x1,
+ FFA_MEMORY_CACHE_RESERVED_1 = 0x2,
+ FFA_MEMORY_CACHE_WRITE_BACK = 0x3,
+ FFA_MEMORY_DEV_NGNRNE = 0x0,
+ FFA_MEMORY_DEV_NGNRE = 0x1,
+ FFA_MEMORY_DEV_NGRE = 0x2,
+ FFA_MEMORY_DEV_GRE = 0x3,
+};
+
+enum ffa_memory_shareability {
+ FFA_MEMORY_SHARE_NON_SHAREABLE,
+ FFA_MEMORY_SHARE_RESERVED,
+ FFA_MEMORY_OUTER_SHAREABLE,
+ FFA_MEMORY_INNER_SHAREABLE,
+};
+
+typedef uint8_t ffa_memory_access_permissions_t;
+
+/**
+ * This corresponds to table 44 of the FF-A 1.0 EAC specification, "Memory
+ * region attributes descriptor".
+ */
+typedef uint8_t ffa_memory_attributes_t;
+
+#define FFA_DATA_ACCESS_OFFSET (0x0U)
+#define FFA_DATA_ACCESS_MASK ((0x3U) << FFA_DATA_ACCESS_OFFSET)
+
+#define FFA_INSTRUCTION_ACCESS_OFFSET (0x2U)
+#define FFA_INSTRUCTION_ACCESS_MASK ((0x3U) << FFA_INSTRUCTION_ACCESS_OFFSET)
+
+#define FFA_MEMORY_TYPE_OFFSET (0x4U)
+#define FFA_MEMORY_TYPE_MASK ((0x3U) << FFA_MEMORY_TYPE_OFFSET)
+
+#define FFA_MEMORY_CACHEABILITY_OFFSET (0x2U)
+#define FFA_MEMORY_CACHEABILITY_MASK ((0x3U) << FFA_MEMORY_CACHEABILITY_OFFSET)
+
+#define FFA_MEMORY_SHAREABILITY_OFFSET (0x0U)
+#define FFA_MEMORY_SHAREABILITY_MASK ((0x3U) << FFA_MEMORY_SHAREABILITY_OFFSET)
+
+#define ATTR_FUNCTION_SET(name, container_type, offset, mask) \
+ static inline void ffa_set_##name##_attr(container_type *attr, \
+ const enum ffa_##name perm) \
+ { \
+ *attr = (*attr & ~(mask)) | ((perm << offset) & mask); \
+ }
+
+#define ATTR_FUNCTION_GET(name, container_type, offset, mask) \
+ static inline enum ffa_##name ffa_get_##name##_attr( \
+ container_type attr) \
+ { \
+ return (enum ffa_##name)((attr & mask) >> offset); \
+ }
+
+ATTR_FUNCTION_SET(data_access, ffa_memory_access_permissions_t,
+ FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
+ATTR_FUNCTION_GET(data_access, ffa_memory_access_permissions_t,
+ FFA_DATA_ACCESS_OFFSET, FFA_DATA_ACCESS_MASK)
+
+ATTR_FUNCTION_SET(instruction_access, ffa_memory_access_permissions_t,
+ FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
+ATTR_FUNCTION_GET(instruction_access, ffa_memory_access_permissions_t,
+ FFA_INSTRUCTION_ACCESS_OFFSET, FFA_INSTRUCTION_ACCESS_MASK)
+
+ATTR_FUNCTION_SET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
+ FFA_MEMORY_TYPE_MASK)
+ATTR_FUNCTION_GET(memory_type, ffa_memory_attributes_t, FFA_MEMORY_TYPE_OFFSET,
+ FFA_MEMORY_TYPE_MASK)
+
+ATTR_FUNCTION_SET(memory_cacheability, ffa_memory_attributes_t,
+ FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
+ATTR_FUNCTION_GET(memory_cacheability, ffa_memory_attributes_t,
+ FFA_MEMORY_CACHEABILITY_OFFSET, FFA_MEMORY_CACHEABILITY_MASK)
+
+ATTR_FUNCTION_SET(memory_shareability, ffa_memory_attributes_t,
+ FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
+ATTR_FUNCTION_GET(memory_shareability, ffa_memory_attributes_t,
+ FFA_MEMORY_SHAREABILITY_OFFSET, FFA_MEMORY_SHAREABILITY_MASK)
+
+#define FFA_MEMORY_HANDLE_ALLOCATOR_MASK \
+ ((ffa_memory_handle_t)(UINT64_C(1) << 63))
+#define FFA_MEMORY_HANDLE_ALLOCATOR_HYPERVISOR \
+ ((ffa_memory_handle_t)(UINT64_C(1) << 63))
+
+/** The ID of a VM. These are assigned sequentially starting with an offset. */
+typedef uint16_t ffa_vm_id_t;
+
+/**
+ * A globally-unique ID assigned by the hypervisor for a region of memory being
+ * sent between VMs.
+ */
+typedef uint64_t ffa_memory_handle_t;
+
+/**
+ * A count of VMs. This has the same range as the VM IDs but we give it a
+ * different name to make the different semantics clear.
+ */
+typedef ffa_vm_id_t ffa_vm_count_t;
+
+/** The index of a vCPU within a particular VM. */
+typedef uint16_t ffa_vcpu_index_t;
+
+/**
+ * A count of vCPUs. This has the same range as the vCPU indices but we give it
+ * a different name to make the different semantics clear.
+ */
+typedef ffa_vcpu_index_t ffa_vcpu_count_t;
+
+/** Parameter and return type of FF-A functions. */
+struct ffa_value {
+ uint64_t func;
+ uint64_t arg1;
+ uint64_t arg2;
+ uint64_t arg3;
+ uint64_t arg4;
+ uint64_t arg5;
+ uint64_t arg6;
+ uint64_t arg7;
+};
+
+static inline ffa_vm_id_t ffa_msg_send_sender(struct ffa_value args)
+{
+ return (args.arg1 >> 16) & 0xffff;
+}
+
+static inline ffa_vm_id_t ffa_msg_send_receiver(struct ffa_value args)
+{
+ return args.arg1 & 0xffff;
+}
+
+static inline uint32_t ffa_msg_send_size(struct ffa_value args)
+{
+ return args.arg3;
+}
+
+static inline uint32_t ffa_msg_send_attributes(struct ffa_value args)
+{
+ return args.arg4;
+}
+
+static inline ffa_memory_handle_t ffa_mem_success_handle(struct ffa_value args)
+{
+ return args.arg2;
+}
+
+static inline ffa_vm_id_t ffa_vm_id(struct ffa_value args)
+{
+ return (args.arg1 >> 16) & 0xffff;
+}
+
+static inline ffa_vcpu_index_t ffa_vcpu_index(struct ffa_value args)
+{
+ return args.arg1 & 0xffff;
+}
+
+static inline uint64_t ffa_vm_vcpu(ffa_vm_id_t vm_id,
+ ffa_vcpu_index_t vcpu_index)
+{
+ return ((uint32_t)vm_id << 16) | vcpu_index;
+}
+
+/**
+ * A set of contiguous pages which is part of a memory region. This corresponds
+ * to table 40 of the FF-A 1.0 EAC specification, "Constituent memory region
+ * descriptor".
+ */
+struct ffa_memory_region_constituent {
+ /**
+ * The base IPA of the constituent memory region, aligned to 4 kiB page
+ * size granularity.
+ */
+ uint64_t address;
+ /** The number of 4 kiB pages in the constituent memory region. */
+ uint32_t page_count;
+ /** Reserved field, must be 0. */
+ uint32_t reserved;
+};
+
+/**
+ * A set of pages comprising a memory region. This corresponds to table 39 of
+ * the FF-A 1.0 EAC specification, "Composite memory region descriptor".
+ */
+struct ffa_composite_memory_region {
+ /**
+ * The total number of 4 kiB pages included in this memory region. This
+ * must be equal to the sum of page counts specified in each
+ * `ffa_memory_region_constituent`.
+ */
+ uint32_t page_count;
+ /**
+ * The number of constituents (`ffa_memory_region_constituent`)
+ * included in this memory region range.
+ */
+ uint32_t constituent_count;
+ /** Reserved field, must be 0. */
+ uint64_t reserved_0;
+ /** An array of `constituent_count` memory region constituents. */
+ struct ffa_memory_region_constituent constituents[];
+};
+
+/** Flags to indicate properties of receivers during memory region retrieval. */
+typedef uint8_t ffa_memory_receiver_flags_t;
+
+/**
+ * This corresponds to table 41 of the FF-A 1.0 EAC specification, "Memory
+ * access permissions descriptor".
+ */
+struct ffa_memory_region_attributes {
+ /** The ID of the VM to which the memory is being given or shared. */
+ ffa_vm_id_t receiver;
+ /**
+ * The permissions with which the memory region should be mapped in the
+ * receiver's page table.
+ */
+ ffa_memory_access_permissions_t permissions;
+ /**
+ * Flags used during FFA_MEM_RETRIEVE_REQ and FFA_MEM_RETRIEVE_RESP
+ * for memory regions with multiple borrowers.
+ */
+ ffa_memory_receiver_flags_t flags;
+};
+
+/** Flags to control the behaviour of a memory sharing transaction. */
+typedef uint32_t ffa_memory_region_flags_t;
+
+/**
+ * Clear memory region contents after unmapping it from the sender and before
+ * mapping it for any receiver.
+ */
+#define FFA_MEMORY_REGION_FLAG_CLEAR 0x1
+
+/**
+ * Whether the hypervisor may time slice the memory sharing or retrieval
+ * operation.
+ */
+#define FFA_MEMORY_REGION_FLAG_TIME_SLICE 0x2
+
+/**
+ * Whether the hypervisor should clear the memory region after the receiver
+ * relinquishes it or is aborted.
+ */
+#define FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH 0x4
+
+#define FFA_MEMORY_REGION_TRANSACTION_TYPE_MASK ((0x3U) << 3)
+#define FFA_MEMORY_REGION_TRANSACTION_TYPE_UNSPECIFIED ((0x0U) << 3)
+#define FFA_MEMORY_REGION_TRANSACTION_TYPE_SHARE ((0x1U) << 3)
+#define FFA_MEMORY_REGION_TRANSACTION_TYPE_LEND ((0x2U) << 3)
+#define FFA_MEMORY_REGION_TRANSACTION_TYPE_DONATE ((0x3U) << 3)
+
+/**
+ * This corresponds to table 42 of the FF-A 1.0 EAC specification, "Endpoint
+ * memory access descriptor".
+ */
+struct ffa_memory_access {
+ struct ffa_memory_region_attributes receiver_permissions;
+ /**
+ * Offset in bytes from the start of the outer `ffa_memory_region` to
+ * an `ffa_composite_memory_region` struct.
+ */
+ uint32_t composite_memory_region_offset;
+ uint64_t reserved_0;
+};
+
+/**
+ * Information about a set of pages which are being shared. This corresponds to
+ * table 45 of the FF-A 1.0 EAC specification, "Lend, donate or share memory
+ * transaction descriptor". Note that it is also used for retrieve requests and
+ * responses.
+ */
+struct ffa_memory_region {
+ /**
+ * The ID of the VM which originally sent the memory region, i.e. the
+ * owner.
+ */
+ ffa_vm_id_t sender;
+ ffa_memory_attributes_t attributes;
+ /** Reserved field, must be 0. */
+ uint8_t reserved_0;
+ /** Flags to control behaviour of the transaction. */
+ ffa_memory_region_flags_t flags;
+ ffa_memory_handle_t handle;
+ /**
+ * An implementation defined value associated with the receiver and the
+ * memory region.
+ */
+ uint64_t tag;
+ /** Reserved field, must be 0. */
+ uint32_t reserved_1;
+ /**
+ * The number of `ffa_memory_access` entries included in this
+ * transaction.
+ */
+ uint32_t receiver_count;
+ /**
+ * An array of `attribute_count` endpoint memory access descriptors.
+ * Each one specifies a memory region offset, an endpoint and the
+ * attributes with which this memory region should be mapped in that
+ * endpoint's page table.
+ */
+ struct ffa_memory_access receivers[];
+};
+
+/**
+ * Descriptor used for FFA_MEM_RELINQUISH requests. This corresponds to table
+ * 150 of the FF-A 1.0 EAC specification, "Descriptor to relinquish a memory
+ * region".
+ */
+struct ffa_mem_relinquish {
+ ffa_memory_handle_t handle;
+ ffa_memory_region_flags_t flags;
+ uint32_t endpoint_count;
+ ffa_vm_id_t endpoints[];
+};
+
+/**
+ * Gets the `ffa_composite_memory_region` for the given receiver from an
+ * `ffa_memory_region`, or NULL if it is not valid.
+ */
+static inline struct ffa_composite_memory_region *
+ffa_memory_region_get_composite(struct ffa_memory_region *memory_region,
+ uint32_t receiver_index)
+{
+ uint32_t offset = memory_region->receivers[receiver_index]
+ .composite_memory_region_offset;
+
+ if (offset == 0) {
+ return NULL;
+ }
+
+ return (struct ffa_composite_memory_region *)((uint8_t *)memory_region +
+ offset);
+}
+
+static inline uint32_t ffa_mem_relinquish_init(
+ struct ffa_mem_relinquish *relinquish_request,
+ ffa_memory_handle_t handle, ffa_memory_region_flags_t flags,
+ ffa_vm_id_t sender)
+{
+ relinquish_request->handle = handle;
+ relinquish_request->flags = flags;
+ relinquish_request->endpoint_count = 1;
+ relinquish_request->endpoints[0] = sender;
+ return sizeof(struct ffa_mem_relinquish) + sizeof(ffa_vm_id_t);
+}
+
+uint32_t ffa_memory_region_init(
+ struct ffa_memory_region *memory_region, ffa_vm_id_t sender,
+ ffa_vm_id_t receiver,
+ const struct ffa_memory_region_constituent constituents[],
+ uint32_t constituent_count, uint32_t tag,
+ ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
+ enum ffa_instruction_access instruction_access,
+ enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
+ enum ffa_memory_shareability shareability);
+uint32_t ffa_memory_retrieve_request_init(
+ struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
+ ffa_vm_id_t sender, ffa_vm_id_t receiver, uint32_t tag,
+ ffa_memory_region_flags_t flags, enum ffa_data_access data_access,
+ enum ffa_instruction_access instruction_access,
+ enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
+ enum ffa_memory_shareability shareability);
+uint32_t ffa_memory_lender_retrieve_request_init(
+ struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
+ ffa_vm_id_t sender);
+uint32_t ffa_retrieved_memory_region_init(
+ struct ffa_memory_region *response, size_t response_max_size,
+ ffa_vm_id_t sender, ffa_memory_attributes_t attributes,
+ ffa_memory_region_flags_t flags, ffa_memory_handle_t handle,
+ ffa_vm_id_t receiver, ffa_memory_access_permissions_t permissions,
+ const struct ffa_memory_region_constituent constituents[],
+ uint32_t constituent_count);
diff --git a/inc/vmapi/hf/spci.h b/inc/vmapi/hf/spci.h
deleted file mode 100644
index 1587b54..0000000
--- a/inc/vmapi/hf/spci.h
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright 2019 The Hafnium Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "hf/types.h"
-
-/* clang-format off */
-
-#define SPCI_LOW_32_ID 0x84000060
-#define SPCI_HIGH_32_ID 0x8400007F
-#define SPCI_LOW_64_ID 0xC4000060
-#define SPCI_HIGH_32_ID 0x8400007F
-
-/* SPCI function identifiers. */
-#define SPCI_ERROR_32 0x84000060
-#define SPCI_SUCCESS_32 0x84000061
-#define SPCI_INTERRUPT_32 0x84000062
-#define SPCI_VERSION_32 0x84000063
-#define SPCI_FEATURES_32 0x84000064
-#define SPCI_RX_RELEASE_32 0x84000065
-#define SPCI_RXTX_MAP_32 0x84000066
-#define SPCI_RXTX_MAP_64 0xC4000066
-#define SPCI_RXTX_UNMAP_32 0x84000067
-#define SPCI_PARTITION_INFO_GET_32 0x84000068
-#define SPCI_ID_GET_32 0x84000069
-#define SPCI_MSG_POLL_32 0x8400006A
-#define SPCI_MSG_WAIT_32 0x8400006B
-#define SPCI_YIELD_32 0x8400006C
-#define SPCI_RUN_32 0x8400006D
-#define SPCI_MSG_SEND_32 0x8400006E
-#define SPCI_MSG_SEND_DIRECT_REQ_32 0x8400006F
-#define SPCI_MSG_SEND_DIRECT_RESP_32 0x84000070
-#define SPCI_MEM_DONATE_32 0x84000071
-#define SPCI_MEM_LEND_32 0x84000072
-#define SPCI_MEM_SHARE_32 0x84000073
-#define SPCI_MEM_RETRIEVE_REQ_32 0x84000074
-#define SPCI_MEM_RETRIEVE_RESP_32 0x84000075
-#define SPCI_MEM_RELINQUISH_32 0x84000076
-#define SPCI_MEM_RECLAIM_32 0x84000077
-
-/* SPCI error codes. */
-#define SPCI_NOT_SUPPORTED INT32_C(-1)
-#define SPCI_INVALID_PARAMETERS INT32_C(-2)
-#define SPCI_NO_MEMORY INT32_C(-3)
-#define SPCI_BUSY INT32_C(-4)
-#define SPCI_INTERRUPTED INT32_C(-5)
-#define SPCI_DENIED INT32_C(-6)
-#define SPCI_RETRY INT32_C(-7)
-#define SPCI_ABORTED INT32_C(-8)
-
-/* clang-format on */
-
-/* SPCI function specific constants. */
-#define SPCI_MSG_RECV_BLOCK 0x1
-#define SPCI_MSG_RECV_BLOCK_MASK 0x1
-
-#define SPCI_MSG_SEND_NOTIFY 0x1
-#define SPCI_MSG_SEND_NOTIFY_MASK 0x1
-
-#define SPCI_MEM_RECLAIM_CLEAR 0x1
-
-#define SPCI_SLEEP_INDEFINITE 0
-
-/**
- * For use where the SPCI specification refers explicitly to '4K pages'. Not to
- * be confused with PAGE_SIZE, which is the translation granule Hafnium is
- * configured to use.
- */
-#define SPCI_PAGE_SIZE 4096
-
-/* The maximum length possible for a single message. */
-#define SPCI_MSG_PAYLOAD_MAX HF_MAILBOX_SIZE
-
-enum spci_data_access {
- SPCI_DATA_ACCESS_NOT_SPECIFIED,
- SPCI_DATA_ACCESS_RO,
- SPCI_DATA_ACCESS_RW,
- SPCI_DATA_ACCESS_RESERVED,
-};
-
-enum spci_instruction_access {
- SPCI_INSTRUCTION_ACCESS_NOT_SPECIFIED,
- SPCI_INSTRUCTION_ACCESS_NX,
- SPCI_INSTRUCTION_ACCESS_X,
- SPCI_INSTRUCTION_ACCESS_RESERVED,
-};
-
-enum spci_memory_type {
- SPCI_MEMORY_NOT_SPECIFIED_MEM,
- SPCI_MEMORY_DEVICE_MEM,
- SPCI_MEMORY_NORMAL_MEM,
-};
-
-enum spci_memory_cacheability {
- SPCI_MEMORY_CACHE_RESERVED = 0x0,
- SPCI_MEMORY_CACHE_NON_CACHEABLE = 0x1,
- SPCI_MEMORY_CACHE_RESERVED_1 = 0x2,
- SPCI_MEMORY_CACHE_WRITE_BACK = 0x3,
- SPCI_MEMORY_DEV_NGNRNE = 0x0,
- SPCI_MEMORY_DEV_NGNRE = 0x1,
- SPCI_MEMORY_DEV_NGRE = 0x2,
- SPCI_MEMORY_DEV_GRE = 0x3,
-};
-
-enum spci_memory_shareability {
- SPCI_MEMORY_SHARE_NON_SHAREABLE,
- SPCI_MEMORY_SHARE_RESERVED,
- SPCI_MEMORY_OUTER_SHAREABLE,
- SPCI_MEMORY_INNER_SHAREABLE,
-};
-
-typedef uint8_t spci_memory_access_permissions_t;
-
-/**
- * This corresponds to table 44 of the FF-A 1.0 EAC specification, "Memory
- * region attributes descriptor".
- */
-typedef uint8_t spci_memory_attributes_t;
-
-#define SPCI_DATA_ACCESS_OFFSET (0x0U)
-#define SPCI_DATA_ACCESS_MASK ((0x3U) << SPCI_DATA_ACCESS_OFFSET)
-
-#define SPCI_INSTRUCTION_ACCESS_OFFSET (0x2U)
-#define SPCI_INSTRUCTION_ACCESS_MASK ((0x3U) << SPCI_INSTRUCTION_ACCESS_OFFSET)
-
-#define SPCI_MEMORY_TYPE_OFFSET (0x4U)
-#define SPCI_MEMORY_TYPE_MASK ((0x3U) << SPCI_MEMORY_TYPE_OFFSET)
-
-#define SPCI_MEMORY_CACHEABILITY_OFFSET (0x2U)
-#define SPCI_MEMORY_CACHEABILITY_MASK \
- ((0x3U) << SPCI_MEMORY_CACHEABILITY_OFFSET)
-
-#define SPCI_MEMORY_SHAREABILITY_OFFSET (0x0U)
-#define SPCI_MEMORY_SHAREABILITY_MASK \
- ((0x3U) << SPCI_MEMORY_SHAREABILITY_OFFSET)
-
-#define ATTR_FUNCTION_SET(name, container_type, offset, mask) \
- static inline void spci_set_##name##_attr(container_type *attr, \
- const enum spci_##name perm) \
- { \
- *attr = (*attr & ~(mask)) | ((perm << offset) & mask); \
- }
-
-#define ATTR_FUNCTION_GET(name, container_type, offset, mask) \
- static inline enum spci_##name spci_get_##name##_attr( \
- container_type attr) \
- { \
- return (enum spci_##name)((attr & mask) >> offset); \
- }
-
-ATTR_FUNCTION_SET(data_access, spci_memory_access_permissions_t,
- SPCI_DATA_ACCESS_OFFSET, SPCI_DATA_ACCESS_MASK)
-ATTR_FUNCTION_GET(data_access, spci_memory_access_permissions_t,
- SPCI_DATA_ACCESS_OFFSET, SPCI_DATA_ACCESS_MASK)
-
-ATTR_FUNCTION_SET(instruction_access, spci_memory_access_permissions_t,
- SPCI_INSTRUCTION_ACCESS_OFFSET, SPCI_INSTRUCTION_ACCESS_MASK)
-ATTR_FUNCTION_GET(instruction_access, spci_memory_access_permissions_t,
- SPCI_INSTRUCTION_ACCESS_OFFSET, SPCI_INSTRUCTION_ACCESS_MASK)
-
-ATTR_FUNCTION_SET(memory_type, spci_memory_attributes_t,
- SPCI_MEMORY_TYPE_OFFSET, SPCI_MEMORY_TYPE_MASK)
-ATTR_FUNCTION_GET(memory_type, spci_memory_attributes_t,
- SPCI_MEMORY_TYPE_OFFSET, SPCI_MEMORY_TYPE_MASK)
-
-ATTR_FUNCTION_SET(memory_cacheability, spci_memory_attributes_t,
- SPCI_MEMORY_CACHEABILITY_OFFSET,
- SPCI_MEMORY_CACHEABILITY_MASK)
-ATTR_FUNCTION_GET(memory_cacheability, spci_memory_attributes_t,
- SPCI_MEMORY_CACHEABILITY_OFFSET,
- SPCI_MEMORY_CACHEABILITY_MASK)
-
-ATTR_FUNCTION_SET(memory_shareability, spci_memory_attributes_t,
- SPCI_MEMORY_SHAREABILITY_OFFSET,
- SPCI_MEMORY_SHAREABILITY_MASK)
-ATTR_FUNCTION_GET(memory_shareability, spci_memory_attributes_t,
- SPCI_MEMORY_SHAREABILITY_OFFSET,
- SPCI_MEMORY_SHAREABILITY_MASK)
-
-#define SPCI_MEMORY_HANDLE_ALLOCATOR_MASK \
- ((spci_memory_handle_t)(UINT64_C(1) << 63))
-#define SPCI_MEMORY_HANDLE_ALLOCATOR_HYPERVISOR \
- ((spci_memory_handle_t)(UINT64_C(1) << 63))
-
-/** The ID of a VM. These are assigned sequentially starting with an offset. */
-typedef uint16_t spci_vm_id_t;
-
-/**
- * A globally-unique ID assigned by the hypervisor for a region of memory being
- * sent between VMs.
- */
-typedef uint64_t spci_memory_handle_t;
-
-/**
- * A count of VMs. This has the same range as the VM IDs but we give it a
- * different name to make the different semantics clear.
- */
-typedef spci_vm_id_t spci_vm_count_t;
-
-/** The index of a vCPU within a particular VM. */
-typedef uint16_t spci_vcpu_index_t;
-
-/**
- * A count of vCPUs. This has the same range as the vCPU indices but we give it
- * a different name to make the different semantics clear.
- */
-typedef spci_vcpu_index_t spci_vcpu_count_t;
-
-/** Parameter and return type of SPCI functions. */
-struct spci_value {
- uint64_t func;
- uint64_t arg1;
- uint64_t arg2;
- uint64_t arg3;
- uint64_t arg4;
- uint64_t arg5;
- uint64_t arg6;
- uint64_t arg7;
-};
-
-static inline spci_vm_id_t spci_msg_send_sender(struct spci_value args)
-{
- return (args.arg1 >> 16) & 0xffff;
-}
-
-static inline spci_vm_id_t spci_msg_send_receiver(struct spci_value args)
-{
- return args.arg1 & 0xffff;
-}
-
-static inline uint32_t spci_msg_send_size(struct spci_value args)
-{
- return args.arg3;
-}
-
-static inline uint32_t spci_msg_send_attributes(struct spci_value args)
-{
- return args.arg4;
-}
-
-static inline spci_memory_handle_t spci_mem_success_handle(
- struct spci_value args)
-{
- return args.arg2;
-}
-
-static inline spci_vm_id_t spci_vm_id(struct spci_value args)
-{
- return (args.arg1 >> 16) & 0xffff;
-}
-
-static inline spci_vcpu_index_t spci_vcpu_index(struct spci_value args)
-{
- return args.arg1 & 0xffff;
-}
-
-static inline uint64_t spci_vm_vcpu(spci_vm_id_t vm_id,
- spci_vcpu_index_t vcpu_index)
-{
- return ((uint32_t)vm_id << 16) | vcpu_index;
-}
-
-/**
- * A set of contiguous pages which is part of a memory region. This corresponds
- * to table 40 of the FF-A 1.0 EAC specification, "Constituent memory region
- * descriptor".
- */
-struct spci_memory_region_constituent {
- /**
- * The base IPA of the constituent memory region, aligned to 4 kiB page
- * size granularity.
- */
- uint64_t address;
- /** The number of 4 kiB pages in the constituent memory region. */
- uint32_t page_count;
- /** Reserved field, must be 0. */
- uint32_t reserved;
-};
-
-/**
- * A set of pages comprising a memory region. This corresponds to table 39 of
- * the FF-A 1.0 EAC specification, "Composite memory region descriptor".
- */
-struct spci_composite_memory_region {
- /**
- * The total number of 4 kiB pages included in this memory region. This
- * must be equal to the sum of page counts specified in each
- * `spci_memory_region_constituent`.
- */
- uint32_t page_count;
- /**
- * The number of constituents (`spci_memory_region_constituent`)
- * included in this memory region range.
- */
- uint32_t constituent_count;
- /** Reserved field, must be 0. */
- uint64_t reserved_0;
- /** An array of `constituent_count` memory region constituents. */
- struct spci_memory_region_constituent constituents[];
-};
-
-/** Flags to indicate properties of receivers during memory region retrieval. */
-typedef uint8_t spci_memory_receiver_flags_t;
-
-/**
- * This corresponds to table 41 of the FF-A 1.0 EAC specification, "Memory
- * access permissions descriptor".
- */
-struct spci_memory_region_attributes {
- /** The ID of the VM to which the memory is being given or shared. */
- spci_vm_id_t receiver;
- /**
- * The permissions with which the memory region should be mapped in the
- * receiver's page table.
- */
- spci_memory_access_permissions_t permissions;
- /**
- * Flags used during SPCI_MEM_RETRIEVE_REQ and SPCI_MEM_RETRIEVE_RESP
- * for memory regions with multiple borrowers.
- */
- spci_memory_receiver_flags_t flags;
-};
-
-/** Flags to control the behaviour of a memory sharing transaction. */
-typedef uint32_t spci_memory_region_flags_t;
-
-/**
- * Clear memory region contents after unmapping it from the sender and before
- * mapping it for any receiver.
- */
-#define SPCI_MEMORY_REGION_FLAG_CLEAR 0x1
-
-/**
- * Whether the hypervisor may time slice the memory sharing or retrieval
- * operation.
- */
-#define SPCI_MEMORY_REGION_FLAG_TIME_SLICE 0x2
-
-/**
- * Whether the hypervisor should clear the memory region after the receiver
- * relinquishes it or is aborted.
- */
-#define SPCI_MEMORY_REGION_FLAG_CLEAR_RELINQUISH 0x4
-
-#define SPCI_MEMORY_REGION_TRANSACTION_TYPE_MASK ((0x3U) << 3)
-#define SPCI_MEMORY_REGION_TRANSACTION_TYPE_UNSPECIFIED ((0x0U) << 3)
-#define SPCI_MEMORY_REGION_TRANSACTION_TYPE_SHARE ((0x1U) << 3)
-#define SPCI_MEMORY_REGION_TRANSACTION_TYPE_LEND ((0x2U) << 3)
-#define SPCI_MEMORY_REGION_TRANSACTION_TYPE_DONATE ((0x3U) << 3)
-
-/**
- * This corresponds to table 42 of the FF-A 1.0 EAC specification, "Endpoint
- * memory access descriptor".
- */
-struct spci_memory_access {
- struct spci_memory_region_attributes receiver_permissions;
- /**
- * Offset in bytes from the start of the outer `spci_memory_region` to
- * an `spci_composite_memory_region` struct.
- */
- uint32_t composite_memory_region_offset;
- uint64_t reserved_0;
-};
-
-/**
- * Information about a set of pages which are being shared. This corresponds to
- * table 45 of the FF-A 1.0 EAC specification, "Lend, donate or share memory
- * transaction descriptor". Note that it is also used for retrieve requests and
- * responses.
- */
-struct spci_memory_region {
- /**
- * The ID of the VM which originally sent the memory region, i.e. the
- * owner.
- */
- spci_vm_id_t sender;
- spci_memory_attributes_t attributes;
- /** Reserved field, must be 0. */
- uint8_t reserved_0;
- /** Flags to control behaviour of the transaction. */
- spci_memory_region_flags_t flags;
- spci_memory_handle_t handle;
- /**
- * An implementation defined value associated with the receiver and the
- * memory region.
- */
- uint64_t tag;
- /** Reserved field, must be 0. */
- uint32_t reserved_1;
- /**
- * The number of `spci_memory_access` entries included in this
- * transaction.
- */
- uint32_t receiver_count;
- /**
- * An array of `attribute_count` endpoint memory access descriptors.
- * Each one specifies a memory region offset, an endpoint and the
- * attributes with which this memory region should be mapped in that
- * endpoint's page table.
- */
- struct spci_memory_access receivers[];
-};
-
-/**
- * Descriptor used for SPCI_MEM_RELINQUISH requests. This corresponds to table
- * 150 of the FF-A 1.0 EAC specification, "Descriptor to relinquish a memory
- * region".
- */
-struct spci_mem_relinquish {
- spci_memory_handle_t handle;
- spci_memory_region_flags_t flags;
- uint32_t endpoint_count;
- spci_vm_id_t endpoints[];
-};
-
-/**
- * Gets the `spci_composite_memory_region` for the given receiver from an
- * `spci_memory_region`, or NULL if it is not valid.
- */
-static inline struct spci_composite_memory_region *
-spci_memory_region_get_composite(struct spci_memory_region *memory_region,
- uint32_t receiver_index)
-{
- uint32_t offset = memory_region->receivers[receiver_index]
- .composite_memory_region_offset;
-
- if (offset == 0) {
- return NULL;
- }
-
- return (struct spci_composite_memory_region *)((uint8_t *)
- memory_region +
- offset);
-}
-
-static inline uint32_t spci_mem_relinquish_init(
- struct spci_mem_relinquish *relinquish_request,
- spci_memory_handle_t handle, spci_memory_region_flags_t flags,
- spci_vm_id_t sender)
-{
- relinquish_request->handle = handle;
- relinquish_request->flags = flags;
- relinquish_request->endpoint_count = 1;
- relinquish_request->endpoints[0] = sender;
- return sizeof(struct spci_mem_relinquish) + sizeof(spci_vm_id_t);
-}
-
-uint32_t spci_memory_region_init(
- struct spci_memory_region *memory_region, spci_vm_id_t sender,
- spci_vm_id_t receiver,
- const struct spci_memory_region_constituent constituents[],
- uint32_t constituent_count, uint32_t tag,
- spci_memory_region_flags_t flags, enum spci_data_access data_access,
- enum spci_instruction_access instruction_access,
- enum spci_memory_type type, enum spci_memory_cacheability cacheability,
- enum spci_memory_shareability shareability);
-uint32_t spci_memory_retrieve_request_init(
- struct spci_memory_region *memory_region, spci_memory_handle_t handle,
- spci_vm_id_t sender, spci_vm_id_t receiver, uint32_t tag,
- spci_memory_region_flags_t flags, enum spci_data_access data_access,
- enum spci_instruction_access instruction_access,
- enum spci_memory_type type, enum spci_memory_cacheability cacheability,
- enum spci_memory_shareability shareability);
-uint32_t spci_memory_lender_retrieve_request_init(
- struct spci_memory_region *memory_region, spci_memory_handle_t handle,
- spci_vm_id_t sender);
-uint32_t spci_retrieved_memory_region_init(
- struct spci_memory_region *response, size_t response_max_size,
- spci_vm_id_t sender, spci_memory_attributes_t attributes,
- spci_memory_region_flags_t flags, spci_memory_handle_t handle,
- spci_vm_id_t receiver, spci_memory_access_permissions_t permissions,
- const struct spci_memory_region_constituent constituents[],
- uint32_t constituent_count);