diff --git a/hypervisor/arch/x86/ept.c b/hypervisor/arch/x86/ept.c index f3b774cf1..403e0f67b 100644 --- a/hypervisor/arch/x86/ept.c +++ b/hypervisor/arch/x86/ept.c @@ -469,7 +469,7 @@ int ept_mmap(struct vm *vm, uint64_t hpa, uint64_t gpa, uint64_t size, uint32_t type, uint32_t prot) { struct map_params map_params; - int i; + uint16_t i; struct vcpu *vcpu; /* Setup memory map parameters */ @@ -516,7 +516,7 @@ int ept_update_mt(struct vm *vm, uint64_t hpa, { struct map_params map_params; struct vcpu *vcpu; - int i; + uint16_t i; /* Setup memory map parameters */ map_params.page_table_type = PTT_EPT; diff --git a/hypervisor/arch/x86/guest/guest.c b/hypervisor/arch/x86/guest/guest.c index 6122e77d7..aff939997 100644 --- a/hypervisor/arch/x86/guest/guest.c +++ b/hypervisor/arch/x86/guest/guest.c @@ -36,7 +36,7 @@ is_vm0(struct vm *vm) inline struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id) { - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { @@ -49,7 +49,7 @@ inline struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id) inline struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id) { - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { @@ -62,7 +62,7 @@ inline struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id) inline struct vcpu *get_primary_vcpu(struct vm *vm) { - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { @@ -91,7 +91,7 @@ inline uint64_t vcpumask2pcpumask(struct vm *vm, uint64_t vdmask) inline bool vm_lapic_disabled(struct vm *vm) { - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { diff --git a/hypervisor/arch/x86/guest/vioapic.c b/hypervisor/arch/x86/guest/vioapic.c index 797893f56..1f4c38e29 100644 --- a/hypervisor/arch/x86/guest/vioapic.c +++ b/hypervisor/arch/x86/guest/vioapic.c @@ -373,7 +373,7 @@ vioapic_write(struct vioapic *vioapic, uint32_t addr, uint32_t data) * to update their vlapic trigger-mode registers. */ if ((changed & ~(IOAPIC_RTE_INTMASK | IOAPIC_RTE_INTPOL)) != 0U) { - int i; + uint16_t i; struct vcpu *vcpu; dev_dbg(ACRN_DBG_IOAPIC, diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index a803e23d8..baca397c8 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -121,7 +121,7 @@ vm_lapic_from_pcpuid(struct vm *vm, uint16_t pcpu_id) static uint16_t vm_apicid2vcpu_id(struct vm *vm, uint8_t lapicid) { - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { @@ -138,7 +138,7 @@ static uint64_t vm_active_cpus(struct vm *vm) { uint64_t dmask = 0; - int i; + uint16_t i; struct vcpu *vcpu; foreach_vcpu(i, vm, vcpu) { diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index e60a717ef..b671d2d9f 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -87,7 +87,7 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm) /* Init mmio list */ INIT_LIST_HEAD(&vm->mmio_list); - if (vm->hw.num_vcpus == 0) + if (vm->hw.num_vcpus == 0U) vm->hw.num_vcpus = phys_cpu_num; vm->hw.vcpu_array = @@ -185,7 +185,8 @@ err1: int shutdown_vm(struct vm *vm) { - int i, status = 0; + int status = 0; + uint16_t i; struct vcpu *vcpu = NULL; if (vm == NULL) @@ -262,7 +263,7 @@ int start_vm(struct vm *vm) */ void pause_vm(struct vm *vm) { - int i; + uint16_t i; struct vcpu *vcpu = NULL; if (vm->state == VM_PAUSED) @@ -276,7 +277,7 @@ void pause_vm(struct vm *vm) void resume_vm(struct vm *vm) { - int i; + uint16_t i; struct vcpu *vcpu = NULL; foreach_vcpu(i, vm, vcpu) @@ -361,7 +362,7 @@ void vm_fixup(struct vm *vm) if (is_vm0(vm) && (vm->hw.exp_num_vcpus < vm->hw.num_vcpus)) { struct vm_description *vm_desc = &vm0_desc; struct vcpu *vcpu; - int i; + uint16_t i; foreach_vcpu(i, vm, vcpu) { if (!vcpu_in_vm_desc(vcpu, vm_desc)) { diff --git a/hypervisor/arch/x86/trusty.c b/hypervisor/arch/x86/trusty.c index 9a4168d49..13233d76e 100644 --- a/hypervisor/arch/x86/trusty.c +++ b/hypervisor/arch/x86/trusty.c @@ -84,7 +84,7 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig, IA32E_EPT_X_BIT); void *sub_table_addr = NULL, *pml4_base = NULL; struct vm *vm0 = get_vm_from_vmid(0); - int i; + uint16_t i; struct vcpu *vcpu; if (vm0 == NULL) { diff --git a/hypervisor/debug/shell_internal.c b/hypervisor/debug/shell_internal.c index 63297a4f8..7b4f954d8 100644 --- a/hypervisor/debug/shell_internal.c +++ b/hypervisor/debug/shell_internal.c @@ -503,7 +503,7 @@ int shell_list_vcpu(struct shell *p_shell, spinlock_obtain(&vm_list_lock); list_for_each(pos, &vm_list) { char state[32]; - int i; + uint16_t i; vm = list_entry(pos, struct vm, list); foreach_vcpu(i, vm, vcpu) { diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 4a3a79dfb..9479019c5 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -21,8 +21,8 @@ struct vm_attr { }; struct vm_hw_info { - int num_vcpus; /* Number of total virtual cores */ - int exp_num_vcpus; /* Number of real expected virtual cores */ + uint16_t num_vcpus; /* Number of total virtual cores */ + uint16_t exp_num_vcpus; /* Number of real expected virtual cores */ int created_vcpus; /* Number of created vcpus */ struct vcpu **vcpu_array; /* vcpu array of this VM */ uint64_t gpa_lowtop; /* top lowmem gpa of this VM */ @@ -163,7 +163,7 @@ struct vm_description { */ int *vm_hw_logical_core_ids; unsigned char GUID[16]; /* GUID of the vm will be created */ - int vm_hw_num_cores; /* Number of virtual cores */ + uint16_t vm_hw_num_cores; /* Number of virtual cores */ /* Whether secure world is enabled for current VM. */ bool sworld_enabled; };