refactor: rename type for FF-A IDs
The FF-A ID is a unsigned 16-bit value that was named
ffa_vm_id_t. This patch changes it to simply ffa_id_t.
This is to make clearer the ID type is used for other
endpoints other than simply VMs.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I60319c08481b2380bd0063b108a35fc01e2af537
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index c391744..98d1b3f 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -105,7 +105,7 @@
/**
* Returns the VM's own ID.
*/
-static inline ffa_vm_id_t hf_vm_get_id(void)
+static inline ffa_id_t hf_vm_get_id(void)
{
return ffa_id_get().arg2;
}
@@ -113,7 +113,7 @@
/**
* Runs the given vCPU of the given VM.
*/
-static inline struct ffa_value ffa_run(ffa_vm_id_t vm_id,
+static inline struct ffa_value ffa_run(ffa_id_t vm_id,
ffa_vcpu_index_t vcpu_idx)
{
return ffa_call((struct ffa_value){.func = FFA_RUN_32,
@@ -195,8 +195,8 @@
* - 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 ffa_value ffa_msg_send(ffa_vm_id_t sender_vm_id,
- ffa_vm_id_t target_vm_id,
+static inline struct ffa_value ffa_msg_send(ffa_id_t sender_vm_id,
+ ffa_id_t target_vm_id,
uint32_t size, uint32_t attributes)
{
return ffa_call((struct ffa_value){
@@ -369,7 +369,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(ffa_vm_id_t vm_id)
+static inline int64_t hf_mailbox_waiter_get(ffa_id_t vm_id)
{
return hf_call(HF_MAILBOX_WAITER_GET, vm_id, 0, 0);
}
@@ -418,7 +418,7 @@
* - 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(ffa_vm_id_t target_vm_id,
+static inline int64_t hf_interrupt_inject(ffa_id_t target_vm_id,
ffa_vcpu_index_t target_vcpu_idx,
uint32_t intid)
{
@@ -470,7 +470,7 @@
}
static inline struct ffa_value ffa_msg_send_direct_req(
- ffa_vm_id_t sender_vm_id, ffa_vm_id_t target_vm_id, uint32_t arg3,
+ ffa_id_t sender_vm_id, ffa_id_t target_vm_id, uint32_t arg3,
uint32_t arg4, uint32_t arg5, uint32_t arg6, uint32_t arg7)
{
return ffa_call((struct ffa_value){
@@ -485,7 +485,7 @@
}
static inline struct ffa_value ffa_msg_send_direct_resp(
- ffa_vm_id_t sender_vm_id, ffa_vm_id_t target_vm_id, uint32_t arg3,
+ ffa_id_t sender_vm_id, ffa_id_t target_vm_id, uint32_t arg3,
uint32_t arg4, uint32_t arg5, uint32_t arg6, uint32_t arg7)
{
return ffa_call((struct ffa_value){
@@ -500,7 +500,7 @@
}
static inline struct ffa_value ffa_notification_bind(
- ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
+ ffa_id_t sender_vm_id, ffa_id_t receiver_vm_id, uint32_t flags,
ffa_notifications_bitmap_t bitmap)
{
return ffa_call((struct ffa_value){
@@ -513,7 +513,7 @@
}
static inline struct ffa_value ffa_notification_unbind(
- ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id,
+ ffa_id_t sender_vm_id, ffa_id_t receiver_vm_id,
ffa_notifications_bitmap_t bitmap)
{
return ffa_call((struct ffa_value){
@@ -525,7 +525,7 @@
}
static inline struct ffa_value ffa_notification_set(
- ffa_vm_id_t sender_vm_id, ffa_vm_id_t receiver_vm_id, uint32_t flags,
+ ffa_id_t sender_vm_id, ffa_id_t receiver_vm_id, uint32_t flags,
ffa_notifications_bitmap_t bitmap)
{
return ffa_call((struct ffa_value){
@@ -537,7 +537,7 @@
});
}
-static inline struct ffa_value ffa_notification_get(ffa_vm_id_t receiver_vm_id,
+static inline struct ffa_value ffa_notification_get(ffa_id_t receiver_vm_id,
ffa_vcpu_index_t vcpu_id,
uint32_t flags)
{
diff --git a/inc/vmapi/hf/ffa.h b/inc/vmapi/hf/ffa.h
index ca965a3..26e777a 100644
--- a/inc/vmapi/hf/ffa.h
+++ b/inc/vmapi/hf/ffa.h
@@ -163,7 +163,7 @@
#define FFA_PAGE_SIZE ((size_t)4096)
/** The ID of a VM. These are assigned sequentially starting with an offset. */
-typedef uint16_t ffa_vm_id_t;
+typedef uint16_t ffa_id_t;
/**
* Partition message header as specified by table 6.2 from FF-A v1.1 EAC0
@@ -185,7 +185,7 @@
#define FFA_RXTX_ALLOCATOR_SHIFT 16
static inline void ffa_rxtx_header_init(
- ffa_vm_id_t sender, ffa_vm_id_t receiver, uint32_t size,
+ ffa_id_t sender, ffa_id_t receiver, uint32_t size,
struct ffa_partition_rxtx_header *header)
{
header->flags = 0;
@@ -196,16 +196,16 @@
header->size = size;
}
-static inline ffa_vm_id_t ffa_rxtx_header_sender(
+static inline ffa_id_t ffa_rxtx_header_sender(
const struct ffa_partition_rxtx_header *h)
{
- return (ffa_vm_id_t)(h->sender_receiver >> FFA_RXTX_SENDER_SHIFT);
+ return (ffa_id_t)(h->sender_receiver >> FFA_RXTX_SENDER_SHIFT);
}
-static inline ffa_vm_id_t ffa_rxtx_header_receiver(
+static inline ffa_id_t ffa_rxtx_header_receiver(
const struct ffa_partition_rxtx_header *h)
{
- return (ffa_vm_id_t)(h->sender_receiver);
+ return (ffa_id_t)(h->sender_receiver);
}
/* The maximum length possible for a single message. */
@@ -359,7 +359,7 @@
* 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;
+typedef ffa_id_t ffa_vm_count_t;
/** The index of a vCPU within a particular VM. */
typedef uint16_t ffa_vcpu_index_t;
@@ -406,12 +406,12 @@
return (int32_t)val.arg2;
}
-static inline ffa_vm_id_t ffa_sender(struct ffa_value args)
+static inline ffa_id_t ffa_sender(struct ffa_value args)
{
return (args.arg1 >> 16) & 0xffff;
}
-static inline ffa_vm_id_t ffa_receiver(struct ffa_value args)
+static inline ffa_id_t ffa_receiver(struct ffa_value args)
{
return args.arg1 & 0xffff;
}
@@ -476,7 +476,7 @@
.arg3 = (uint32_t)(handle >> 32)};
}
-static inline ffa_vm_id_t ffa_vm_id(struct ffa_value args)
+static inline ffa_id_t ffa_vm_id(struct ffa_value args)
{
return (args.arg1 >> 16) & 0xffff;
}
@@ -486,13 +486,12 @@
return args.arg1 & 0xffff;
}
-static inline uint64_t ffa_vm_vcpu(ffa_vm_id_t vm_id,
- ffa_vcpu_index_t vcpu_index)
+static inline uint64_t ffa_vm_vcpu(ffa_id_t vm_id, ffa_vcpu_index_t vcpu_index)
{
return ((uint32_t)vm_id << 16) | vcpu_index;
}
-static inline ffa_vm_id_t ffa_frag_sender(struct ffa_value args)
+static inline ffa_id_t ffa_frag_sender(struct ffa_value args)
{
return (args.arg4 >> 16) & 0xffff;
}
@@ -573,7 +572,7 @@
* in FF-A 1.1 EAC0 specification.
*/
struct ffa_partition_info {
- ffa_vm_id_t vm_id;
+ ffa_id_t vm_id;
ffa_vcpu_count_t vcpu_count;
ffa_partition_properties_t properties;
struct ffa_uuid uuid;
@@ -841,7 +840,7 @@
*/
struct ffa_memory_region_attributes {
/** The ID of the VM to which the memory is being given or shared. */
- ffa_vm_id_t receiver;
+ ffa_id_t receiver;
/**
* The permissions with which the memory region should be mapped in the
* receiver's page table.
@@ -917,7 +916,7 @@
* The ID of the VM which originally sent the memory region, i.e. the
* owner.
*/
- ffa_vm_id_t sender;
+ ffa_id_t sender;
ffa_memory_attributes_t attributes;
/** Flags to control behaviour of the transaction. */
ffa_memory_region_flags_t flags;
@@ -959,7 +958,7 @@
ffa_memory_handle_t handle;
ffa_memory_region_flags_t flags;
uint32_t endpoint_count;
- ffa_vm_id_t endpoints[];
+ ffa_id_t endpoints[];
};
/**
@@ -984,13 +983,13 @@
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)
+ ffa_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);
+ return sizeof(struct ffa_mem_relinquish) + sizeof(ffa_id_t);
}
void ffa_copy_memory_region_constituents(
@@ -1003,7 +1002,7 @@
* to the SPMC, in order to allow indirect messaging.
*/
struct ffa_endpoint_rx_tx_descriptor {
- ffa_vm_id_t endpoint_id;
+ ffa_id_t endpoint_id;
uint16_t reserved;
/*
@@ -1037,19 +1036,19 @@
}
void ffa_memory_region_init_header(struct ffa_memory_region *memory_region,
- ffa_vm_id_t sender,
+ ffa_id_t sender,
ffa_memory_attributes_t attributes,
ffa_memory_region_flags_t flags,
ffa_memory_handle_t handle, uint32_t tag,
uint32_t receiver_count);
void ffa_memory_access_init_permissions(
- struct ffa_memory_access *receiver, ffa_vm_id_t receiver_id,
+ struct ffa_memory_access *receiver, ffa_id_t receiver_id,
enum ffa_data_access data_access,
enum ffa_instruction_access instruction_access,
ffa_memory_receiver_flags_t flags);
uint32_t ffa_memory_region_init_single_receiver(
struct ffa_memory_region *memory_region, size_t memory_region_max_size,
- ffa_vm_id_t sender, ffa_vm_id_t receiver,
+ ffa_id_t sender, ffa_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,
@@ -1059,7 +1058,7 @@
uint32_t *total_length);
uint32_t ffa_memory_region_init(
struct ffa_memory_region *memory_region, size_t memory_region_max_size,
- ffa_vm_id_t sender, struct ffa_memory_access receivers[],
+ ffa_id_t sender, struct ffa_memory_access receivers[],
uint32_t receiver_count,
const struct ffa_memory_region_constituent constituents[],
uint32_t constituent_count, uint32_t tag,
@@ -1069,25 +1068,25 @@
uint32_t *total_length);
uint32_t ffa_memory_retrieve_request_init(
struct ffa_memory_region *memory_region, ffa_memory_handle_t handle,
- ffa_vm_id_t sender, struct ffa_memory_access receivers[],
+ ffa_id_t sender, struct ffa_memory_access receivers[],
uint32_t receiver_count, uint32_t tag, ffa_memory_region_flags_t flags,
enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,
enum ffa_memory_shareability shareability);
uint32_t ffa_memory_retrieve_request_init_single_receiver(
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_id_t sender, ffa_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);
+ ffa_id_t sender);
uint32_t ffa_memory_fragment_init(
struct ffa_memory_region_constituent *fragment,
size_t fragment_max_size,
const struct ffa_memory_region_constituent constituents[],
uint32_t constituent_count, uint32_t *fragment_length);
void ffa_endpoint_rx_tx_descriptor_init(
- struct ffa_endpoint_rx_tx_descriptor *desc, ffa_vm_id_t endpoint_id,
+ struct ffa_endpoint_rx_tx_descriptor *desc, ffa_id_t endpoint_id,
uint64_t rx_address, uint64_t tx_address);
diff --git a/inc/vmapi/hf/ffa_v1_0.h b/inc/vmapi/hf/ffa_v1_0.h
index 22824e4..980473f 100644
--- a/inc/vmapi/hf/ffa_v1_0.h
+++ b/inc/vmapi/hf/ffa_v1_0.h
@@ -25,7 +25,7 @@
* in DEN0077A FF-A 1.0 REL specification.
*/
struct ffa_partition_info_v1_0 {
- ffa_vm_id_t vm_id;
+ ffa_id_t vm_id;
ffa_vcpu_count_t vcpu_count;
ffa_partition_properties_t properties;
};
@@ -41,7 +41,7 @@
* The ID of the VM which originally sent the memory region, i.e. the
* owner.
*/
- ffa_vm_id_t sender;
+ ffa_id_t sender;
uint8_t attributes;
/** Reserved field, must be 0. */
uint8_t reserved_0;
@@ -89,13 +89,13 @@
}
void ffa_memory_region_init_header_v1_0(
- struct ffa_memory_region_v1_0 *memory_region, ffa_vm_id_t sender,
+ struct ffa_memory_region_v1_0 *memory_region, ffa_id_t sender,
ffa_memory_attributes_t attributes, ffa_memory_region_flags_t flags,
ffa_memory_handle_t handle, uint32_t tag, uint32_t receiver_count);
uint32_t ffa_memory_region_init_v1_0(
struct ffa_memory_region_v1_0 *memory_region,
- size_t memory_region_max_size, ffa_vm_id_t sender,
+ size_t memory_region_max_size, ffa_id_t sender,
struct ffa_memory_access receivers[], uint32_t receiver_count,
const struct ffa_memory_region_constituent constituents[],
uint32_t constituent_count, uint32_t tag,
@@ -106,7 +106,7 @@
uint32_t ffa_memory_retrieve_request_init_v1_0(
struct ffa_memory_region_v1_0 *memory_region,
- ffa_memory_handle_t handle, ffa_vm_id_t sender,
+ ffa_memory_handle_t handle, ffa_id_t sender,
struct ffa_memory_access receivers[], uint32_t receiver_count,
uint32_t tag, ffa_memory_region_flags_t flags,
enum ffa_memory_type type, enum ffa_memory_cacheability cacheability,