Introduce typedef for vCPU index.
Change-Id: I51194706edb86811487f2a22b3bda5405e605b5e
diff --git a/inc/hf/api.h b/inc/hf/api.h
index 7d6b7c0..4060075 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -27,7 +27,8 @@
spci_vm_count_t api_vm_get_count(void);
int64_t api_vcpu_get_count(spci_vm_id_t vm_id, const struct vcpu *current);
void api_regs_state_saved(struct vcpu *vcpu);
-struct hf_vcpu_run_return api_vcpu_run(spci_vm_id_t vm_id, uint32_t vcpu_idx,
+struct hf_vcpu_run_return api_vcpu_run(spci_vm_id_t vm_id,
+ spci_vcpu_index_t vcpu_idx,
const struct vcpu *current,
struct vcpu **next);
int64_t api_vm_configure(ipaddr_t send, ipaddr_t recv, struct vcpu *current,
@@ -47,7 +48,7 @@
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,
- uint32_t target_vcpu_idx, uint32_t intid,
+ spci_vcpu_index_t target_vcpu_idx, uint32_t intid,
struct vcpu *current, struct vcpu **next);
int32_t api_spci_msg_send(uint32_t attributes, struct vcpu *current,
diff --git a/inc/hf/cpu.h b/inc/hf/cpu.h
index d0a5466..d370830 100644
--- a/inc/hf/cpu.h
+++ b/inc/hf/cpu.h
@@ -132,7 +132,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);
-size_t vcpu_index(const struct vcpu *vcpu);
+spci_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 4bebc20..bd8a905 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -102,4 +102,4 @@
struct vm *vm_find(spci_vm_id_t id);
struct vm_locked vm_lock(struct vm *vm);
void vm_unlock(struct vm_locked *locked);
-struct vcpu *vm_get_vcpu(struct vm *vm, uint32_t vcpu_index);
+struct vcpu *vm_get_vcpu(struct vm *vm, spci_vcpu_index_t vcpu_index);
diff --git a/inc/vmapi/hf/abi.h b/inc/vmapi/hf/abi.h
index a625a8e..538a42e 100644
--- a/inc/vmapi/hf/abi.h
+++ b/inc/vmapi/hf/abi.h
@@ -90,7 +90,7 @@
union {
struct {
spci_vm_id_t vm_id;
- uint16_t vcpu;
+ spci_vcpu_index_t vcpu;
} wake_up;
struct {
spci_vm_id_t vm_id;
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index 01be71f..64e658f 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -75,7 +75,7 @@
* Returns an hf_vcpu_run_return struct telling the scheduler what to do next.
*/
static inline struct hf_vcpu_run_return hf_vcpu_run(spci_vm_id_t vm_id,
- uint32_t vcpu_idx)
+ spci_vcpu_index_t vcpu_idx)
{
return hf_vcpu_run_return_decode(
hf_call(HF_VCPU_RUN, vm_id, vcpu_idx, 0));
@@ -218,7 +218,7 @@
* up or kick the target vCPU.
*/
static inline int64_t hf_interrupt_inject(spci_vm_id_t target_vm_id,
- uint32_t target_vcpu_idx,
+ spci_vcpu_index_t target_vcpu_idx,
uint32_t intid)
{
return hf_call(HF_INTERRUPT_INJECT, target_vm_id, target_vcpu_idx,
diff --git a/inc/vmapi/hf/spci.h b/inc/vmapi/hf/spci.h
index c387e62..25e8e83 100644
--- a/inc/vmapi/hf/spci.h
+++ b/inc/vmapi/hf/spci.h
@@ -68,6 +68,7 @@
* different name to make the different semantics clear.
*/
typedef spci_vm_id_t spci_vm_count_t;
+typedef uint16_t spci_vcpu_index_t;
/** SPCI common message header. */
struct spci_message {