diff --git a/hypervisor/arch/x86/assign.c b/hypervisor/arch/x86/assign.c index 94475decf..1dad43d15 100644 --- a/hypervisor/arch/x86/assign.c +++ b/hypervisor/arch/x86/assign.c @@ -537,7 +537,7 @@ void ptirq_intx_ack(struct acrn_vm *vm, uint8_t virt_pin, * entry_nr = 0 means first vector * user must provide bdf and entry_nr */ -int ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, +int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_nr, struct ptirq_msi_info *info) { struct ptirq_remapping_info *entry; @@ -625,7 +625,7 @@ static void activate_physical_ioapic(struct acrn_vm *vm, /* Main entry for PCI/Legacy device assignment with INTx, calling from vIOAPIC * or vPIC */ -int ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, +int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source vpin_src) { struct ptirq_remapping_info *entry; @@ -731,7 +731,7 @@ END: * - currently, one phys_pin can only be held by one pin source (vPIC or * vIOAPIC) */ -int ptirq_add_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, uint8_t phys_pin, +int32_t ptirq_add_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, uint8_t phys_pin, bool pic_pin) { struct ptirq_remapping_info *entry; @@ -758,7 +758,7 @@ void ptirq_remove_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, bool pic_ * - the entry is identified by phys_bdf:msi_idx: * one entry vs. one phys_bdf:msi_idx */ -int ptirq_add_msix_remapping(struct acrn_vm *vm, uint16_t virt_bdf, +int32_t ptirq_add_msix_remapping(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t phys_bdf, uint32_t vector_count) { struct ptirq_remapping_info *entry; diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 2ace517bc..5595bbbe0 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -52,7 +52,7 @@ static void cpu_xsave_init(void); static void set_current_cpu_id(uint16_t pcpu_id); static void print_hv_banner(void); static uint16_t get_cpu_id_from_lapic_id(uint32_t lapic_id); -int ibrs_type; +int32_t ibrs_type; static uint64_t start_tsc __attribute__((__section__(".bss_noinit"))); /* Push sp magic to top of stack for call trace */ @@ -184,9 +184,9 @@ static void get_cpu_capabilities(void) * we should supplement which feature/capability we must support * here later. */ -static int hardware_detect_support(void) +static int32_t hardware_detect_support(void) { - int ret; + int32_t ret; /* Long Mode (x86-64, 64-bit support) */ if (!cpu_has_cap(X86_FEATURE_LM)) { @@ -702,7 +702,7 @@ void cpu_dead(uint16_t pcpu_id) /* For debug purposes, using a stack variable in the while loop enables * us to modify the value using a JTAG probe and resume if needed. */ - int halt = 1; + int32_t halt = 1; if (bitmap_test_and_clear_lock(pcpu_id, &pcpu_active_bitmap)) { /* clean up native stuff */ diff --git a/hypervisor/arch/x86/cpu_state_tbl.c b/hypervisor/arch/x86/cpu_state_tbl.c index b3a6582e7..36d74ceb7 100644 --- a/hypervisor/arch/x86/cpu_state_tbl.c +++ b/hypervisor/arch/x86/cpu_state_tbl.c @@ -102,10 +102,10 @@ static const struct cpu_state_table { } }; -static int get_state_tbl_idx(const char *cpuname) +static int32_t get_state_tbl_idx(const char *cpuname) { - int i; - int count = ARRAY_SIZE(cpu_state_tbl); + int32_t i; + int32_t count = ARRAY_SIZE(cpu_state_tbl); if (cpuname == NULL) { return -1; @@ -123,7 +123,7 @@ static int get_state_tbl_idx(const char *cpuname) void load_cpu_state_data(void) { - int tbl_idx; + int32_t tbl_idx; const struct cpu_state_info *state_info; (void)memset(&boot_cpu_data.state_info, 0U, diff --git a/hypervisor/arch/x86/cpuid.c b/hypervisor/arch/x86/cpuid.c index 1e8188fa9..5a6b0c0dc 100644 --- a/hypervisor/arch/x86/cpuid.c +++ b/hypervisor/arch/x86/cpuid.c @@ -176,9 +176,9 @@ static void init_vcpuid_entry(uint32_t leaf, uint32_t subleaf, } } -int set_vcpuid_entries(struct acrn_vm *vm) +int32_t set_vcpuid_entries(struct acrn_vm *vm) { - int result; + int32_t result; struct vcpuid_entry entry; uint32_t limit; uint32_t i, j; diff --git a/hypervisor/arch/x86/ept.c b/hypervisor/arch/x86/ept.c index 04a882c9b..5f62c8083 100644 --- a/hypervisor/arch/x86/ept.c +++ b/hypervisor/arch/x86/ept.c @@ -71,9 +71,9 @@ uint64_t vm0_hpa2gpa(uint64_t hpa) return hpa; } -int ept_violation_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu) { - int status = -EINVAL, ret; + int32_t status = -EINVAL, ret; uint64_t exit_qual; uint64_t gpa; struct io_request *io_req = &vcpu->req; @@ -158,9 +158,9 @@ out: return status; } -int ept_misconfig_vmexit_handler(__unused struct acrn_vcpu *vcpu) +int32_t ept_misconfig_vmexit_handler(__unused struct acrn_vcpu *vcpu) { - int status; + int32_t status; status = -EINVAL; diff --git a/hypervisor/arch/x86/guest/guest.c b/hypervisor/arch/x86/guest/guest.c index fd87821c4..59701f40e 100644 --- a/hypervisor/arch/x86/guest/guest.c +++ b/hypervisor/arch/x86/guest/guest.c @@ -68,7 +68,7 @@ enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu) /* TODO: Add code to check for Revserved bits, SMAP and PKE when do translation * during page walk */ -static int local_gva2gpa_common(struct acrn_vcpu *vcpu, const struct page_walk_info *pw_info, +static int32_t local_gva2gpa_common(struct acrn_vcpu *vcpu, const struct page_walk_info *pw_info, uint64_t gva, uint64_t *gpa, uint32_t *err_code) { uint32_t i; @@ -77,8 +77,8 @@ static int local_gva2gpa_common(struct acrn_vcpu *vcpu, const struct page_walk_i void *base; uint64_t entry; uint64_t addr, page_size; - int ret = 0; - int fault = 0; + int32_t ret = 0; + int32_t fault = 0; bool is_user_mode_addr = true; bool is_page_rw_flags_on = true; @@ -215,14 +215,14 @@ out: return ret; } -static int local_gva2gpa_pae(struct acrn_vcpu *vcpu, struct page_walk_info *pw_info, +static int32_t local_gva2gpa_pae(struct acrn_vcpu *vcpu, struct page_walk_info *pw_info, uint64_t gva, uint64_t *gpa, uint32_t *err_code) { - int index; + int32_t index; uint64_t *base; uint64_t entry; uint64_t addr; - int ret; + int32_t ret; addr = pw_info->top_entry & 0xFFFFFFF0U; base = (uint64_t *)gpa2hva(vcpu->vm, addr); @@ -265,12 +265,12 @@ out: * - Return -EFAULT for paging fault, and refer to err_code for paging fault * error code. */ -int gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, +int32_t gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code) { enum vm_paging_mode pm = get_vcpu_paging_mode(vcpu); struct page_walk_info pw_info; - int ret = 0; + int32_t ret = 0; if ((gpa == NULL) || (err_code == NULL)) { return -EINVAL; @@ -356,7 +356,7 @@ static inline uint32_t local_copy_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t return len; } -static inline int copy_gpa(struct acrn_vm *vm, void *h_ptr_arg, uint64_t gpa_arg, +static inline int32_t copy_gpa(struct acrn_vm *vm, void *h_ptr_arg, uint64_t gpa_arg, uint32_t size_arg, bool cp_from_vm) { void *h_ptr = h_ptr_arg; @@ -381,7 +381,7 @@ static inline int copy_gpa(struct acrn_vm *vm, void *h_ptr_arg, uint64_t gpa_arg /* * @pre vcpu != NULL && err_code != NULL */ -static inline int copy_gva(struct acrn_vcpu *vcpu, void *h_ptr_arg, uint64_t gva_arg, +static inline int32_t copy_gva(struct acrn_vcpu *vcpu, void *h_ptr_arg, uint64_t gva_arg, uint32_t size_arg, uint32_t *err_code, uint64_t *fault_addr, bool cp_from_vm) { @@ -423,7 +423,7 @@ static inline int copy_gva(struct acrn_vcpu *vcpu, void *h_ptr_arg, uint64_t gva * continuous * @pre Pointer vm is non-NULL */ -int copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size) +int32_t copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size) { return copy_gpa(vm, h_ptr, gpa, size, 1); } @@ -434,18 +434,18 @@ int copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size) * continuous * @pre Pointer vm is non-NULL */ -int copy_to_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size) +int32_t copy_to_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size) { return copy_gpa(vm, h_ptr, gpa, size, 0); } -int copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, +int32_t copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, uint32_t size, uint32_t *err_code, uint64_t *fault_addr) { return copy_gva(vcpu, h_ptr, gva, size, err_code, fault_addr, 1); } -int copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, +int32_t copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, uint32_t size, uint32_t *err_code, uint64_t *fault_addr) { return copy_gva(vcpu, h_ptr, gva, size, err_code, fault_addr, 0); @@ -459,7 +459,7 @@ int copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, * @pre vm != NULL * @pre is_vm0(vm) == true */ -int prepare_vm0_memmap(struct acrn_vm *vm) +int32_t prepare_vm0_memmap(struct acrn_vm *vm) { uint32_t i; uint64_t attr_uc = (EPT_RWX | EPT_UNCACHED); diff --git a/hypervisor/arch/x86/guest/instr_emul.c b/hypervisor/arch/x86/guest/instr_emul.c index fe442b29a..6f8f74088 100644 --- a/hypervisor/arch/x86/guest/instr_emul.c +++ b/hypervisor/arch/x86/guest/instr_emul.c @@ -399,7 +399,7 @@ static void get_guest_paging_info(struct acrn_vcpu *vcpu, struct instr_emul_ctxt emul_ctxt->paging.paging_mode = get_vcpu_paging_mode(vcpu); } -static int vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla) +static int32_t vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla) { uint64_t mask; @@ -461,7 +461,7 @@ static bool is_desc_valid(struct seg_desc *desc, uint32_t prot) *return 0 - on success *return -1 - on failure */ -static int vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum cpu_reg_name seg, +static int32_t vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum cpu_reg_name seg, struct seg_desc *desc, uint64_t offset_arg, uint8_t addrsize, uint64_t *gla) { @@ -509,7 +509,7 @@ static inline void vie_mmio_write(struct acrn_vcpu *vcpu, uint64_t wval) } static void vie_calc_bytereg(const struct instr_emul_vie *vie, - enum cpu_reg_name *reg, int *lhbr) + enum cpu_reg_name *reg, int32_t *lhbr) { *lhbr = 0; *reg = (enum cpu_reg_name)(vie->reg); @@ -536,7 +536,7 @@ static void vie_calc_bytereg(const struct instr_emul_vie *vie, static uint8_t vie_read_bytereg(const struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int lhbr; + int32_t lhbr; uint64_t val; uint8_t reg_val; enum cpu_reg_name reg; @@ -562,7 +562,7 @@ static void vie_write_bytereg(struct acrn_vcpu *vcpu, const struct instr_emul_vi { uint64_t origval, val, mask; enum cpu_reg_name reg; - int lhbr; + int32_t lhbr; vie_calc_bytereg(vie, ®, &lhbr); origval = vm_get_register(vcpu, reg); @@ -660,9 +660,9 @@ static uint64_t getcc(uint8_t opsize, uint64_t x, uint64_t y) } } -static int emulate_mov(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_mov(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; enum cpu_reg_name reg; uint8_t byte; @@ -771,9 +771,9 @@ static int emulate_mov(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) return error; } -static int emulate_movx(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_movx(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; enum cpu_reg_name reg; uint64_t val; @@ -890,10 +890,10 @@ static void get_gva_si_nocheck(const struct acrn_vcpu *vcpu, uint8_t addrsize, * * It's only used by MOVS/STO */ -static int get_gva_di_check(struct acrn_vcpu *vcpu, struct instr_emul_vie *vie, +static int32_t get_gva_di_check(struct acrn_vcpu *vcpu, struct instr_emul_vie *vie, uint8_t addrsize, uint64_t *gva) { - int ret; + int32_t ret; uint32_t err_code; struct seg_desc desc; enum vm_cpu_mode cpu_mode; @@ -962,14 +962,14 @@ exception_inject: * For MOVs instruction, we always check RDI during instruction decoding phase. * And access RSI without any check during instruction emulation phase. */ -static int emulate_movs(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_movs(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { uint64_t src_gva, gpa, val = 0UL; uint64_t *dst_hva, *src_hva; uint64_t rcx, rdi, rsi, rflags; uint32_t err_code; enum cpu_reg_name seg; - int error; + int32_t error; uint8_t repeat, opsize = vie->opsize; bool is_mmio_write; @@ -1049,7 +1049,7 @@ done: return error; } -static int emulate_stos(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_stos(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { uint8_t repeat, opsize = vie->opsize; uint64_t val; @@ -1099,9 +1099,9 @@ static int emulate_stos(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie return 0; } -static int emulate_test(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_test(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; enum cpu_reg_name reg; uint64_t result, rflags2, val1, val2; @@ -1163,9 +1163,9 @@ static int emulate_test(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie return error; } -static int emulate_and(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_and(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; enum cpu_reg_name reg; uint64_t result, rflags2, val1, val2; @@ -1246,9 +1246,9 @@ static int emulate_and(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) return error; } -static int emulate_or(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_or(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; enum cpu_reg_name reg; uint64_t val1, val2, result, rflags2; @@ -1332,9 +1332,9 @@ static int emulate_or(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) return error; } -static int emulate_cmp(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_cmp(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error = 0; + int32_t error = 0; uint8_t size; uint64_t regop, memop, op1, op2, rflags2; enum cpu_reg_name reg; @@ -1418,9 +1418,9 @@ static int emulate_cmp(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) return error; } -static int emulate_sub(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_sub(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; uint8_t size; uint64_t nval, rflags2, val1, val2; enum cpu_reg_name reg; @@ -1468,9 +1468,9 @@ static int emulate_sub(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) return error; } -static int emulate_group1(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) +static int32_t emulate_group1(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie) { - int error; + int32_t error; switch (vie->reg & 7U) { case 0x1U: /* OR */ @@ -1531,11 +1531,11 @@ static int32_t emulate_bittest(struct acrn_vcpu *vcpu, const struct instr_emul_v return ret; } -static int vmm_emulate_instruction(struct instr_emul_ctxt *ctxt) +static int32_t vmm_emulate_instruction(struct instr_emul_ctxt *ctxt) { struct instr_emul_vie *vie = &ctxt->vie; struct acrn_vcpu *vcpu = ctxt->vcpu; - int error; + int32_t error; if (vie->decoded != 0U) { switch (vie->op.op_type) { @@ -1584,13 +1584,13 @@ static int vmm_emulate_instruction(struct instr_emul_ctxt *ctxt) return error; } -static int vie_init(struct instr_emul_vie *vie, struct acrn_vcpu *vcpu) +static int32_t vie_init(struct instr_emul_vie *vie, struct acrn_vcpu *vcpu) { uint64_t guest_rip_gva = vcpu_get_rip(vcpu); uint32_t inst_len = vcpu->arch.inst_len; uint32_t err_code; uint64_t fault_addr; - int ret; + int32_t ret; if ((inst_len > VIE_INST_SIZE) || (inst_len == 0U)) { pr_err("%s: invalid instruction length (%d)", @@ -1620,7 +1620,7 @@ static int vie_init(struct instr_emul_vie *vie, struct acrn_vcpu *vcpu) return 0; } -static int vie_peek(const struct instr_emul_vie *vie, uint8_t *x) +static int32_t vie_peek(const struct instr_emul_vie *vie, uint8_t *x) { if (vie->num_processed < vie->num_valid) { @@ -1665,7 +1665,7 @@ static bool segment_override(uint8_t x, enum cpu_reg_name *seg) return true; } -static int decode_prefixes(struct instr_emul_vie *vie, +static int32_t decode_prefixes(struct instr_emul_vie *vie, enum vm_cpu_mode cpu_mode, bool cs_d) { uint8_t x, i; @@ -1737,7 +1737,7 @@ static int decode_prefixes(struct instr_emul_vie *vie, return 0; } -static int decode_two_byte_opcode(struct instr_emul_vie *vie) +static int32_t decode_two_byte_opcode(struct instr_emul_vie *vie) { uint8_t x; @@ -1757,9 +1757,9 @@ static int decode_two_byte_opcode(struct instr_emul_vie *vie) return 0; } -static int decode_opcode(struct instr_emul_vie *vie) +static int32_t decode_opcode(struct instr_emul_vie *vie) { - int ret = 0; + int32_t ret = 0; uint8_t x; if (vie_peek(vie, &x) != 0) { @@ -1792,7 +1792,7 @@ static int decode_opcode(struct instr_emul_vie *vie) return ret; } -static int decode_modrm(struct instr_emul_vie *vie, enum vm_cpu_mode cpu_mode) +static int32_t decode_modrm(struct instr_emul_vie *vie, enum vm_cpu_mode cpu_mode) { uint8_t x; @@ -1885,7 +1885,7 @@ done: return 0; } -static int decode_sib(struct instr_emul_vie *vie) +static int32_t decode_sib(struct instr_emul_vie *vie) { uint8_t x; @@ -1965,7 +1965,7 @@ static int decode_sib(struct instr_emul_vie *vie) return 0; } -static int decode_displacement(struct instr_emul_vie *vie) +static int32_t decode_displacement(struct instr_emul_vie *vie) { uint8_t n, i, x; @@ -2004,7 +2004,7 @@ static int decode_displacement(struct instr_emul_vie *vie) return 0; } -static int decode_immediate(struct instr_emul_vie *vie) +static int32_t decode_immediate(struct instr_emul_vie *vie) { uint8_t i, n, x; union { @@ -2067,7 +2067,7 @@ static int decode_immediate(struct instr_emul_vie *vie) return 0; } -static int decode_moffset(struct instr_emul_vie *vie) +static int32_t decode_moffset(struct instr_emul_vie *vie) { uint8_t i, n, x; union { @@ -2102,7 +2102,7 @@ static int decode_moffset(struct instr_emul_vie *vie) return 0; } -static int local_decode_instruction(enum vm_cpu_mode cpu_mode, +static int32_t local_decode_instruction(enum vm_cpu_mode cpu_mode, bool cs_d, struct instr_emul_vie *vie) { if (decode_prefixes(vie, cpu_mode, cs_d) != 0) { @@ -2156,10 +2156,10 @@ static int32_t instr_check_di(struct acrn_vcpu *vcpu, struct instr_emul_ctxt *em return ret; } -static int instr_check_gva(struct acrn_vcpu *vcpu, struct instr_emul_ctxt *emul_ctxt, +static int32_t instr_check_gva(struct acrn_vcpu *vcpu, struct instr_emul_ctxt *emul_ctxt, enum vm_cpu_mode cpu_mode) { - int ret; + int32_t ret; uint64_t base, segbase, idx, gva, gpa; uint32_t err_code; enum cpu_reg_name seg; @@ -2242,11 +2242,11 @@ static int instr_check_gva(struct acrn_vcpu *vcpu, struct instr_emul_ctxt *emul_ return 0; } -int decode_instruction(struct acrn_vcpu *vcpu) +int32_t decode_instruction(struct acrn_vcpu *vcpu) { struct instr_emul_ctxt *emul_ctxt; uint32_t csar; - int retval; + int32_t retval; enum vm_cpu_mode cpu_mode; emul_ctxt = &per_cpu(g_inst_ctxt, vcpu->pcpu_id); @@ -2302,7 +2302,7 @@ int decode_instruction(struct acrn_vcpu *vcpu) } } - return (int)(emul_ctxt->vie.opsize); + return (int32_t)(emul_ctxt->vie.opsize); } int32_t emulate_instruction(const struct acrn_vcpu *vcpu) diff --git a/hypervisor/arch/x86/guest/instr_emul.h b/hypervisor/arch/x86/guest/instr_emul.h index 21e5b7596..481dca260 100644 --- a/hypervisor/arch/x86/guest/instr_emul.h +++ b/hypervisor/arch/x86/guest/instr_emul.h @@ -195,6 +195,6 @@ struct instr_emul_ctxt { }; int32_t emulate_instruction(const struct acrn_vcpu *vcpu); -int decode_instruction(struct acrn_vcpu *vcpu); +int32_t decode_instruction(struct acrn_vcpu *vcpu); #endif diff --git a/hypervisor/arch/x86/guest/pm.c b/hypervisor/arch/x86/guest/pm.c index f21ab23d5..a98f8f2e2 100644 --- a/hypervisor/arch/x86/guest/pm.c +++ b/hypervisor/arch/x86/guest/pm.c @@ -6,7 +6,7 @@ #include -int validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl) +int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl) { const struct cpu_px_data *px_data; uint8_t i, px_cnt; @@ -103,7 +103,7 @@ void vm_setup_cpu_state(struct acrn_vm *vm) /* This function is for power management Sx state implementation, * VM need to load the Sx state data to implement S3/S5. */ -int vm_load_pm_s_state(struct acrn_vm *vm) +int32_t vm_load_pm_s_state(struct acrn_vm *vm) { #ifdef ACPI_INFO_VALIDATED vm->pm.sx_state_data = (struct pm_s_state_data *)&host_pm_s_state; diff --git a/hypervisor/arch/x86/guest/ucode.c b/hypervisor/arch/x86/guest/ucode.c index b8c7c77a8..332eee7cc 100644 --- a/hypervisor/arch/x86/guest/ucode.c +++ b/hypervisor/arch/x86/guest/ucode.c @@ -37,7 +37,7 @@ void acrn_update_ucode(struct acrn_vcpu *vcpu, uint64_t v) uint64_t gva, fault_addr; struct ucode_header uhdr; size_t data_size; - int err; + int32_t err; uint32_t err_code; spinlock_obtain(µ_code_lock); diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index b9dd5e402..f2d442ef6 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -322,7 +322,7 @@ void set_ap_entry(struct acrn_vcpu *vcpu, uint64_t entry) * for physical CPU 1 : vcpu->pcpu_id = 1, vcpu->vcpu_id = 1, vmid = 1; * ***********************************************************************/ -int create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcpu_handle) +int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcpu_handle) { struct acrn_vcpu *vcpu; uint16_t vcpu_id; @@ -399,7 +399,7 @@ int create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcp /* * @pre vcpu != NULL */ -int run_vcpu(struct acrn_vcpu *vcpu) +int32_t run_vcpu(struct acrn_vcpu *vcpu) { uint32_t instlen, cs_attr; uint64_t rip, ia32_efer, cr0; @@ -499,7 +499,7 @@ int run_vcpu(struct acrn_vcpu *vcpu) return status; } -int shutdown_vcpu(__unused struct acrn_vcpu *vcpu) +int32_t shutdown_vcpu(__unused struct acrn_vcpu *vcpu) { /* TODO : Implement VCPU shutdown sequence */ @@ -522,7 +522,7 @@ void offline_vcpu(struct acrn_vcpu *vcpu) */ void reset_vcpu(struct acrn_vcpu *vcpu) { - int i; + int32_t i; struct acrn_vlapic *vlapic; pr_dbg("vcpu%hu reset", vcpu->vcpu_id); @@ -610,9 +610,9 @@ void schedule_vcpu(struct acrn_vcpu *vcpu) } /* help function for vcpu create */ -int prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id) +int32_t prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id) { - int ret = 0; + int32_t ret = 0; struct acrn_vcpu *vcpu = NULL; ret = create_vcpu(pcpu_id, vm, &vcpu); diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index 614c22abe..8b9ce666d 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -81,10 +81,10 @@ static inline void vlapic_dump_isr(__unused const struct acrn_vlapic *vlapic, __ /*APIC-v APIC-access address */ static uint8_t apicv_apic_access_addr[PAGE_SIZE] __aligned(PAGE_SIZE); -static int +static int32_t apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector); -static int +static int32_t apicv_pending_intr(const struct acrn_vlapic *vlapic); static void @@ -456,14 +456,14 @@ vlapic_esr_write_handler(struct acrn_vlapic *vlapic) * Returns 1 if the vcpu needs to be notified of the interrupt and 0 otherwise. * @pre vector >= 16 */ -static int +static int32_t vlapic_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector, bool level) { struct lapic_regs *lapic; struct lapic_reg *irrptr, *tmrptr; uint32_t mask; uint32_t idx; - int pending_intr; + int32_t pending_intr; ASSERT(vector <= NR_MAX_VECTOR, "invalid vector %u", vector); @@ -926,7 +926,7 @@ vlapic_set_error(struct acrn_vlapic *vlapic, uint32_t mask) /* * @pre vector <= 255 */ -static int +static int32_t vlapic_trigger_lvt(struct acrn_vlapic *vlapic, uint32_t vector) { uint32_t lvt; @@ -1206,7 +1206,7 @@ vlapic_process_init_sipi(struct acrn_vcpu* target_vcpu, uint32_t mode, } } -static int +static int32_t vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic) { uint16_t vcpu_id; @@ -1312,7 +1312,7 @@ vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic) * @remark The vector does not automatically transition to the ISR as a * result of calling this function. */ -int +int32_t vlapic_pending_intr(const struct acrn_vlapic *vlapic, uint32_t *vecptr) { const struct lapic_regs *lapic = &(vlapic->apic_page); @@ -1442,7 +1442,7 @@ vlapic_svr_write_handler(struct acrn_vlapic *vlapic) } } -static int +static int32_t vlapic_read(struct acrn_vlapic *vlapic, uint32_t offset_arg, uint64_t *data) { @@ -1566,14 +1566,14 @@ done: return 0; } -static int +static int32_t vlapic_write(struct acrn_vlapic *vlapic, uint32_t offset, uint64_t data) { struct lapic_regs *lapic = &(vlapic->apic_page); uint32_t *regptr; uint32_t data32 = (uint32_t)data; - int retval; + int32_t retval; ASSERT(((offset & 0xfU) == 0U) && (offset < PAGE_SIZE), "%s: invalid offset %#x", __func__, offset); @@ -1728,7 +1728,7 @@ vlapic_init(struct acrn_vlapic *vlapic) void vlapic_restore(struct acrn_vlapic *vlapic, const struct lapic_regs *regs) { struct lapic_regs *lapic; - int i; + int32_t i; lapic = &(vlapic->apic_page); @@ -1758,7 +1758,7 @@ vlapic_get_apicbase(const struct acrn_vlapic *vlapic) return vlapic->msr_apicbase; } -static int +static int32_t vlapic_set_apicbase(struct acrn_vlapic *vlapic, uint64_t new) { @@ -1955,7 +1955,7 @@ vlapic_set_local_intr(struct acrn_vm *vm, uint16_t vcpu_id_arg, uint32_t vector) { struct acrn_vlapic *vlapic; uint64_t dmask = 0UL; - int error; + int32_t error; uint16_t vcpu_id = vcpu_id_arg; if ((vcpu_id != BROADCAST_CPU_ID) && (vcpu_id >= vm->hw.created_vcpus)) { @@ -2082,7 +2082,7 @@ static inline uint32_t x2apic_msr_to_regoff(uint32_t msr) * No shorthand and Physical destination mode are only supported. */ -static int +static int32_t vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val) { uint64_t apic_id = (uint32_t) (val >> 32U); @@ -2123,12 +2123,12 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val) } #endif -static int vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write, +static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write, uint64_t *val) { struct acrn_vlapic *vlapic; uint32_t offset; - int error = -1; + int32_t error = -1; /* * If vLAPIC is in xAPIC mode and guest tries to access x2APIC MSRs @@ -2159,10 +2159,10 @@ static int vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write return error; } -int +int32_t vlapic_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval) { - int error = 0; + int32_t error = 0; struct acrn_vlapic *vlapic; dev_dbg(ACRN_DBG_LAPIC, "cpu[%hu] rdmsr: %x", vcpu->vcpu_id, msr); @@ -2191,10 +2191,10 @@ vlapic_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval) return error; } -int +int32_t vlapic_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval) { - int error = 0; + int32_t error = 0; struct acrn_vlapic *vlapic; vlapic = vcpu_vlapic(vcpu); @@ -2224,7 +2224,7 @@ vlapic_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval) return error; } -int vlapic_create(struct acrn_vcpu *vcpu) +int32_t vlapic_create(struct acrn_vcpu *vcpu) { vcpu->arch.vlapic.vm = vcpu->vm; vcpu->arch.vlapic.vcpu = vcpu; @@ -2264,7 +2264,7 @@ void vlapic_free(struct acrn_vcpu *vcpu) /** * APIC-v functions * **/ -static int +static int32_t apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector) { struct vlapic_pir_desc *pir_desc; @@ -2282,7 +2282,7 @@ apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector) return notify; } -static int +static int32_t apicv_pending_intr(const struct acrn_vlapic *vlapic) { const struct vlapic_pir_desc *pir_desc; @@ -2428,9 +2428,9 @@ vlapic_apicv_inject_pir(struct acrn_vlapic *vlapic) } } -int apic_access_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t apic_access_vmexit_handler(struct acrn_vcpu *vcpu) { - int err = 0; + int32_t err = 0; uint32_t offset = 0U; uint64_t qual, access_type; struct acrn_vlapic *vlapic; @@ -2473,7 +2473,7 @@ int apic_access_vmexit_handler(struct acrn_vcpu *vcpu) return err; } -int veoi_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t veoi_vmexit_handler(struct acrn_vcpu *vcpu) { struct acrn_vlapic *vlapic = NULL; @@ -2514,10 +2514,10 @@ static void vlapic_x2apic_self_ipi_handler(struct acrn_vlapic *vlapic) vlapic_set_intr(target_vcpu, vector, LAPIC_TRIG_EDGE); } -int apic_write_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t apic_write_vmexit_handler(struct acrn_vcpu *vcpu) { uint64_t qual; - int error, handled; + int32_t error, handled; uint32_t offset; struct acrn_vlapic *vlapic = NULL; @@ -2584,7 +2584,7 @@ int apic_write_vmexit_handler(struct acrn_vcpu *vcpu) return handled; } -int tpr_below_threshold_vmexit_handler(__unused struct acrn_vcpu *vcpu) +int32_t tpr_below_threshold_vmexit_handler(__unused struct acrn_vcpu *vcpu) { pr_err("Unhandled %s.", __func__); return 0; diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 6dfb009af..3f0ebb376 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -60,10 +60,10 @@ struct acrn_vm *get_vm_from_vmid(uint16_t vm_id) /** * @pre vm_desc != NULL && rtn_vm != NULL */ -int create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) +int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) { struct acrn_vm *vm; - int status; + int32_t status; uint16_t vm_id; #ifdef CONFIG_PARTITION_MODE @@ -240,7 +240,7 @@ int32_t shutdown_vm(struct acrn_vm *vm) /** * * @pre vm != NULL */ -int start_vm(struct acrn_vm *vm) +int32_t start_vm(struct acrn_vm *vm) { struct acrn_vcpu *vcpu = NULL; @@ -348,9 +348,9 @@ void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec) #ifdef CONFIG_PARTITION_MODE /* Create vm/vcpu for vm */ -int prepare_vm(uint16_t pcpu_id) +int32_t prepare_vm(uint16_t pcpu_id) { - int ret = 0; + int32_t ret = 0; uint16_t i; struct acrn_vm *vm = NULL; struct vm_description *vm_desc = NULL; @@ -389,9 +389,9 @@ int prepare_vm(uint16_t pcpu_id) #else /* Create vm/vcpu for vm0 */ -static int prepare_vm0(void) +static int32_t prepare_vm0(void) { - int err; + int32_t err; uint16_t i; struct acrn_vm *vm = NULL; struct vm_description vm0_desc; @@ -428,9 +428,9 @@ static int prepare_vm0(void) return err; } -int prepare_vm(uint16_t pcpu_id) +int32_t prepare_vm(uint16_t pcpu_id) { - int err = 0; + int32_t err = 0; /* prepare vm0 if pcpu_id is BOOT_CPU_ID */ if (pcpu_id == BOOT_CPU_ID) { diff --git a/hypervisor/arch/x86/guest/vmcall.c b/hypervisor/arch/x86/guest/vmcall.c index 300c4f5d7..4903a7803 100644 --- a/hypervisor/arch/x86/guest/vmcall.c +++ b/hypervisor/arch/x86/guest/vmcall.c @@ -16,7 +16,7 @@ static spinlock_t vmm_hypercall_lock = { * This function should always return 0 since we shouldn't * deal with hypercall error in hypervisor. */ -int vmcall_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t vmcall_vmexit_handler(struct acrn_vcpu *vcpu) { int32_t ret = -EACCES; struct acrn_vm *vm = vcpu->vm; diff --git a/hypervisor/arch/x86/guest/vmsr.c b/hypervisor/arch/x86/guest/vmsr.c index 50191b6ff..4c836e6c2 100644 --- a/hypervisor/arch/x86/guest/vmsr.c +++ b/hypervisor/arch/x86/guest/vmsr.c @@ -318,9 +318,9 @@ void init_msr_emulation(struct acrn_vcpu *vcpu) init_msr_area(vcpu); } -int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t rdmsr_vmexit_handler(struct acrn_vcpu *vcpu) { - int err = 0; + int32_t err = 0; uint32_t msr; uint64_t v = 0UL; @@ -405,9 +405,9 @@ int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu) return err; } -int wrmsr_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t wrmsr_vmexit_handler(struct acrn_vcpu *vcpu) { - int err = 0; + int32_t err = 0; uint32_t msr; uint64_t v; diff --git a/hypervisor/arch/x86/io.c b/hypervisor/arch/x86/io.c index 75075dc13..012d5860b 100644 --- a/hypervisor/arch/x86/io.c +++ b/hypervisor/arch/x86/io.c @@ -241,7 +241,7 @@ hv_emulate_pio(const struct acrn_vcpu *vcpu, struct io_request *io_req) static int32_t hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req) { - int status = -ENODEV; + int32_t status = -ENODEV; uint16_t idx; uint64_t address, size; struct mmio_request *mmio_req = &io_req->reqs.mmio; @@ -475,11 +475,11 @@ void register_io_emulation_handler(struct acrn_vm *vm, uint32_t pio_idx, * @retval 0 Registration succeeds * @retval -EINVAL \p read_write is NULL, \p end is not larger than \p start or \p vm has been launched */ -int register_mmio_emulation_handler(struct acrn_vm *vm, +int32_t register_mmio_emulation_handler(struct acrn_vm *vm, hv_mem_io_handler_t read_write, uint64_t start, uint64_t end, void *handler_private_data) { - int status = -EINVAL; + int32_t status = -EINVAL; struct mem_io_node *mmio_node; if ((vm->hw.created_vcpus > 0U) && vm->hw.vcpu_array[0].launched) { diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index 56935ce40..bd170b4f7 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -66,7 +66,7 @@ struct invept_desc { static inline void local_invvpid(uint64_t type, uint16_t vpid, uint64_t gva) { - int error = 0; + int32_t error = 0; struct { uint32_t vpid : 16; @@ -86,7 +86,7 @@ static inline void local_invvpid(uint64_t type, uint16_t vpid, uint64_t gva) static inline void local_invept(uint64_t type, struct invept_desc desc) { - int error = 0; + int32_t error = 0; asm volatile ("invept %1, %2\n" VMFAIL_INVALID_EPT_VPID @@ -107,7 +107,7 @@ static inline bool cpu_has_vmx_vpid_cap(uint32_t bit_mask) return ((vmx_caps.vpid & bit_mask) != 0U); } -int check_vmx_mmu_cap(void) +int32_t check_vmx_mmu_cap(void) { uint64_t val; diff --git a/hypervisor/arch/x86/notify.c b/hypervisor/arch/x86/notify.c index 2048e3528..7e3ef679d 100644 --- a/hypervisor/arch/x86/notify.c +++ b/hypervisor/arch/x86/notify.c @@ -55,7 +55,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data) wait_sync_change(&smp_call_mask, 0UL); } -static int request_notification_irq(irq_action_t func, void *data) +static int32_t request_notification_irq(irq_action_t func, void *data) { int32_t retval; diff --git a/hypervisor/arch/x86/static_checks.c b/hypervisor/arch/x86/static_checks.c index dd4584bf3..f0564763c 100644 --- a/hypervisor/arch/x86/static_checks.c +++ b/hypervisor/arch/x86/static_checks.c @@ -9,7 +9,7 @@ #define CAT__(A,B) A ## B #define CAT_(A,B) CAT__(A,B) #define CTASSERT(expr) \ -typedef int CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1] +typedef int32_t CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1] /* Build time sanity checks to make sure hard-coded offset * is matching the actual offset! diff --git a/hypervisor/arch/x86/timer.c b/hypervisor/arch/x86/timer.c index 238e35493..ae4d34e62 100644 --- a/hypervisor/arch/x86/timer.c +++ b/hypervisor/arch/x86/timer.c @@ -70,7 +70,7 @@ static void local_add_timer(struct per_cpu_timers *cpu_timer, } } -int add_timer(struct hv_timer *timer) +int32_t add_timer(struct hv_timer *timer) { struct per_cpu_timers *cpu_timer; uint16_t pcpu_id; @@ -134,7 +134,7 @@ static void timer_softirq(uint16_t pcpu_id) struct per_cpu_timers *cpu_timer; struct hv_timer *timer; struct list_head *pos, *n; - int tries = MAX_TIMER_ACTIONS; + int32_t tries = MAX_TIMER_ACTIONS; uint64_t current_tsc = rdtsc(); /* handle passed timer */ diff --git a/hypervisor/arch/x86/trampoline.c b/hypervisor/arch/x86/trampoline.c index 010ea22cf..fb0330258 100644 --- a/hypervisor/arch/x86/trampoline.c +++ b/hypervisor/arch/x86/trampoline.c @@ -43,7 +43,7 @@ static void update_trampoline_code_refs(uint64_t dest_pa) { void *ptr; uint64_t val; - int i; + int32_t i; /* * calculate the fixup CS:IP according to fixup target address diff --git a/hypervisor/arch/x86/trusty.c b/hypervisor/arch/x86/trusty.c index 7385a1c0b..70a0d89cf 100644 --- a/hypervisor/arch/x86/trusty.c +++ b/hypervisor/arch/x86/trusty.c @@ -279,7 +279,7 @@ static void copy_smc_param(const struct run_context *prev_ctx, next_ctx->guest_cpu_regs.regs.rbx = prev_ctx->guest_cpu_regs.regs.rbx; } -void switch_world(struct acrn_vcpu *vcpu, int next_world) +void switch_world(struct acrn_vcpu *vcpu, int32_t next_world) { struct acrn_vcpu_arch *arch = &vcpu->arch; diff --git a/hypervisor/arch/x86/virq.c b/hypervisor/arch/x86/virq.c index cebc8ea8e..e669150e4 100644 --- a/hypervisor/arch/x86/virq.c +++ b/hypervisor/arch/x86/virq.c @@ -74,7 +74,7 @@ static bool vcpu_pending_request(struct acrn_vcpu *vcpu) { struct acrn_vlapic *vlapic; uint32_t vector = 0U; - int ret = 0; + int32_t ret = 0; /* Query vLapic to get vector to inject */ vlapic = vcpu_vlapic(vcpu); @@ -108,11 +108,11 @@ void vcpu_make_request(struct acrn_vcpu *vcpu, uint16_t eventid) } } -static int vcpu_inject_vlapic_int(struct acrn_vcpu *vcpu) +static int32_t vcpu_inject_vlapic_int(struct acrn_vcpu *vcpu) { struct acrn_vlapic *vlapic = vcpu_vlapic(vcpu); uint32_t vector = 0U; - int ret = 0; + int32_t ret = 0; /* * This function used for inject virtual interrupt @@ -148,7 +148,7 @@ static int vcpu_inject_vlapic_int(struct acrn_vcpu *vcpu) return 0; } -static int vcpu_do_pending_extint(const struct acrn_vcpu *vcpu) +static int32_t vcpu_do_pending_extint(const struct acrn_vcpu *vcpu) { struct acrn_vm *vm; struct acrn_vcpu *primary; @@ -176,7 +176,7 @@ static int vcpu_do_pending_extint(const struct acrn_vcpu *vcpu) } /* SDM Vol3 -6.15, Table 6-4 - interrupt and exception classes */ -static int get_excep_class(uint32_t vector) +static int32_t get_excep_class(uint32_t vector) { if ((vector == IDT_DE) || (vector == IDT_TS) || (vector == IDT_NP) || (vector == IDT_SS) || (vector == IDT_GP)) { @@ -188,7 +188,7 @@ static int get_excep_class(uint32_t vector) } } -int vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector, uint32_t err_code) +int32_t vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector, uint32_t err_code) { struct acrn_vcpu_arch *arch = &vcpu->arch; /* VECTOR_INVALID is also greater than 32 */ @@ -328,7 +328,7 @@ void vcpu_inject_ss(struct acrn_vcpu *vcpu) vcpu_make_request(vcpu, ACRN_REQUEST_EXCP); } -int interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu) { uint32_t value32; @@ -380,9 +380,9 @@ int32_t external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu) return ret; } -int acrn_handle_pending_request(struct acrn_vcpu *vcpu) +int32_t acrn_handle_pending_request(struct acrn_vcpu *vcpu) { - int ret = 0; + int32_t ret = 0; uint32_t tmp; uint32_t intr_info; uint32_t error_code; @@ -563,12 +563,12 @@ void cancel_event_injection(struct acrn_vcpu *vcpu) /* * @pre vcpu != NULL */ -int exception_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t exception_vmexit_handler(struct acrn_vcpu *vcpu) { uint32_t intinfo, int_err_code = 0U; uint32_t exception_vector = VECTOR_INVALID; uint32_t cpl; - int status = 0; + int32_t status = 0; pr_dbg(" Handling guest exception"); diff --git a/hypervisor/arch/x86/vmexit.c b/hypervisor/arch/x86/vmexit.c index ee7e279a2..fcbc5975e 100644 --- a/hypervisor/arch/x86/vmexit.c +++ b/hypervisor/arch/x86/vmexit.c @@ -12,9 +12,9 @@ */ #define NR_VMX_EXIT_REASONS 65U -static int unhandled_vmexit_handler(struct acrn_vcpu *vcpu); -static int xsetbv_vmexit_handler(struct acrn_vcpu *vcpu); -static int wbinvd_vmexit_handler(struct acrn_vcpu *vcpu); +static int32_t unhandled_vmexit_handler(struct acrn_vcpu *vcpu); +static int32_t xsetbv_vmexit_handler(struct acrn_vcpu *vcpu); +static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu); /* VM Dispatch table for Exit condition handling */ static const struct vm_exit_dispatch dispatch_table[NR_VMX_EXIT_REASONS] = { @@ -152,11 +152,11 @@ static const struct vm_exit_dispatch dispatch_table[NR_VMX_EXIT_REASONS] = { .handler = unhandled_vmexit_handler} }; -int vmexit_handler(struct acrn_vcpu *vcpu) +int32_t vmexit_handler(struct acrn_vcpu *vcpu) { struct vm_exit_dispatch *dispatch = NULL; uint16_t basic_exit_reason; - int ret; + int32_t ret; if (get_cpu_id() != vcpu->pcpu_id) { pr_fatal("vcpu is not running on its pcpu!"); @@ -228,7 +228,7 @@ int vmexit_handler(struct acrn_vcpu *vcpu) return ret; } -static int unhandled_vmexit_handler(struct acrn_vcpu *vcpu) +static int32_t unhandled_vmexit_handler(struct acrn_vcpu *vcpu) { pr_fatal("Error: Unhandled VM exit condition from guest at 0x%016llx ", exec_vmread(VMX_GUEST_RIP)); @@ -243,7 +243,7 @@ static int unhandled_vmexit_handler(struct acrn_vcpu *vcpu) return 0; } -int cpuid_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t cpuid_vmexit_handler(struct acrn_vcpu *vcpu) { uint64_t rax, rbx, rcx, rdx; @@ -263,7 +263,7 @@ int cpuid_vmexit_handler(struct acrn_vcpu *vcpu) return 0; } -int cr_access_vmexit_handler(struct acrn_vcpu *vcpu) +int32_t cr_access_vmexit_handler(struct acrn_vcpu *vcpu) { uint64_t reg; uint32_t idx; @@ -318,9 +318,9 @@ int cr_access_vmexit_handler(struct acrn_vcpu *vcpu) * XSETBV instruction set's the XCR0 that is used to tell for which * components states can be saved on a context switch using xsave. */ -static int xsetbv_vmexit_handler(struct acrn_vcpu *vcpu) +static int32_t xsetbv_vmexit_handler(struct acrn_vcpu *vcpu) { - int idx; + int32_t idx; uint64_t val64; val64 = exec_vmread(VMX_GUEST_CR4); @@ -362,7 +362,7 @@ static int xsetbv_vmexit_handler(struct acrn_vcpu *vcpu) return 0; } -static int wbinvd_vmexit_handler(struct acrn_vcpu *vcpu) +static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu) { if (!iommu_snoop_supported(vcpu->vm)) { cache_flush_invalidate_all(); diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c index 946930dc9..fc90dcdbf 100644 --- a/hypervisor/arch/x86/vmx.c +++ b/hypervisor/arch/x86/vmx.c @@ -267,7 +267,7 @@ uint64_t vmx_rdmsr_pat(const struct acrn_vcpu *vcpu) return vcpu_get_guest_msr(vcpu, MSR_IA32_PAT); } -int vmx_wrmsr_pat(struct acrn_vcpu *vcpu, uint64_t value) +int32_t vmx_wrmsr_pat(struct acrn_vcpu *vcpu, uint64_t value) { uint32_t i; uint64_t field; diff --git a/hypervisor/arch/x86/vmx_asm.S b/hypervisor/arch/x86/vmx_asm.S index c21f534e7..3bd085a16 100644 --- a/hypervisor/arch/x86/vmx_asm.S +++ b/hypervisor/arch/x86/vmx_asm.S @@ -30,7 +30,7 @@ .text -/*int vmx_vmrun(struct run_context *context, int launch, int ibrs_type) */ +/*int vmx_vmrun(struct run_context *context, int32_t launch, int32_t ibrs_type) */ .code64 .align 8 .global vmx_vmrun diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index d58fa6c36..8b82ce05e 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -168,14 +168,14 @@ static inline uint16_t vmid_to_domainid(uint16_t vm_id) return vm_id + 1U; } -static int dmar_register_hrhd(struct dmar_drhd_rt *dmar_unit); +static int32_t dmar_register_hrhd(struct dmar_drhd_rt *dmar_unit); static struct dmar_drhd_rt *device_to_dmaru(uint16_t segment, uint8_t bus, uint8_t devfun); -static int register_hrhd_units(void) +static int32_t register_hrhd_units(void) { struct dmar_info *info = get_dmar_info(); struct dmar_drhd_rt *drhd_rt; uint32_t i; - int ret = 0; + int32_t ret = 0; if (info == NULL || info->drhd_count == 0U) { pr_fatal("%s: can't find dmar info\n", __func__); @@ -392,7 +392,7 @@ static void dmar_disable_translation(struct dmar_drhd_rt *dmar_unit) spinlock_release(&(dmar_unit->lock)); } -static int dmar_register_hrhd(struct dmar_drhd_rt *dmar_unit) +static int32_t dmar_register_hrhd(struct dmar_drhd_rt *dmar_unit) { dev_dbg(ACRN_DBG_IOMMU, "Register dmar uint [%d] @0x%llx", dmar_unit->index, dmar_unit->drhd->reg_base_addr); @@ -707,7 +707,7 @@ static void dmar_fault_handler(uint32_t irq, void *data) uint32_t index; uint32_t record_reg_offset; uint64_t record[2]; - int loop = 0; + int32_t loop = 0; dev_dbg(ACRN_DBG_IOMMU, "%s: irq = %d", __func__, irq); @@ -824,7 +824,7 @@ static void dmar_resume(struct dmar_drhd_rt *dmar_unit) dmar_enable(dmar_unit); } -static int add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8_t bus, uint8_t devfun) +static int32_t add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8_t bus, uint8_t devfun) { struct dmar_drhd_rt *dmar_unit; struct dmar_root_entry *root_table; @@ -937,7 +937,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8 return 0; } -static int remove_iommu_device(const struct iommu_domain *domain, uint16_t segment, uint8_t bus, uint8_t devfun) +static int32_t remove_iommu_device(const struct iommu_domain *domain, uint16_t segment, uint8_t bus, uint8_t devfun) { struct dmar_drhd_rt *dmar_unit; struct dmar_root_entry *root_table; @@ -1045,9 +1045,9 @@ void destroy_iommu_domain(struct iommu_domain *domain) (void)memset(domain, 0U, sizeof(*domain)); } -int assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun) +int32_t assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun) { - int status = 0; + int32_t status = 0; /* TODO: check if the device assigned */ @@ -1061,9 +1061,9 @@ int assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun return add_iommu_device(domain, 0U, bus, devfun); } -int unassign_iommu_device(const struct iommu_domain *domain, uint8_t bus, uint8_t devfun) +int32_t unassign_iommu_device(const struct iommu_domain *domain, uint8_t bus, uint8_t devfun) { - int status = 0; + int32_t status = 0; /* TODO: check if the device assigned */ status = remove_iommu_device(domain, 0U, bus, devfun); @@ -1101,9 +1101,9 @@ void resume_iommu(void) do_action_for_iommus(dmar_resume); } -int init_iommu(void) +int32_t init_iommu(void) { - int ret; + int32_t ret; ret = register_hrhd_units(); if (ret != 0) { diff --git a/hypervisor/boot/acpi.c b/hypervisor/boot/acpi.c index ebec4905e..aeaa5be75 100644 --- a/hypervisor/boot/acpi.c +++ b/hypervisor/boot/acpi.c @@ -103,11 +103,11 @@ struct acpi_madt_local_apic { static void *global_rsdp; static struct acpi_table_rsdp* -biosacpi_search_rsdp(char *base, int length) +biosacpi_search_rsdp(char *base, int32_t length) { struct acpi_table_rsdp *rsdp; uint8_t *cp, sum; - int ofs, idx; + int32_t ofs, idx; /* search on 16-byte boundaries */ for (ofs = 0; ofs < length; ofs += 16) { diff --git a/hypervisor/boot/dmar_parse.c b/hypervisor/boot/dmar_parse.c index 022258fed..2f38c5d31 100644 --- a/hypervisor/boot/dmar_parse.c +++ b/hypervisor/boot/dmar_parse.c @@ -55,7 +55,7 @@ struct acpi_dmar_hardware_unit { }; struct find_iter_args { - int i; + int32_t i; struct acpi_dmar_hardware_unit *res; }; @@ -72,10 +72,10 @@ struct acpi_dmar_device_scope { uint8_t bus; }; -typedef int (*dmar_iter_t)(struct acpi_dmar_header*, void*); +typedef int32_t (*dmar_iter_t)(struct acpi_dmar_header*, void*); static struct dmar_info dmar_info_parsed; -static int dmar_unit_cnt; +static int32_t dmar_unit_cnt; static void dmar_iterate_tbl(dmar_iter_t iter, void *arg) @@ -105,7 +105,7 @@ dmar_iterate_tbl(dmar_iter_t iter, void *arg) } } -static int +static int32_t drhd_count_iter(struct acpi_dmar_header *dmar_header, __unused void *arg) { if (dmar_header->type == ACPI_DMAR_TYPE_HARDWARE_UNIT) @@ -113,7 +113,7 @@ drhd_count_iter(struct acpi_dmar_header *dmar_header, __unused void *arg) return 1; } -static int +static int32_t drhd_find_iter(struct acpi_dmar_header *dmar_header, void *arg) { struct find_iter_args *args; @@ -131,7 +131,7 @@ drhd_find_iter(struct acpi_dmar_header *dmar_header, void *arg) } static struct acpi_dmar_hardware_unit * -drhd_find_by_index(int idx) +drhd_find_by_index(int32_t idx) { struct find_iter_args args; @@ -154,10 +154,10 @@ static uint8_t get_secondary_bus(uint8_t bus, uint8_t dev, uint8_t func) } static uint16_t -dmar_path_bdf(int path_len, int busno, +dmar_path_bdf(int32_t path_len, int32_t busno, const struct acpi_dmar_pci_path *path) { - int i; + int32_t i; uint8_t bus; uint8_t dev; uint8_t fun; @@ -177,16 +177,16 @@ dmar_path_bdf(int path_len, int busno, } -static int +static int32_t handle_dmar_devscope(struct dmar_dev_scope *dev_scope, - void *addr, int remaining) + void *addr, int32_t remaining) { - int path_len; + int32_t path_len; uint16_t bdf; struct acpi_dmar_pci_path *path; struct acpi_dmar_device_scope *apci_devscope = addr; - if (remaining < (int)sizeof(struct acpi_dmar_device_scope)) + if (remaining < (int32_t)sizeof(struct acpi_dmar_device_scope)) return -1; if (remaining < apci_devscope->length) @@ -226,13 +226,13 @@ get_drhd_dev_scope_cnt(struct acpi_dmar_hardware_unit *drhd) return count; } -static int +static int32_t handle_one_drhd(struct acpi_dmar_hardware_unit *acpi_drhd, struct dmar_drhd *drhd) { struct dmar_dev_scope *dev_scope; struct acpi_dmar_device_scope *ads; - int remaining, consumed; + int32_t remaining, consumed; char *cp; uint32_t dev_count; @@ -291,9 +291,9 @@ handle_one_drhd(struct acpi_dmar_hardware_unit *acpi_drhd, return 0; } -int parse_dmar_table(void) +int32_t parse_dmar_table(void) { - int i; + int32_t i; struct acpi_dmar_hardware_unit *acpi_drhd; /* find out how many dmar units */ diff --git a/hypervisor/boot/sbl/multiboot.c b/hypervisor/boot/sbl/multiboot.c index 89a86c793..f97084ac5 100644 --- a/hypervisor/boot/sbl/multiboot.c +++ b/hypervisor/boot/sbl/multiboot.c @@ -17,7 +17,7 @@ #define MAX_BOOT_PARAMS_LEN 64U #ifdef CONFIG_PARTITION_MODE -int init_vm_boot_info(struct acrn_vm *vm) +int32_t init_vm_boot_info(struct acrn_vm *vm) { struct multiboot_module *mods = NULL; struct multiboot_info *mbi = NULL; @@ -104,7 +104,7 @@ static void parse_other_modules(struct acrn_vm *vm, void *load_addr = gpa2hva(vm, (uint64_t)vm->sw.linux_info.bootargs_load_addr); uint32_t args_size = vm->sw.linux_info.bootargs_size; - static int copy_once = 1; + static int32_t copy_once = 1; start = end + 1; /*it is fw name for boot args */ snprintf(dyn_bootargs, 100U, " %s=0x%x@0x%x ", @@ -164,7 +164,7 @@ static void *get_kernel_load_addr(void *kernel_src_addr) * @pre vm != NULL * @pre is_vm0(vm) == true */ -int init_vm_boot_info(struct acrn_vm *vm) +int32_t init_vm_boot_info(struct acrn_vm *vm) { struct multiboot_module *mods = NULL; struct multiboot_info *mbi = NULL; diff --git a/hypervisor/bsp/uefi/cmdline.c b/hypervisor/bsp/uefi/cmdline.c index 01d2b35fe..68dd3dfdc 100644 --- a/hypervisor/bsp/uefi/cmdline.c +++ b/hypervisor/bsp/uefi/cmdline.c @@ -28,12 +28,12 @@ enum IDX_CMD { IDX_MAX_CMD, }; -static void handle_cmd(const char *cmd, int len) +static void handle_cmd(const char *cmd, int32_t len) { - int i; + int32_t i; for (i = 0; i < IDX_MAX_CMD; i++) { - int tmp = strnlen_s(cmd_list[i], MAX_CMD_LEN); + int32_t tmp = strnlen_s(cmd_list[i], MAX_CMD_LEN); /*cmd prefix should be same with one in cmd_list */ if (len < tmp) @@ -62,7 +62,7 @@ static void handle_cmd(const char *cmd, int len) } } -int parse_hv_cmdline(void) +int32_t parse_hv_cmdline(void) { const char *start; const char *end; diff --git a/hypervisor/bsp/uefi/efi/boot.c b/hypervisor/bsp/uefi/efi/boot.c index b922e9452..8604385ca 100644 --- a/hypervisor/bsp/uefi/efi/boot.c +++ b/hypervisor/bsp/uefi/efi/boot.c @@ -77,7 +77,7 @@ EFI_STATUS construct_mbi(EFI_PHYSICAL_ADDRESS hv_hpa) struct multiboot_info *mbi; struct multiboot_mmap *mmap; struct efi_context *efi_ctx; - int i, j; + int32_t i, j; mbi = MBOOT_INFO_PTR(hv_hpa); mmap = MBOOT_MMAP_PTR(hv_hpa); @@ -202,7 +202,7 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa) struct multiboot_info *mbi; struct efi_context *efi_ctx; struct acpi_table_rsdp *rsdp = NULL; - int i; + int32_t i; EFI_CONFIGURATION_TABLE *config_table; mbi = MBOOT_INFO_PTR(hv_hpa); diff --git a/hypervisor/bsp/uefi/efi/boot.h b/hypervisor/bsp/uefi/efi/boot.h index 94107129a..d1c5f29dd 100644 --- a/hypervisor/bsp/uefi/efi/boot.h +++ b/hypervisor/bsp/uefi/efi/boot.h @@ -67,7 +67,7 @@ } EFI_STATUS get_pe_section(CHAR8 *base, char *section, UINTN *vaddr, UINTN *size); -typedef void(*hv_func)(int, struct multiboot_info*); +typedef void(*hv_func)(int32_t, struct multiboot_info*); /* * We allocate memory for the following struct together with hyperivosr itself diff --git a/hypervisor/bsp/uefi/efi/stdlib.h b/hypervisor/bsp/uefi/efi/stdlib.h index 7106acf18..fa1d8e748 100644 --- a/hypervisor/bsp/uefi/efi/stdlib.h +++ b/hypervisor/bsp/uefi/efi/stdlib.h @@ -48,7 +48,7 @@ static inline void memset(void *dstv, char ch, UINTN size) { char *dst = dstv; - int i; + int32_t i; for (i = 0; i < size; i++) dst[i] = ch; @@ -56,15 +56,15 @@ static inline void memset(void *dstv, char ch, UINTN size) static inline void memcpy(char *dst, const char *src, UINTN size) { - int i; + int32_t i; for (i = 0; i < size; i++) *dst++ = *src++; } -static inline int strlen(const char *str) +static inline int32_t strlen(const char *str) { - int len; + int32_t len; len = 0; while (*str++) diff --git a/hypervisor/bsp/uefi/uefi.c b/hypervisor/bsp/uefi/uefi.c index f753d09fd..2c3217e83 100644 --- a/hypervisor/bsp/uefi/uefi.c +++ b/hypervisor/bsp/uefi/uefi.c @@ -14,9 +14,9 @@ static void efi_init(void); struct efi_context* efi_ctx = NULL; struct lapic_regs uefi_lapic_regs; -static int efi_initialized; +static int32_t efi_initialized; -void efi_spurious_handler(int vector) +void efi_spurious_handler(int32_t vector) { struct acrn_vcpu* vcpu; @@ -33,9 +33,9 @@ void efi_spurious_handler(int vector) return; } -int uefi_sw_loader(struct acrn_vm *vm) +int32_t uefi_sw_loader(struct acrn_vm *vm) { - int ret = 0; + int32_t ret = 0; struct acrn_vcpu *vcpu = get_primary_vcpu(vm); struct acrn_vcpu_regs *vcpu_regs = &boot_context; diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 67fa8cda4..746466649 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -613,7 +613,7 @@ int32_t hcall_set_vm_memory_regions(struct acrn_vm *vm, uint64_t param) idx = 0U; while (idx < regions.mr_num) { - int ret; + int32_t ret; if (copy_from_gpa(vm, &mr, regions.regions_gpa + idx * sizeof(mr), sizeof(mr)) != 0) { pr_err("%s: Copy mr entry fail from vm\n", __func__); diff --git a/hypervisor/common/schedule.c b/hypervisor/common/schedule.c index d00fb759a..bf17edfb8 100644 --- a/hypervisor/common/schedule.c +++ b/hypervisor/common/schedule.c @@ -106,7 +106,7 @@ void make_reschedule_request(const struct acrn_vcpu *vcpu) } } -int need_reschedule(uint16_t pcpu_id) +int32_t need_reschedule(uint16_t pcpu_id) { struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id); @@ -160,7 +160,7 @@ void make_pcpu_offline(uint16_t pcpu_id) } } -int need_offline(uint16_t pcpu_id) +int32_t need_offline(uint16_t pcpu_id) { struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id); diff --git a/hypervisor/common/static_checks.c b/hypervisor/common/static_checks.c index c194d0088..730c3eb39 100644 --- a/hypervisor/common/static_checks.c +++ b/hypervisor/common/static_checks.c @@ -8,6 +8,6 @@ #define CAT__(A,B) A ## B #define CAT_(A,B) CAT__(A,B) #define CTASSERT(expr) \ -typedef int CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1] +typedef int32_t CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1] CTASSERT(sizeof(struct vhm_request) == (4096U/VHM_REQUEST_MAX)); diff --git a/hypervisor/common/vm_load.c b/hypervisor/common/vm_load.c index f7d812552..88dbff997 100644 --- a/hypervisor/common/vm_load.c +++ b/hypervisor/common/vm_load.c @@ -73,7 +73,7 @@ static uint64_t create_zero_page(struct acrn_vm *vm) return gpa; } -int general_sw_loader(struct acrn_vm *vm) +int32_t general_sw_loader(struct acrn_vm *vm) { int32_t ret = 0; void *hva; diff --git a/hypervisor/debug/dump.c b/hypervisor/debug/dump.c index 75ca914aa..38dd40a20 100644 --- a/hypervisor/debug/dump.c +++ b/hypervisor/debug/dump.c @@ -133,7 +133,7 @@ static void show_guest_call_trace(struct acrn_vcpu *vcpu) { uint64_t bp; uint64_t count = 0UL; - int err; + int32_t err; uint32_t err_code; bp = vcpu_get_gpreg(vcpu, CPU_REG_RBP); diff --git a/hypervisor/debug/npk_log.c b/hypervisor/debug/npk_log.c index 1cb82efde..3a05b1f26 100644 --- a/hypervisor/debug/npk_log.c +++ b/hypervisor/debug/npk_log.c @@ -42,9 +42,9 @@ struct npk_chan { uint32_t unused; } __packed; -static inline int npk_write(const char *value, void *addr, size_t sz) +static inline int32_t npk_write(const char *value, void *addr, size_t sz) { - int ret = -1; + int32_t ret = -1; if (sz >= 8U) { mmio_write64(*(uint64_t *)value, addr); @@ -123,7 +123,7 @@ void npk_log_write(const char *buf, size_t buf_len) uint32_t cpu_id = get_cpu_id(); struct npk_chan *channel = (struct npk_chan *)base; const char *p = buf; - int sz; + int32_t sz; uint32_t ref; uint16_t len; diff --git a/hypervisor/debug/profiling.c b/hypervisor/debug/profiling.c index d81cab635..9c1490417 100644 --- a/hypervisor/debug/profiling.c +++ b/hypervisor/debug/profiling.c @@ -215,7 +215,7 @@ static void profiling_disable_pmu(void) /* * Writes specified size of data into sbuf */ -static int profiling_sbuf_put_variable(struct shared_buf *sbuf, +static int32_t profiling_sbuf_put_variable(struct shared_buf *sbuf, uint8_t *data, uint32_t size) { uint32_t remaining_space, offset, next_tail; @@ -287,18 +287,18 @@ static int profiling_sbuf_put_variable(struct shared_buf *sbuf, sbuf->tail = next_tail; - return (int)size; + return (int32_t)size; } /* * Read profiling data and transferred to SOS * Drop transfer of profiling data if sbuf is full/insufficient and log it */ -static int profiling_generate_data(int32_t collector, uint32_t type) +static int32_t profiling_generate_data(int32_t collector, uint32_t type) { uint64_t i; uint32_t remaining_space = 0U; - int ret = 0; + int32_t ret = 0; struct data_header pkt_header; uint64_t payload_size = 0UL; void *payload = NULL; diff --git a/hypervisor/debug/sbuf.c b/hypervisor/debug/sbuf.c index 0182f6a69..33b1e7eec 100644 --- a/hypervisor/debug/sbuf.c +++ b/hypervisor/debug/sbuf.c @@ -92,7 +92,7 @@ uint32_t sbuf_put(struct shared_buf *sbuf, uint8_t *data) return sbuf->ele_size; } -int sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva) +int32_t sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva) { if ((pcpu_id >= phys_cpu_num) || (sbuf_id >= ACRN_SBUF_ID_MAX)) { diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index 5bca53c89..5270eb724 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -19,19 +19,19 @@ static char shell_log_buf[SHELL_LOG_BUF_SIZE]; */ #define SHELL_INPUT_LINE_OTHER(v) (((v) + 1U) & 0x1U) -static int shell_cmd_help(__unused int argc, __unused char **argv); -static int shell_list_vm(__unused int argc, __unused char **argv); -static int shell_list_vcpu(__unused int argc, __unused char **argv); -static int shell_vcpu_dumpreg(int argc, char **argv); -static int shell_dumpmem(int argc, char **argv); -static int shell_to_sos_console(int argc, char **argv); -static int shell_show_cpu_int(__unused int argc, __unused char **argv); -static int shell_show_ptdev_info(__unused int argc, __unused char **argv); -static int shell_show_vioapic_info(int argc, char **argv); -static int shell_show_ioapic_info(__unused int argc, __unused char **argv); -static int shell_loglevel(int argc, char **argv); -static int shell_cpuid(int argc, char **argv); -static int shell_trigger_crash(int argc, char **argv); +static int32_t shell_cmd_help(__unused int32_t argc, __unused char **argv); +static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv); +static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv); +static int32_t shell_vcpu_dumpreg(int32_t argc, char **argv); +static int32_t shell_dumpmem(int32_t argc, char **argv); +static int32_t shell_to_sos_console(int32_t argc, char **argv); +static int32_t shell_show_cpu_int(__unused int32_t argc, __unused char **argv); +static int32_t shell_show_ptdev_info(__unused int32_t argc, __unused char **argv); +static int32_t shell_show_vioapic_info(int32_t argc, char **argv); +static int32_t shell_show_ioapic_info(__unused int32_t argc, __unused char **argv); +static int32_t shell_loglevel(int32_t argc, char **argv); +static int32_t shell_cpuid(int32_t argc, char **argv); +static int32_t shell_trigger_crash(int32_t argc, char **argv); static struct shell_cmd shell_cmds[] = { { @@ -122,7 +122,7 @@ uint16_t npk_loglevel = CONFIG_NPK_LOGLEVEL_DEFAULT; static struct shell hv_shell; static struct shell *p_shell = &hv_shell; -static int string_to_argv(char *argv_str, void *p_argv_mem, +static int32_t string_to_argv(char *argv_str, void *p_argv_mem, __unused uint32_t argv_mem_size, uint32_t *p_argc, char ***p_argv) { @@ -316,13 +316,13 @@ static bool shell_input_line(void) return done; } -static int shell_process_cmd(const char *p_input_line) +static int32_t shell_process_cmd(const char *p_input_line) { - int status = -EINVAL; + int32_t status = -EINVAL; struct shell_cmd *p_cmd; char cmd_argv_str[SHELL_CMD_MAX_LEN + 1U]; - int cmd_argv_mem[sizeof(char *) * ((SHELL_CMD_MAX_LEN + 1U) >> 1U)]; - int cmd_argc; + int32_t cmd_argv_mem[sizeof(char *) * ((SHELL_CMD_MAX_LEN + 1U) >> 1U)]; + int32_t cmd_argc; char **cmd_argv; /* Copy the input line INTo an argument string to become part of the @@ -361,9 +361,9 @@ static int shell_process_cmd(const char *p_input_line) return status; } -static int shell_process(void) +static int32_t shell_process(void) { - int status; + int32_t status; char *p_input_line; /* Check for the repeat command character in active input line. @@ -435,7 +435,7 @@ void shell_init(void) #define SHELL_ROWS 10 #define MAX_INDENT_LEN 16U -static int shell_cmd_help(__unused int argc, __unused char **argv) +static int32_t shell_cmd_help(__unused int32_t argc, __unused char **argv) { uint16_t spaces; struct shell_cmd *p_cmd = NULL; @@ -508,7 +508,7 @@ static int shell_cmd_help(__unused int argc, __unused char **argv) return 0; } -static int shell_list_vm(__unused int argc, __unused char **argv) +static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv) { char temp_str[MAX_STR_SIZE]; struct acrn_vm *vm; @@ -550,7 +550,7 @@ static int shell_list_vm(__unused int argc, __unused char **argv) return 0; } -static int shell_list_vcpu(__unused int argc, __unused char **argv) +static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv) { char temp_str[MAX_STR_SIZE]; struct acrn_vm *vm; @@ -607,7 +607,7 @@ static int shell_list_vcpu(__unused int argc, __unused char **argv) /* the input 'data' must != NULL and indicate a vcpu structure pointer */ static void vcpu_dumpreg(void *data) { - int status; + int32_t status; uint64_t i, fault_addr, tmp[DUMPREG_SP_SIZE]; uint32_t err_code = 0; struct vcpu_dump *dump = data; @@ -689,9 +689,9 @@ overflow: printf("buffer size could not be enough! please check!\n"); } -static int shell_vcpu_dumpreg(int argc, char **argv) +static int32_t shell_vcpu_dumpreg(int32_t argc, char **argv) { - int status = 0; + int32_t status = 0; uint16_t vm_id; uint16_t vcpu_id; struct acrn_vm *vm; @@ -744,7 +744,7 @@ out: } #define MAX_MEMDUMP_LEN (32U * 8U) -static int shell_dumpmem(int argc, char **argv) +static int32_t shell_dumpmem(int32_t argc, char **argv) { uint64_t addr; uint64_t *ptr; @@ -788,7 +788,7 @@ static int shell_dumpmem(int argc, char **argv) return 0; } -static int shell_to_sos_console(__unused int argc, __unused char **argv) +static int32_t shell_to_sos_console(__unused int32_t argc, __unused char **argv) { char temp_str[TEMP_STR_SIZE]; uint16_t guest_no = 0U; @@ -894,7 +894,7 @@ overflow: printf("buffer size could not be enough! please check!\n"); } -static int shell_show_cpu_int(__unused int argc, __unused char **argv) +static int32_t shell_show_cpu_int(__unused int32_t argc, __unused char **argv) { get_cpu_interrupt_info(shell_log_buf, SHELL_LOG_BUF_SIZE); shell_puts(shell_log_buf); @@ -1010,7 +1010,7 @@ overflow: printf("buffer size could not be enough! please check!\n"); } -static int shell_show_ptdev_info(__unused int argc, __unused char **argv) +static int32_t shell_show_ptdev_info(__unused int32_t argc, __unused char **argv) { get_ptdev_info(shell_log_buf, SHELL_LOG_BUF_SIZE); shell_puts(shell_log_buf); @@ -1074,7 +1074,7 @@ overflow: printf("buffer size could not be enough! please check!\n"); } -static int shell_show_vioapic_info(int argc, char **argv) +static int32_t shell_show_vioapic_info(int32_t argc, char **argv) { uint16_t vmid; int32_t ret; @@ -1115,7 +1115,7 @@ static void get_rte_info(union ioapic_rte rte, bool *mask, bool *irr, * interrupt info * @param[inout] str_arg Pointer to the output information */ -static int get_ioapic_info(char *str_arg, size_t str_max_len) +static int32_t get_ioapic_info(char *str_arg, size_t str_max_len) { char *str = str_arg; uint32_t irq; @@ -1164,9 +1164,9 @@ overflow: return 0; } -static int shell_show_ioapic_info(__unused int argc, __unused char **argv) +static int32_t shell_show_ioapic_info(__unused int32_t argc, __unused char **argv) { - int err = 0; + int32_t err = 0; err = get_ioapic_info(shell_log_buf, SHELL_LOG_BUF_SIZE); shell_puts(shell_log_buf); @@ -1174,7 +1174,7 @@ static int shell_show_ioapic_info(__unused int argc, __unused char **argv) return err; } -static int shell_loglevel(int argc, char **argv) +static int32_t shell_loglevel(int32_t argc, char **argv) { char str[MAX_STR_SIZE] = {0}; @@ -1201,7 +1201,7 @@ static int shell_loglevel(int argc, char **argv) return 0; } -static int shell_cpuid(int argc, char **argv) +static int32_t shell_cpuid(int32_t argc, char **argv) { char str[MAX_STR_SIZE] = {0}; uint32_t leaf, subleaf = 0; @@ -1228,7 +1228,7 @@ static int shell_cpuid(int argc, char **argv) return 0; } -static int shell_trigger_crash(int argc, char **argv) +static int32_t shell_trigger_crash(int32_t argc, char **argv) { char str[MAX_STR_SIZE] = {0}; diff --git a/hypervisor/debug/shell_priv.h b/hypervisor/debug/shell_priv.h index 35bede3bb..17d46ebf6 100644 --- a/hypervisor/debug/shell_priv.h +++ b/hypervisor/debug/shell_priv.h @@ -13,7 +13,7 @@ #define SHELL_STRING_MAX_LEN (PAGE_SIZE << 2U) /* Shell Command Function */ -typedef int (*shell_cmd_fn_t)(int argc, char **argv); +typedef int32_t (*shell_cmd_fn_t)(int32_t argc, char **argv); /* Shell Command */ struct shell_cmd { diff --git a/hypervisor/dm/vioapic.c b/hypervisor/dm/vioapic.c index 7f10e9964..242eea0cf 100644 --- a/hypervisor/dm/vioapic.c +++ b/hypervisor/dm/vioapic.c @@ -536,13 +536,13 @@ vioapic_pincount(const struct acrn_vm *vm) return ret; } -int vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data) +int32_t vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data) { struct acrn_vm *vm = (struct acrn_vm *)handler_private_data; struct acrn_vioapic *vioapic; struct mmio_request *mmio = &io_req->reqs.mmio; uint64_t gpa = mmio->address; - int ret = 0; + int32_t ret = 0; vioapic = vm_ioapic(vm); diff --git a/hypervisor/dm/vpci/hostbridge.c b/hypervisor/dm/vpci/hostbridge.c index e0f7f3eb9..fc9b90145 100644 --- a/hypervisor/dm/vpci/hostbridge.c +++ b/hypervisor/dm/vpci/hostbridge.c @@ -37,7 +37,7 @@ #include #include "pci_priv.h" -static int vdev_hostbridge_init(struct pci_vdev *vdev) +static int32_t vdev_hostbridge_init(struct pci_vdev *vdev) { /* PCI config space */ pci_vdev_write_cfg_u16(vdev, PCIR_VENDOR, (uint16_t)0x8086U); @@ -84,12 +84,12 @@ static int vdev_hostbridge_init(struct pci_vdev *vdev) return 0; } -static int vdev_hostbridge_deinit(__unused struct pci_vdev *vdev) +static int32_t vdev_hostbridge_deinit(__unused struct pci_vdev *vdev) { return 0; } -static int vdev_hostbridge_cfgread(struct pci_vdev *vdev, uint32_t offset, +static int32_t vdev_hostbridge_cfgread(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val) { /* Assumption: access needed to be aligned on 1/2/4 bytes */ @@ -103,7 +103,7 @@ static int vdev_hostbridge_cfgread(struct pci_vdev *vdev, uint32_t offset, return 0; } -static int vdev_hostbridge_cfgwrite(struct pci_vdev *vdev, uint32_t offset, +static int32_t vdev_hostbridge_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) { /* Assumption: access needed to be aligned on 1/2/4 bytes */ diff --git a/hypervisor/dm/vpci/msix.c b/hypervisor/dm/vpci/msix.c index eb58bc19d..e2a0ac4f8 100644 --- a/hypervisor/dm/vpci/msix.c +++ b/hypervisor/dm/vpci/msix.c @@ -48,12 +48,12 @@ static inline bool msixtable_access(struct pci_vdev *vdev, uint32_t offset) return in_range(offset, vdev->msix.table_offset, vdev->msix.table_count * MSIX_TABLE_ENTRY_SIZE); } -static int vmsix_remap_entry(struct pci_vdev *vdev, uint32_t index, bool enable) +static int32_t vmsix_remap_entry(struct pci_vdev *vdev, uint32_t index, bool enable) { struct msix_table_entry *pentry; struct ptirq_msi_info info; uint64_t hva; - int ret; + int32_t ret; info.is_msix = 1; info.vmsi_addr = vdev->msix.tables[index].addr; @@ -94,10 +94,10 @@ static inline void enable_disable_msix(struct pci_vdev *vdev, bool enable) } /* Do MSI-X remap for all MSI-X table entries in the target device */ -static int vmsix_remap(struct pci_vdev *vdev, bool enable) +static int32_t vmsix_remap(struct pci_vdev *vdev, bool enable) { uint32_t index; - int ret; + int32_t ret; /* disable MSI-X during configuration */ enable_disable_msix(vdev, false); @@ -119,10 +119,10 @@ static int vmsix_remap(struct pci_vdev *vdev, bool enable) } /* Do MSI-X remap for one MSI-X table entry only */ -static int vmsix_remap_one_entry(struct pci_vdev *vdev, uint32_t index, bool enable) +static int32_t vmsix_remap_one_entry(struct pci_vdev *vdev, uint32_t index, bool enable) { uint32_t msgctrl; - int ret; + int32_t ret; /* disable MSI-X during configuration */ enable_disable_msix(vdev, false); @@ -144,7 +144,7 @@ static int vmsix_remap_one_entry(struct pci_vdev *vdev, uint32_t index, bool ena return ret; } -static int vmsix_cfgread(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val) +static int32_t vmsix_cfgread(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val) { int32_t ret; /* For PIO access, we emulate Capability Structures only */ @@ -159,7 +159,7 @@ static int vmsix_cfgread(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, return ret; } -static int vmsix_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) +static int32_t vmsix_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) { uint32_t msgctrl; int32_t ret; @@ -257,7 +257,7 @@ static void vmsix_table_rw(struct pci_vdev *vdev, struct mmio_request *mmio, uin } } -static int vmsix_table_mmio_access_handler(struct io_request *io_req, void *handler_private_data) +static int32_t vmsix_table_mmio_access_handler(struct io_request *io_req, void *handler_private_data) { struct mmio_request *mmio = &io_req->reqs.mmio; struct pci_vdev *vdev; @@ -344,7 +344,7 @@ static void decode_msix_table_bar(struct pci_vdev *vdev) } } -static int vmsix_init(struct pci_vdev *vdev) +static int32_t vmsix_init(struct pci_vdev *vdev) { uint32_t msgctrl; uint32_t table_info, i; @@ -407,7 +407,7 @@ static int vmsix_init(struct pci_vdev *vdev) return ret; } -static int vmsix_deinit(struct pci_vdev *vdev) +static int32_t vmsix_deinit(struct pci_vdev *vdev) { vdev->msix.intercepted_size = 0U; diff --git a/hypervisor/dm/vpci/partition_mode.c b/hypervisor/dm/vpci/partition_mode.c index c4e72ab41..be2392065 100644 --- a/hypervisor/dm/vpci/partition_mode.c +++ b/hypervisor/dm/vpci/partition_mode.c @@ -36,7 +36,7 @@ static struct pci_vdev *partition_mode_find_vdev(struct vpci *vpci, union pci_bd { struct vpci_vdev_array *vdev_array; struct pci_vdev *vdev; - int i; + int32_t i; vdev_array = vpci->vm->vm_desc->vpci_vdev_array; for (i = 0; i < vdev_array->num_pci_vdev; i++) { @@ -49,12 +49,12 @@ static struct pci_vdev *partition_mode_find_vdev(struct vpci *vpci, union pci_bd return NULL; } -static int partition_mode_vpci_init(struct acrn_vm *vm) +static int32_t partition_mode_vpci_init(struct acrn_vm *vm) { struct vpci_vdev_array *vdev_array; struct vpci *vpci = &vm->vpci; struct pci_vdev *vdev; - int i; + int32_t i; vdev_array = vm->vm_desc->vpci_vdev_array; @@ -77,7 +77,7 @@ static void partition_mode_vpci_deinit(struct acrn_vm *vm) { struct vpci_vdev_array *vdev_array; struct pci_vdev *vdev; - int i; + int32_t i; vdev_array = vm->vm_desc->vpci_vdev_array; diff --git a/hypervisor/dm/vpci/pci_pt.c b/hypervisor/dm/vpci/pci_pt.c index 36f2ee00f..e66e1e341 100644 --- a/hypervisor/dm/vpci/pci_pt.c +++ b/hypervisor/dm/vpci/pci_pt.c @@ -37,7 +37,7 @@ static inline uint32_t pci_bar_base(uint32_t bar) return bar & PCIM_BAR_MEM_BASE; } -static int vdev_pt_init_validate(struct pci_vdev *vdev) +static int32_t vdev_pt_init_validate(struct pci_vdev *vdev) { uint32_t idx; @@ -53,9 +53,9 @@ static int vdev_pt_init_validate(struct pci_vdev *vdev) return 0; } -static int vdev_pt_init(struct pci_vdev *vdev) +static int32_t vdev_pt_init(struct pci_vdev *vdev) { - int ret; + int32_t ret; struct acrn_vm *vm = vdev->vpci->vm; uint16_t pci_command; @@ -86,9 +86,9 @@ static int vdev_pt_init(struct pci_vdev *vdev) return ret; } -static int vdev_pt_deinit(struct pci_vdev *vdev) +static int32_t vdev_pt_deinit(struct pci_vdev *vdev) { - int ret; + int32_t ret; struct acrn_vm *vm = vdev->vpci->vm; ret = unassign_iommu_device(vm->iommu, (uint8_t)vdev->pdev.bdf.bits.b, @@ -97,7 +97,7 @@ static int vdev_pt_deinit(struct pci_vdev *vdev) return ret; } -static int vdev_pt_cfgread(struct pci_vdev *vdev, uint32_t offset, +static int32_t vdev_pt_cfgread(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val) { /* Assumption: access needed to be aligned on 1/2/4 bytes */ @@ -176,7 +176,7 @@ static void vdev_pt_cfgwrite_bar(struct pci_vdev *vdev, uint32_t offset, pci_vdev_write_cfg_u32(vdev, offset, new_bar); } -static int vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset, +static int32_t vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) { /* Assumption: access needed to be aligned on 1/2/4 bytes */ diff --git a/hypervisor/dm/vpic.c b/hypervisor/dm/vpic.c index 039a510e9..a437f6a47 100644 --- a/hypervisor/dm/vpic.c +++ b/hypervisor/dm/vpic.c @@ -241,7 +241,7 @@ static int32_t vpic_icw1(const struct acrn_vpic *vpic, struct i8259_reg_state *i return ret; } -static int vpic_icw2(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) +static int32_t vpic_icw2(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) { dev_dbg(ACRN_DBG_PIC, "vm 0x%x: i8259 icw2 0x%x\n", vpic->vm, val); @@ -253,7 +253,7 @@ static int vpic_icw2(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259 return 0; } -static int vpic_icw3(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) +static int32_t vpic_icw3(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) { dev_dbg(ACRN_DBG_PIC, "vm 0x%x: i8259 icw3 0x%x\n", vpic->vm, val); @@ -297,7 +297,7 @@ static int32_t vpic_icw4(const struct acrn_vpic *vpic, struct i8259_reg_state *i return ret; } -static int vpic_ocw1(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) +static int32_t vpic_ocw1(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) { uint8_t pin, i, bit; uint8_t old = i8259->mask; @@ -337,7 +337,7 @@ static int vpic_ocw1(const struct acrn_vpic *vpic, struct i8259_reg_state *i8259 return 0; } -static int vpic_ocw2(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) +static int32_t vpic_ocw2(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) { dev_dbg(ACRN_DBG_PIC, "vm 0x%x: i8259 ocw2 0x%x\n", vpic->vm, val); @@ -379,7 +379,7 @@ static int vpic_ocw2(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint return 0; } -static int vpic_ocw3(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) +static int32_t vpic_ocw3(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint8_t val) { dev_dbg(ACRN_DBG_PIC, "vm 0x%x: i8259 ocw3 0x%x\n", vpic->vm, val); @@ -616,7 +616,7 @@ void vpic_intr_accepted(struct acrn_vm *vm, uint32_t vector) spinlock_release(&(vpic->lock)); } -static int vpic_read(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, +static int32_t vpic_read(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint16_t port, uint32_t *eax) { uint8_t pin; @@ -652,10 +652,10 @@ static int vpic_read(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, return 0; } -static int vpic_write(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, +static int32_t vpic_write(struct acrn_vpic *vpic, struct i8259_reg_state *i8259, uint16_t port, uint32_t *eax) { - int error; + int32_t error; uint8_t val; error = 0; diff --git a/hypervisor/dm/vrtc.c b/hypervisor/dm/vrtc.c index 195835e23..862364d01 100644 --- a/hypervisor/dm/vrtc.c +++ b/hypervisor/dm/vrtc.c @@ -28,7 +28,7 @@ static bool cmos_update_in_progress(void) static uint8_t cmos_get_reg_val(uint8_t addr) { uint8_t reg; - int tries = 2000U; + int32_t tries = 2000U; spinlock_obtain(&cmos_lock); diff --git a/hypervisor/include/arch/x86/assign.h b/hypervisor/include/arch/x86/assign.h index 3ddb37013..ec15531d4 100644 --- a/hypervisor/include/arch/x86/assign.h +++ b/hypervisor/include/arch/x86/assign.h @@ -59,7 +59,7 @@ void ptirq_intx_ack(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source * @pre info != NULL * */ -int ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_nr, struct ptirq_msi_info *info); +int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_nr, struct ptirq_msi_info *info); /** @@ -81,7 +81,7 @@ int ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_nr, s * @pre vm != NULL * */ -int ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source vpin_src); +int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source vpin_src); /** * @brief Add an interrupt remapping entry for INTx as pre-hold mapping. @@ -103,7 +103,7 @@ int ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_s * @pre vm != NULL * */ -int ptirq_add_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, uint8_t phys_pin, bool pic_pin); +int32_t ptirq_add_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, uint8_t phys_pin, bool pic_pin); /** * @brief Remove an interrupt remapping entry for INTx. @@ -140,7 +140,7 @@ void ptirq_remove_intx_remapping(struct acrn_vm *vm, uint8_t virt_pin, bool pic_ * @pre vm != NULL * */ -int ptirq_add_msix_remapping(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t phys_bdf, uint32_t vector_count); +int32_t ptirq_add_msix_remapping(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t phys_bdf, uint32_t vector_count); /** * @brief Remove interrupt remapping entry/entries for MSI/MSI-x. diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 179764e34..dec9c72c3 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -211,7 +211,7 @@ extern uint8_t ld_bss_end; /* In trampoline range, hold the jump target which trampline will jump to */ extern uint64_t main_entry[1]; -extern int ibrs_type; +extern int32_t ibrs_type; extern spinlock_t trampoline_spinlock; /* @@ -526,7 +526,7 @@ msr_write(uint32_t reg_num, uint64_t value64) } static inline void -write_xcr(int reg, uint64_t val) +write_xcr(int32_t reg, uint64_t val) { uint32_t low, high; diff --git a/hypervisor/include/arch/x86/cpuid.h b/hypervisor/include/arch/x86/cpuid.h index 7bd70749f..5034ca0df 100644 --- a/hypervisor/include/arch/x86/cpuid.h +++ b/hypervisor/include/arch/x86/cpuid.h @@ -135,7 +135,7 @@ static inline void cpuid_subleaf(uint32_t leaf, uint32_t subleaf, asm_cpuid(eax, ebx, ecx, edx); } -int set_vcpuid_entries(struct acrn_vm *vm); +int32_t set_vcpuid_entries(struct acrn_vm *vm); void guest_cpuid(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); diff --git a/hypervisor/include/arch/x86/guest/guest.h b/hypervisor/include/arch/x86/guest/guest.h index 4da6ff210..0f9ad8714 100644 --- a/hypervisor/include/arch/x86/guest/guest.h +++ b/hypervisor/include/arch/x86/guest/guest.h @@ -70,7 +70,8 @@ #define LDTR_AR (0x0082U) /* LDT, type must be 2, refer to SDM Vol3 26.3.1.2 */ #define TR_AR (0x008bU) /* TSS (busy), refer to SDM Vol3 26.3.1.2 */ -int prepare_vm0_memmap(struct acrn_vm *vm); +int32_t prepare_vm0_memmap(struct acrn_vm *vm); + /* Definition for a mem map lookup */ struct vm_lu_mem_map { struct list_head list; /* EPT mem map lookup list*/ @@ -93,22 +94,22 @@ enum vm_paging_mode { */ uint64_t vcpumask2pcpumask(struct acrn_vm *vm, uint64_t vdmask); -int gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code); +int32_t gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code); enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu); -int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu); -int wrmsr_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t rdmsr_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t wrmsr_vmexit_handler(struct acrn_vcpu *vcpu); void init_msr_emulation(struct acrn_vcpu *vcpu); uint32_t vmsr_get_guest_msr_index(uint32_t msr); struct run_context; -int vmx_vmrun(struct run_context *context, int ops, int ibrs); +int32_t vmx_vmrun(struct run_context *context, int32_t ops, int32_t ibrs); -int general_sw_loader(struct acrn_vm *vm); +int32_t general_sw_loader(struct acrn_vm *vm); -typedef int (*vm_sw_loader_t)(struct acrn_vm *vm); +typedef int32_t (*vm_sw_loader_t)(struct acrn_vm *vm); extern vm_sw_loader_t vm_sw_loader; /** * @brief Data transfering between hypervisor and VM @@ -134,7 +135,7 @@ extern vm_sw_loader_t vm_sw_loader; * continuous * @pre Pointer vm is non-NULL */ -int copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); +int32_t copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); /** * @brief Copy data from HV address space to VM GPA space * @@ -153,7 +154,7 @@ int copy_from_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); * continuous * @pre Pointer vm is non-NULL */ -int copy_to_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); +int32_t copy_to_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); /** * @brief Copy data from VM GVA space to HV address space * @@ -167,7 +168,7 @@ int copy_to_gpa(struct acrn_vm *vm, void *h_ptr, uint64_t gpa, uint32_t size); * @param[out] err_code The page fault flags * @param[out] fault_addr The GVA address that causes a page fault */ -int copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, +int32_t copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, uint32_t size, uint32_t *err_code, uint64_t *fault_addr); /** * @brief Copy data from HV address space to VM GVA space @@ -182,7 +183,7 @@ int copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, * @param[out] err_code The page fault flags * @param[out] fault_addr The GVA address that causes a page fault */ -int copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, +int32_t copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, uint32_t size, uint32_t *err_code, uint64_t *fault_addr); /** * @} diff --git a/hypervisor/include/arch/x86/guest/guest_pm.h b/hypervisor/include/arch/x86/guest/guest_pm.h index c4385dff8..0730620d1 100644 --- a/hypervisor/include/arch/x86/guest/guest_pm.h +++ b/hypervisor/include/arch/x86/guest/guest_pm.h @@ -8,8 +8,8 @@ #define GUEST_PM_H void vm_setup_cpu_state(struct acrn_vm *vm); -int vm_load_pm_s_state(struct acrn_vm *vm); -int validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl); +int32_t vm_load_pm_s_state(struct acrn_vm *vm); +int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl); void register_pm1ab_handler(struct acrn_vm *vm); #endif /* PM_H */ diff --git a/hypervisor/include/arch/x86/guest/mptable.h b/hypervisor/include/arch/x86/guest/mptable.h index 6febde547..ec0065277 100644 --- a/hypervisor/include/arch/x86/guest/mptable.h +++ b/hypervisor/include/arch/x86/guest/mptable.h @@ -26,6 +26,6 @@ struct mptable_info; extern struct mptable_info mptable_vm1; extern struct mptable_info mptable_vm2; -int mptable_build(struct acrn_vm *vm); +int32_t mptable_build(struct acrn_vm *vm); #endif /* MPTABLE_H */ diff --git a/hypervisor/include/arch/x86/guest/vcpu.h b/hypervisor/include/arch/x86/guest/vcpu.h index 03352883a..e2f3e717e 100644 --- a/hypervisor/include/arch/x86/guest/vcpu.h +++ b/hypervisor/include/arch/x86/guest/vcpu.h @@ -204,7 +204,7 @@ struct acrn_vcpu_arch { uint8_t vmcs[PAGE_SIZE]; /* per vcpu lapic */ struct acrn_vlapic vlapic; - int cur_context; + int32_t cur_context; struct cpu_context contexts[NR_WORLD]; /* common MSRs, world_msrs[] is a subset of it */ @@ -551,7 +551,7 @@ struct acrn_vcpu* get_ever_run_vcpu(uint16_t pcpu_id); * * @retval 0 vcpu created successfully, other values failed. */ -int create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcpu_handle); +int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcpu_handle); /** * @brief run into non-root mode based on vcpu setting @@ -564,9 +564,9 @@ int create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcp * * @retval 0 vcpu run successfully, other values failed. */ -int run_vcpu(struct acrn_vcpu *vcpu); +int32_t run_vcpu(struct acrn_vcpu *vcpu); -int shutdown_vcpu(struct acrn_vcpu *vcpu); +int32_t shutdown_vcpu(struct acrn_vcpu *vcpu); /** * @brief unmap the vcpu with pcpu and free its vlapic @@ -623,7 +623,7 @@ void schedule_vcpu(struct acrn_vcpu *vcpu); * @param[inout] vm pointer to vm data structure * @param[in] pcpu_id which the vcpu will be mapped */ -int prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id); +int32_t prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id); void request_vcpu_pre_work(struct acrn_vcpu *vcpu, uint16_t pre_work_id); diff --git a/hypervisor/include/arch/x86/guest/vioapic.h b/hypervisor/include/arch/x86/guest/vioapic.h index 404d09d6a..08b823ef3 100644 --- a/hypervisor/include/arch/x86/guest/vioapic.h +++ b/hypervisor/include/arch/x86/guest/vioapic.h @@ -104,7 +104,7 @@ void vioapic_update_tmr(struct acrn_vcpu *vcpu); uint32_t vioapic_pincount(const struct acrn_vm *vm); void vioapic_process_eoi(struct acrn_vm *vm, uint32_t vector); void vioapic_get_rte(struct acrn_vm *vm, uint32_t pin, union ioapic_rte *rte); -int vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data); +int32_t vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data); /** * @} diff --git a/hypervisor/include/arch/x86/guest/vlapic.h b/hypervisor/include/arch/x86/guest/vlapic.h index ee1a47d08..3a96ef07f 100644 --- a/hypervisor/include/arch/x86/guest/vlapic.h +++ b/hypervisor/include/arch/x86/guest/vlapic.h @@ -75,7 +75,7 @@ struct acrn_vlapic { struct acrn_vcpu *vcpu; uint32_t esr_pending; - int esr_firing; + int32_t esr_firing; struct vlapic_timer vtimer; @@ -134,7 +134,7 @@ uint64_t vlapic_get_cr8(const struct acrn_vlapic *vlapic); * @remark The vector does not automatically transition to the ISR as a * result of calling this function. */ -int vlapic_pending_intr(const struct acrn_vlapic *vlapic, uint32_t *vecptr); +int32_t vlapic_pending_intr(const struct acrn_vlapic *vlapic, uint32_t *vecptr); /** * @brief Accept virtual interrupt. @@ -181,8 +181,8 @@ void vlapic_post_intr(uint16_t dest_pcpu_id); */ uint64_t apicv_get_pir_desc_paddr(struct acrn_vcpu *vcpu); -int vlapic_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval); -int vlapic_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval); +int32_t vlapic_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval); +int32_t vlapic_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval); /* * Signals to the LAPIC that an interrupt at 'vector' needs to be generated @@ -265,7 +265,7 @@ void vlapic_set_tmr_one_vec(struct acrn_vlapic *vlapic, uint32_t delmode, void vlapic_apicv_batch_set_tmr(struct acrn_vlapic *vlapic); uint32_t vlapic_get_apicid(struct acrn_vlapic *vlapic); -int vlapic_create(struct acrn_vcpu *vcpu); +int32_t vlapic_create(struct acrn_vcpu *vcpu); /* * @pre vcpu != NULL */ @@ -277,10 +277,10 @@ bool vlapic_enabled(const struct acrn_vlapic *vlapic); uint64_t vlapic_apicv_get_apic_access_addr(void); uint64_t vlapic_apicv_get_apic_page_addr(struct acrn_vlapic *vlapic); void vlapic_apicv_inject_pir(struct acrn_vlapic *vlapic); -int apic_access_vmexit_handler(struct acrn_vcpu *vcpu); -int apic_write_vmexit_handler(struct acrn_vcpu *vcpu); -int veoi_vmexit_handler(struct acrn_vcpu *vcpu); -int tpr_below_threshold_vmexit_handler(__unused struct acrn_vcpu *vcpu); +int32_t apic_access_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t apic_write_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t veoi_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t tpr_below_threshold_vmexit_handler(__unused struct acrn_vcpu *vcpu); void calcvdest(struct acrn_vm *vm, uint64_t *dmask, uint32_t dest, bool phys); /** diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 367d0cfef..ebccbd30d 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -48,7 +48,7 @@ struct sw_kernel_info { }; struct vm_sw_info { - int kernel_type; /* Guest kernel type */ + int32_t kernel_type; /* Guest kernel type */ /* Kernel information (common for all guest types) */ struct sw_kernel_info kernel_info; /* Additional information specific to Linux guests */ @@ -164,7 +164,7 @@ struct acrn_vm { #ifdef CONFIG_PARTITION_MODE struct vpci_vdev_array { - int num_pci_vdev; + int32_t num_pci_vdev; struct pci_vdev vpci_vdev_list[]; }; #endif @@ -257,14 +257,14 @@ vm_ioapic(struct acrn_vm *vm) return (struct acrn_vioapic *)&(vm->arch_vm.vioapic); } -int shutdown_vm(struct acrn_vm *vm); +int32_t shutdown_vm(struct acrn_vm *vm); void pause_vm(struct acrn_vm *vm); void resume_vm(struct acrn_vm *vm); void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec); -int start_vm(struct acrn_vm *vm); -int reset_vm(struct acrn_vm *vm); -int create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm); -int prepare_vm(uint16_t pcpu_id); +int32_t start_vm(struct acrn_vm *vm); +int32_t reset_vm(struct acrn_vm *vm); +int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm); +int32_t prepare_vm(uint16_t pcpu_id); #ifdef CONFIG_PARTITION_MODE const struct vm_description_array *get_vm_desc_base(void); @@ -274,7 +274,7 @@ struct acrn_vm *get_vm_from_vmid(uint16_t vm_id); #ifdef CONFIG_PARTITION_MODE struct vm_description_array { - int num_vm_desc; + int32_t num_vm_desc; struct vm_description vm_desc_array[]; }; diff --git a/hypervisor/include/arch/x86/ioreq.h b/hypervisor/include/arch/x86/ioreq.h index 8912c41af..463e30eb0 100644 --- a/hypervisor/include/arch/x86/ioreq.h +++ b/hypervisor/include/arch/x86/ioreq.h @@ -115,7 +115,7 @@ struct vm_io_handler_desc { /* Typedef for MMIO handler and range check routine */ struct mmio_request; -typedef int (*hv_mem_io_handler_t)(struct io_request *io_req, void *handler_private_data); +typedef int32_t (*hv_mem_io_handler_t)(struct io_request *io_req, void *handler_private_data); /** * @brief Structure for MMIO handler node @@ -223,7 +223,7 @@ void register_io_emulation_handler(struct acrn_vm *vm, uint32_t pio_idx, * @retval 0 Registration succeeds * @retval -EINVAL \p read_write is NULL, \p end is not larger than \p start or \p vm has been launched */ -int register_mmio_emulation_handler(struct acrn_vm *vm, +int32_t register_mmio_emulation_handler(struct acrn_vm *vm, hv_mem_io_handler_t read_write, uint64_t start, uint64_t end, void *handler_private_data); diff --git a/hypervisor/include/arch/x86/irq.h b/hypervisor/include/arch/x86/irq.h index 5bc541355..e47bae980 100644 --- a/hypervisor/include/arch/x86/irq.h +++ b/hypervisor/include/arch/x86/irq.h @@ -137,7 +137,7 @@ uint32_t irq_to_vector(uint32_t irq); * * @pre vcpu != NULL */ -int vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector, uint32_t err_code); +int32_t vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector, uint32_t err_code); /** * @brief Inject external interrupt to guest. @@ -223,10 +223,10 @@ void vcpu_make_request(struct acrn_vcpu *vcpu, uint16_t eventid); /* * @pre vcpu != NULL */ -int exception_vmexit_handler(struct acrn_vcpu *vcpu); -int interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu); -int external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu); -int acrn_handle_pending_request(struct acrn_vcpu *vcpu); +int32_t exception_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t acrn_handle_pending_request(struct acrn_vcpu *vcpu); /** * @brief Initialize the interrupt diff --git a/hypervisor/include/arch/x86/mmu.h b/hypervisor/include/arch/x86/mmu.h index ab4df43c4..627925e55 100644 --- a/hypervisor/include/arch/x86/mmu.h +++ b/hypervisor/include/arch/x86/mmu.h @@ -122,7 +122,7 @@ void mmu_modify_or_del(uint64_t *pml4_page, uint64_t vaddr_base, uint64_t size, * @retval 0 on success * @retval -ENODEV Don't support EPT or VPID capability */ -int check_vmx_mmu_cap(void); +int32_t check_vmx_mmu_cap(void); /** * @brief VPID allocation * @@ -293,7 +293,7 @@ void ept_mr_del(struct acrn_vm *vm, uint64_t *pml4_page, uint64_t gpa, * @retval -EINVAL fail to handle the EPT violation * @retval 0 Success to handle the EPT violation */ -int ept_violation_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu); /** * @brief EPT misconfiguration handling * @@ -302,7 +302,7 @@ int ept_violation_vmexit_handler(struct acrn_vcpu *vcpu); * @retval -EINVAL fail to handle the EPT misconfig * @retval 0 Success to handle the EPT misconfig */ -int ept_misconfig_vmexit_handler(__unused struct acrn_vcpu *vcpu); +int32_t ept_misconfig_vmexit_handler(__unused struct acrn_vcpu *vcpu); /** * @} diff --git a/hypervisor/include/arch/x86/multiboot.h b/hypervisor/include/arch/x86/multiboot.h index e20656a0a..4ec19e945 100644 --- a/hypervisor/include/arch/x86/multiboot.h +++ b/hypervisor/include/arch/x86/multiboot.h @@ -78,8 +78,8 @@ struct multiboot_module { uint32_t mm_reserved; }; -int parse_hv_cmdline(void); -int init_vm_boot_info(struct acrn_vm *vm); +int32_t parse_hv_cmdline(void); +int32_t init_vm_boot_info(struct acrn_vm *vm); /* boot_regs store the multiboot header address */ extern uint32_t boot_regs[2]; diff --git a/hypervisor/include/arch/x86/timer.h b/hypervisor/include/arch/x86/timer.h index c28cd5853..e90179776 100644 --- a/hypervisor/include/arch/x86/timer.h +++ b/hypervisor/include/arch/x86/timer.h @@ -62,7 +62,7 @@ struct hv_timer { */ static inline void initialize_timer(struct hv_timer *timer, timer_handle_t func, void *priv_data, - uint64_t fire_tsc, int mode, uint64_t period_in_cycle) + uint64_t fire_tsc, int32_t mode, uint64_t period_in_cycle) { if (timer != NULL) { timer->func = func; @@ -96,7 +96,7 @@ static inline bool timer_expired(const struct hv_timer *timer) * * @remark Don't call it in the timer callback function or interrupt content. */ -int add_timer(struct hv_timer *timer); +int32_t add_timer(struct hv_timer *timer); /** * @brief Delete a timer. diff --git a/hypervisor/include/arch/x86/trusty.h b/hypervisor/include/arch/x86/trusty.h index 7282cc5ba..271c0e86f 100644 --- a/hypervisor/include/arch/x86/trusty.h +++ b/hypervisor/include/arch/x86/trusty.h @@ -126,7 +126,7 @@ struct trusty_startup_param { uint8_t padding[4]; }; -void switch_world(struct acrn_vcpu *vcpu, int next_world); +void switch_world(struct acrn_vcpu *vcpu, int32_t next_world); bool initialize_trusty(struct acrn_vcpu *vcpu, uint64_t param); void destroy_secure_world(struct acrn_vm *vm, bool need_clr_mem); void save_sworld_context(struct acrn_vcpu *vcpu); diff --git a/hypervisor/include/arch/x86/vmexit.h b/hypervisor/include/arch/x86/vmexit.h index 29b2cde72..bb409567a 100644 --- a/hypervisor/include/arch/x86/vmexit.h +++ b/hypervisor/include/arch/x86/vmexit.h @@ -8,14 +8,14 @@ #define VMEXIT_H_ struct vm_exit_dispatch { - int (*handler)(struct acrn_vcpu *); + int32_t (*handler)(struct acrn_vcpu *); uint32_t need_exit_qualification; }; -int vmexit_handler(struct acrn_vcpu *vcpu); -int vmcall_vmexit_handler(struct acrn_vcpu *vcpu); -int cpuid_vmexit_handler(struct acrn_vcpu *vcpu); -int cr_access_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t vmexit_handler(struct acrn_vcpu *vcpu); +int32_t vmcall_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t cpuid_vmexit_handler(struct acrn_vcpu *vcpu); +int32_t cr_access_vmexit_handler(struct acrn_vcpu *vcpu); extern void vm_exit(void); static inline uint64_t vm_exit_qualification_bit_mask(uint64_t exit_qual, uint32_t msb, uint32_t lsb) diff --git a/hypervisor/include/arch/x86/vmx.h b/hypervisor/include/arch/x86/vmx.h index b0a5e29de..00b6fa1ba 100644 --- a/hypervisor/include/arch/x86/vmx.h +++ b/hypervisor/include/arch/x86/vmx.h @@ -459,7 +459,7 @@ void exec_vmclear(void *addr); void exec_vmptrld(void *addr); uint64_t vmx_rdmsr_pat(const struct acrn_vcpu *vcpu); -int vmx_wrmsr_pat(struct acrn_vcpu *vcpu, uint64_t value); +int32_t vmx_wrmsr_pat(struct acrn_vcpu *vcpu, uint64_t value); void vmx_write_cr0(struct acrn_vcpu *vcpu, uint64_t cr0); void vmx_write_cr4(struct acrn_vcpu *vcpu, uint64_t cr4); diff --git a/hypervisor/include/arch/x86/vtd.h b/hypervisor/include/arch/x86/vtd.h index 02f704c19..7efe001a8 100644 --- a/hypervisor/include/arch/x86/vtd.h +++ b/hypervisor/include/arch/x86/vtd.h @@ -502,7 +502,7 @@ struct iommu_domain; * @pre domain != NULL * */ -int assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun); +int32_t assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun); /** * @brief Unassign a device specified by bus & devfun from a iommu domain . @@ -519,7 +519,7 @@ int assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t devfun * @pre domain != NULL * */ -int unassign_iommu_device(const struct iommu_domain *domain, uint8_t bus, uint8_t devfun); +int32_t unassign_iommu_device(const struct iommu_domain *domain, uint8_t bus, uint8_t devfun); /** * @brief Create a iommu domain for a VM specified by vm_id. @@ -596,7 +596,7 @@ void resume_iommu(void); * @retval <0 on failure * */ -int init_iommu(void); +int32_t init_iommu(void); /** * @brief Init VM0 domain of iommu. diff --git a/hypervisor/include/common/ptdev.h b/hypervisor/include/common/ptdev.h index 91d4eb966..5fa2095d4 100644 --- a/hypervisor/include/common/ptdev.h +++ b/hypervisor/include/common/ptdev.h @@ -44,7 +44,7 @@ struct ptirq_msi_info { uint32_t vmsi_data; /* virt msi_data */ uint64_t pmsi_addr; /* phys msi_addr */ uint32_t pmsi_data; /* phys msi_data */ - int is_msix; /* 0-MSI, 1-MSIX */ + int32_t is_msix; /* 0-MSI, 1-MSIX */ }; /* entry per each allocated irq/vector diff --git a/hypervisor/include/common/schedule.h b/hypervisor/include/common/schedule.h index 44ae67978..990b838ab 100644 --- a/hypervisor/include/common/schedule.h +++ b/hypervisor/include/common/schedule.h @@ -32,9 +32,9 @@ void remove_vcpu_from_runqueue(struct acrn_vcpu *vcpu); void default_idle(void); void make_reschedule_request(const struct acrn_vcpu *vcpu); -int need_reschedule(uint16_t pcpu_id); +int32_t need_reschedule(uint16_t pcpu_id); void make_pcpu_offline(uint16_t pcpu_id); -int need_offline(uint16_t pcpu_id); +int32_t need_offline(uint16_t pcpu_id); void schedule(void); diff --git a/hypervisor/include/debug/sbuf.h b/hypervisor/include/debug/sbuf.h index c5d74fe15..393e39499 100644 --- a/hypervisor/include/debug/sbuf.h +++ b/hypervisor/include/debug/sbuf.h @@ -64,7 +64,7 @@ struct shared_buf { *@pre data != NULL */ uint32_t sbuf_put(struct shared_buf *sbuf, uint8_t *data); -int sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva); +int32_t sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva); uint32_t sbuf_next_ptr(uint32_t pos, uint32_t span, uint32_t scope); #endif /* SHARED_BUFFER_H */ diff --git a/hypervisor/include/dm/vpci.h b/hypervisor/include/dm/vpci.h index 0028df558..edebcfdb5 100644 --- a/hypervisor/include/dm/vpci.h +++ b/hypervisor/include/dm/vpci.h @@ -38,7 +38,7 @@ struct pci_vdev_ops { int32_t (*deinit)(struct pci_vdev *vdev); - int (*cfgwrite)(struct pci_vdev *vdev, uint32_t offset, + int32_t (*cfgwrite)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val); int32_t (*cfgread)(struct pci_vdev *vdev, uint32_t offset, diff --git a/hypervisor/include/lib/crypto/crypto_api.h b/hypervisor/include/lib/crypto/crypto_api.h index f052e6f2f..eb9dfe473 100644 --- a/hypervisor/include/lib/crypto/crypto_api.h +++ b/hypervisor/include/lib/crypto/crypto_api.h @@ -32,9 +32,9 @@ * optional. Ignored if info == NULL or a zero-length string * @param info_len: The length of the info, ignored if info is NULL * - * @return int 1 - Success 0 - Failure + * @return int32_t 1 - Success 0 - Failure */ -int hkdf_sha256(uint8_t *out_key, size_t out_len, +int32_t hkdf_sha256(uint8_t *out_key, size_t out_len, const uint8_t *secret, size_t secret_len, const uint8_t *salt, size_t salt_len, const uint8_t *info, size_t info_len); @@ -55,9 +55,9 @@ int hkdf_sha256(uint8_t *out_key, size_t out_len, * @param salt The buffer holding the input data * @param salt_len The length of the input data * - * @return int 1 - Success 0 - Failure + * @return int32_t 1 - Success 0 - Failure */ -int hmac_sha256(uint8_t *out_key, +int32_t hmac_sha256(uint8_t *out_key, const uint8_t *secret, size_t secret_len, const uint8_t *salt, size_t salt_len); diff --git a/hypervisor/include/lib/rtl.h b/hypervisor/include/lib/rtl.h index c79a6d31b..6ba21cc5e 100644 --- a/hypervisor/include/lib/rtl.h +++ b/hypervisor/include/lib/rtl.h @@ -21,16 +21,16 @@ union u_qword { /* Function prototypes */ void udelay(uint32_t us); -void *memchr(const void *void_s, int c, size_t n); -int strcmp(const char *s1_arg, const char *s2_arg); -int strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg); +void *memchr(const void *void_s, int32_t c, size_t n); +int32_t strcmp(const char *s1_arg, const char *s2_arg); +int32_t strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg); char *strcpy_s(char *d_arg, size_t dmax, const char *s_arg); char *strncpy_s(char *d_arg, size_t dmax, const char *s_arg, size_t slen_arg); char *strchr(char *s_arg, char ch); size_t strnlen_s(const char *str_arg, size_t maxlen_arg); void *memset(void *base, uint8_t v, size_t n); void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen_arg); -int atoi(const char *str); +int32_t atoi(const char *str); long strtol_deci(const char *nptr); uint64_t strtoul_hex(const char *nptr); char *strstr_s(const char *str1, size_t maxlen1, diff --git a/hypervisor/lib/crypto/crypto_api.c b/hypervisor/lib/crypto/crypto_api.c index 03c0dd8e7..0053ce40d 100644 --- a/hypervisor/lib/crypto/crypto_api.c +++ b/hypervisor/lib/crypto/crypto_api.c @@ -8,7 +8,7 @@ #include "mbedtls/hkdf.h" #include "mbedtls/md.h" -int hkdf_sha256(uint8_t *out_key, size_t out_len, +int32_t hkdf_sha256(uint8_t *out_key, size_t out_len, const uint8_t *secret, size_t secret_len, const uint8_t *salt, size_t salt_len, const uint8_t *info, size_t info_len) @@ -36,7 +36,7 @@ int hkdf_sha256(uint8_t *out_key, size_t out_len, return 1; } -int hmac_sha256(uint8_t *out_key, +int32_t hmac_sha256(uint8_t *out_key, const uint8_t *secret, size_t secret_len, const uint8_t *salt, size_t salt_len) { diff --git a/hypervisor/lib/crypto/mbedtls/ChangeLog b/hypervisor/lib/crypto/mbedtls/ChangeLog index 74583e165..c3bf1f1ed 100644 --- a/hypervisor/lib/crypto/mbedtls/ChangeLog +++ b/hypervisor/lib/crypto/mbedtls/ChangeLog @@ -451,7 +451,7 @@ API Changes implementations of the RSA interface declared in rsa.h. * The following functions in the message digest modules (MD2, MD4, MD5, SHA1, SHA256, SHA512) have been deprecated and replaced as shown below. - The new functions change the return type from void to int to allow + The new functions change the return type from void to int32_t to allow returning error codes when using MBEDTLS__ALT. mbedtls__starts() -> mbedtls__starts_ret() mbedtls__update() -> mbedtls__update_ret() @@ -718,7 +718,7 @@ Features API Changes * The following functions in the AES module have been deprecated and replaced by the functions shown below. The new functions change the return type from - void to int to allow returning error codes when using MBEDTLS_AES_ALT, + void to int32_t to allow returning error codes when using MBEDTLS_AES_ALT, MBEDTLS_AES_DECRYPT_ALT or MBEDTLS_AES_ENCRYPT_ALT. mbedtls_aes_decrypt() -> mbedtls_internal_aes_decrypt() mbedtls_aes_encrypt() -> mbedtls_internal_aes_encrypt() @@ -1213,7 +1213,7 @@ API Changes ecdsa_write_signature_det() was deprecated. * pk_sign() no longer accepts md_alg == POLARSSL_MD_NONE with ECDSA. * Last argument of x509_crt_check_key_usage() and - mbedtls_x509write_crt_set_key_usage() changed from int to unsigned. + mbedtls_x509write_crt_set_key_usage() changed from int32_t to unsigned. * test_ca_list (from certs.h) is renamed to test_cas_pem and is only available if POLARSSL_PEM_PARSE_C is defined (it never worked without). * Test certificates in certs.c are no longer guaranteed to be nul-terminated @@ -1788,7 +1788,7 @@ Changes * Removed POLARSSL_THREADING_DUMMY Bugfix - * Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int + * Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int32_t * Fixed X.509 hostname comparison (with non-regular characters) * SSL now gracefully handles missing RNG * Missing defines / cases for RSA_PSK key exchange @@ -2472,7 +2472,7 @@ Features Changes * Major argument / variable rewrite. Introduced use of size_t - instead of int for buffer lengths and loop variables for + instead of int32_t for buffer lengths and loop variables for better unsigned / signed use. Renamed internal bigint types t_int and t_dbl to t_uint and t_udbl in the process * mpi_init() and mpi_free() now only accept a single MPI @@ -2618,7 +2618,7 @@ Changes * X509 signature algorithm determination is now in a function to allow easy future expansion * Changed symmetric cipher functions to - identical interface (returning int result values) + identical interface (returning int32_t result values) * Changed ARC4 to use separate input/output buffer * Added reset function for HMAC context as speed-up for specific use-cases diff --git a/hypervisor/lib/crypto/mbedtls/hkdf.c b/hypervisor/lib/crypto/mbedtls/hkdf.c index fc8caa3b6..9c2b1c9a9 100644 --- a/hypervisor/lib/crypto/mbedtls/hkdf.c +++ b/hypervisor/lib/crypto/mbedtls/hkdf.c @@ -21,12 +21,12 @@ #include "hkdf.h" -int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, +int32_t mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, const uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len ) { - int ret; + int32_t ret; uint8_t prk[MBEDTLS_MD_MAX_SIZE]; ret = mbedtls_hkdf_extract( md, salt, salt_len, ikm, ikm_len, prk ); @@ -42,7 +42,7 @@ int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, return( ret ); } -int mbedtls_hkdf_extract( const mbedtls_md_info_t *md, +int32_t mbedtls_hkdf_extract( const mbedtls_md_info_t *md, const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, uint8_t *prk ) @@ -72,7 +72,7 @@ int mbedtls_hkdf_extract( const mbedtls_md_info_t *md, return( mbedtls_md_hmac( md, salt, salt_len, ikm, ikm_len, prk ) ); } -int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk, +int32_t mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk, size_t prk_len, const uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len ) { @@ -81,7 +81,7 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk, size_t n; size_t t_len = 0; size_t i; - int ret = 0; + int32_t ret = 0; mbedtls_md_context_t ctx; uint8_t t[MBEDTLS_MD_MAX_SIZE]; diff --git a/hypervisor/lib/crypto/mbedtls/hkdf.h b/hypervisor/lib/crypto/mbedtls/hkdf.h index a59edbc0f..b2e446ce1 100644 --- a/hypervisor/lib/crypto/mbedtls/hkdf.h +++ b/hypervisor/lib/crypto/mbedtls/hkdf.h @@ -60,7 +60,7 @@ * \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying * MD layer. */ -int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, +int32_t mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, const uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len ); @@ -84,7 +84,7 @@ int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt, * \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying * MD layer. */ -int mbedtls_hkdf_extract( const mbedtls_md_info_t *md, +int32_t mbedtls_hkdf_extract( const mbedtls_md_info_t *md, const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, uint8_t *prk ); @@ -110,7 +110,7 @@ int mbedtls_hkdf_extract( const mbedtls_md_info_t *md, * \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying * MD layer. */ -int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk, +int32_t mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk, size_t prk_len, const uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len ); diff --git a/hypervisor/lib/crypto/mbedtls/md.c b/hypervisor/lib/crypto/mbedtls/md.c index 2b323a409..1ccdf022e 100644 --- a/hypervisor/lib/crypto/mbedtls/md.c +++ b/hypervisor/lib/crypto/mbedtls/md.c @@ -31,12 +31,12 @@ /* * Reminder: update profiles in x509_crt.c when adding a new hash! */ -static const int supported_digests[] = { +static const int32_t supported_digests[] = { MBEDTLS_MD_SHA256, MBEDTLS_MD_NONE }; -const int *mbedtls_md_list( void ) +const int32_t *mbedtls_md_list( void ) { return( supported_digests ); } @@ -65,7 +65,7 @@ void mbedtls_md_free( mbedtls_md_context_t *ctx ) mbedtls_platform_zeroize( ctx, sizeof( mbedtls_md_context_t ) ); } -int mbedtls_md_clone( mbedtls_md_context_t *dst, +int32_t mbedtls_md_clone( mbedtls_md_context_t *dst, const mbedtls_md_context_t *src ) { if( dst == NULL || dst->md_info == NULL || @@ -80,7 +80,7 @@ int mbedtls_md_clone( mbedtls_md_context_t *dst, return( 0 ); } -int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info ) +int32_t mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info ) { if( md_info == NULL || ctx == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -90,7 +90,7 @@ int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_inf return( 0 ); } -int mbedtls_md_starts( mbedtls_md_context_t *ctx ) +int32_t mbedtls_md_starts( mbedtls_md_context_t *ctx ) { if( ctx == NULL || ctx->md_info == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -98,7 +98,7 @@ int mbedtls_md_starts( mbedtls_md_context_t *ctx ) return( ctx->md_info->starts_func( ctx->md_ctx ) ); } -int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ) +int32_t mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ) { if( ctx == NULL || ctx->md_info == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -106,7 +106,7 @@ int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t i return( ctx->md_info->update_func( ctx->md_ctx, input, ilen ) ); } -int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ) +int32_t mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ) { if( ctx == NULL || ctx->md_info == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -114,7 +114,7 @@ int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ) return( ctx->md_info->finish_func( ctx->md_ctx, output ) ); } -int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen, +int32_t mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen, uint8_t *output ) { if( md_info == NULL ) @@ -123,9 +123,9 @@ int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t i return( md_info->digest_func( input, ilen, output ) ); } -int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, size_t keylen ) +int32_t mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, size_t keylen ) { - int ret; + int32_t ret; uint8_t sum[MBEDTLS_MD_MAX_SIZE]; uint8_t *ipad, *opad; size_t i; @@ -170,7 +170,7 @@ cleanup: return( ret ); } -int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ) +int32_t mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ) { if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -178,9 +178,9 @@ int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, siz return( ctx->md_info->update_func( ctx->md_ctx, input, ilen ) ); } -int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output ) +int32_t mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output ) { - int ret; + int32_t ret; uint8_t tmp[MBEDTLS_MD_MAX_SIZE]; uint8_t *opad; @@ -202,9 +202,9 @@ int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output ) return( ctx->md_info->finish_func( ctx->md_ctx, output ) ); } -int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ) +int32_t mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ) { - int ret; + int32_t ret; uint8_t *ipad; if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL ) @@ -218,13 +218,13 @@ int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ) ctx->md_info->block_size ) ); } -int mbedtls_md_hmac( const mbedtls_md_info_t *md_info, +int32_t mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const uint8_t *key, size_t keylen, const uint8_t *input, size_t ilen, uint8_t *output ) { mbedtls_md_context_t ctx; - int ret; + int32_t ret; if( md_info == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); @@ -247,7 +247,7 @@ cleanup: return( ret ); } -int mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data ) +int32_t mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data ) { if( ctx == NULL || ctx->md_info == NULL ) return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); diff --git a/hypervisor/lib/crypto/mbedtls/md.h b/hypervisor/lib/crypto/mbedtls/md.h index 883c57a17..8c766c636 100644 --- a/hypervisor/lib/crypto/mbedtls/md.h +++ b/hypervisor/lib/crypto/mbedtls/md.h @@ -80,7 +80,7 @@ typedef struct { * message-digest enumeration #mbedtls_md_type_t. * The last entry is 0. */ -const int *mbedtls_md_list( void ); +const int32_t *mbedtls_md_list( void ); /** * \brief This function returns the message-digest information @@ -135,7 +135,7 @@ void mbedtls_md_free( mbedtls_md_context_t *ctx ); * failure. * \return #MBEDTLS_ERR_MD_ALLOC_FAILED on memory-allocation failure. */ -int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info ); +int32_t mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info ); /** * \brief This function clones the state of an message-digest @@ -156,7 +156,7 @@ int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_inf * \return \c 0 on success. * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification failure. */ -int mbedtls_md_clone( mbedtls_md_context_t *dst, +int32_t mbedtls_md_clone( mbedtls_md_context_t *dst, const mbedtls_md_context_t *src ); /** @@ -194,7 +194,7 @@ mbedtls_md_type_t mbedtls_md_get_type( const mbedtls_md_info_t *md_info ); * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_starts( mbedtls_md_context_t *ctx ); +int32_t mbedtls_md_starts( mbedtls_md_context_t *ctx ); /** * \brief This function feeds an input buffer into an ongoing @@ -212,7 +212,7 @@ int mbedtls_md_starts( mbedtls_md_context_t *ctx ); * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ); +int32_t mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ); /** * \brief This function finishes the digest operation, @@ -232,7 +232,7 @@ int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t i * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ); +int32_t mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ); /** * \brief This function calculates the message-digest of a buffer, @@ -252,7 +252,7 @@ int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output ); * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen, +int32_t mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen, uint8_t *output ); /** @@ -273,7 +273,7 @@ int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t i * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, +int32_t mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, size_t keylen ); /** @@ -295,7 +295,7 @@ int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, +int32_t mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen ); /** @@ -316,7 +316,7 @@ int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output); +int32_t mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output); /** * \brief This function prepares to authenticate a new message with @@ -333,7 +333,7 @@ int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output); * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ); +int32_t mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ); /** * \brief This function calculates the full generic HMAC @@ -357,11 +357,11 @@ int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx ); * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * failure. */ -int mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const uint8_t *key, size_t keylen, +int32_t mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const uint8_t *key, size_t keylen, const uint8_t *input, size_t ilen, uint8_t *output ); /* Internal use */ -int mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data ); +int32_t mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data ); #endif /* MBEDTLS_MD_H */ diff --git a/hypervisor/lib/crypto/mbedtls/md_internal.h b/hypervisor/lib/crypto/mbedtls/md_internal.h index 9f2053039..c2c58b80f 100644 --- a/hypervisor/lib/crypto/mbedtls/md_internal.h +++ b/hypervisor/lib/crypto/mbedtls/md_internal.h @@ -44,29 +44,29 @@ struct mbedtls_md_info_t const char * name; /** Output length of the digest function in bytes */ - int size; + int32_t size; /** Block length of the digest function in bytes */ - int block_size; + int32_t block_size; /** Digest initialisation function */ - int (*starts_func)( void *ctx ); + int32_t (*starts_func)( void *ctx ); /** Digest update function */ - int (*update_func)( void *ctx, const uint8_t *input, size_t ilen ); + int32_t (*update_func)( void *ctx, const uint8_t *input, size_t ilen ); /** Digest finalisation function */ - int (*finish_func)( void *ctx, uint8_t *output ); + int32_t (*finish_func)( void *ctx, uint8_t *output ); /** Generic digest function */ - int (*digest_func)( const uint8_t *input, size_t ilen, + int32_t (*digest_func)( const uint8_t *input, size_t ilen, uint8_t *output ); /** Clone state from a context */ void (*clone_func)( void *dst, const void *src ); /** Internal use only */ - int (*process_func)( void *ctx, const uint8_t *input ); + int32_t (*process_func)( void *ctx, const uint8_t *input ); }; extern const mbedtls_md_info_t mbedtls_sha256_info; diff --git a/hypervisor/lib/crypto/mbedtls/md_wrap.c b/hypervisor/lib/crypto/mbedtls/md_wrap.c index 0505e4bba..a9f02327f 100644 --- a/hypervisor/lib/crypto/mbedtls/md_wrap.c +++ b/hypervisor/lib/crypto/mbedtls/md_wrap.c @@ -32,14 +32,14 @@ * Wrappers for generic message digests */ -static int sha256_update_wrap( void *ctx, const uint8_t *input, +static int32_t sha256_update_wrap( void *ctx, const uint8_t *input, size_t ilen ) { return( mbedtls_sha256_update_ret( (mbedtls_sha256_context *) ctx, input, ilen ) ); } -static int sha256_finish_wrap( void *ctx, uint8_t *output ) +static int32_t sha256_finish_wrap( void *ctx, uint8_t *output ) { return( mbedtls_sha256_finish_ret( (mbedtls_sha256_context *) ctx, output ) ); @@ -51,18 +51,18 @@ static void sha256_clone_wrap( void *dst, const void *src ) (const mbedtls_sha256_context *) src ); } -static int sha256_process_wrap( void *ctx, const uint8_t *data ) +static int32_t sha256_process_wrap( void *ctx, const uint8_t *data ) { return( mbedtls_internal_sha256_process( (mbedtls_sha256_context *) ctx, data ) ); } -static int sha256_starts_wrap( void *ctx ) +static int32_t sha256_starts_wrap( void *ctx ) { return( mbedtls_sha256_starts_ret( (mbedtls_sha256_context *) ctx, 0 ) ); } -static int sha256_wrap( const uint8_t *input, size_t ilen, +static int32_t sha256_wrap( const uint8_t *input, size_t ilen, uint8_t *output ) { return( mbedtls_sha256_ret( input, ilen, output, 0 ) ); diff --git a/hypervisor/lib/crypto/mbedtls/sha256.c b/hypervisor/lib/crypto/mbedtls/sha256.c index af6ca21ea..f397f0933 100644 --- a/hypervisor/lib/crypto/mbedtls/sha256.c +++ b/hypervisor/lib/crypto/mbedtls/sha256.c @@ -73,7 +73,7 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst, /* * SHA-256 context setup */ -int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ) +int32_t mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int32_t is224 ) { ctx->total[0] = 0; ctx->total[1] = 0; @@ -153,7 +153,7 @@ static const uint32_t K[] = d += temp1; h = temp1 + temp2; \ } -int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, +int32_t mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, const uint8_t data[64] ) { uint32_t temp1, temp2, W[64]; @@ -199,11 +199,11 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, /* * SHA-256 process buffer */ -int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, +int32_t mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const uint8_t *input, size_t ilen ) { - int ret; + int32_t ret; size_t fill; uint32_t left; @@ -249,10 +249,10 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, /* * SHA-256 final digest */ -int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, +int32_t mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, uint8_t output[32] ) { - int ret; + int32_t ret; uint32_t used; uint32_t high, low; @@ -312,12 +312,12 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, /* * output = SHA-256( input buffer ) */ -int mbedtls_sha256_ret( const uint8_t *input, +int32_t mbedtls_sha256_ret( const uint8_t *input, size_t ilen, uint8_t output[32], - int is224 ) + int32_t is224 ) { - int ret; + int32_t ret; mbedtls_sha256_context ctx; mbedtls_sha256_init( &ctx ); diff --git a/hypervisor/lib/crypto/mbedtls/sha256.h b/hypervisor/lib/crypto/mbedtls/sha256.h index a6f2662c8..16ce106ff 100644 --- a/hypervisor/lib/crypto/mbedtls/sha256.h +++ b/hypervisor/lib/crypto/mbedtls/sha256.h @@ -43,7 +43,7 @@ typedef struct uint32_t total[2]; /*!< The number of Bytes processed. */ uint32_t state[8]; /*!< The intermediate digest state. */ uint8_t buffer[64]; /*!< The data block being processed. */ - int is224; /*!< Determines which function to use: + int32_t is224; /*!< Determines which function to use: 0: Use SHA-256, or 1: Use SHA-224. */ } mbedtls_sha256_context; @@ -81,7 +81,7 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst, * * \return \c 0 on success. */ -int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ); +int32_t mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int32_t is224 ); /** * \brief This function feeds an input buffer into an ongoing @@ -93,7 +93,7 @@ int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ); * * \return \c 0 on success. */ -int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, +int32_t mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const uint8_t *input, size_t ilen ); @@ -106,7 +106,7 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, * * \return \c 0 on success. */ -int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, +int32_t mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, uint8_t output[32] ); /** @@ -119,7 +119,7 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, * * \return \c 0 on success. */ -int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, +int32_t mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, const uint8_t data[64] ); /** @@ -138,9 +138,9 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, * \param is224 Determines which function to use: * 0: Use SHA-256, or 1: Use SHA-224. */ -int mbedtls_sha256_ret( const uint8_t *input, +int32_t mbedtls_sha256_ret( const uint8_t *input, size_t ilen, uint8_t output[32], - int is224 ); + int32_t is224 ); #endif /* mbedtls_sha256.h */ diff --git a/hypervisor/lib/memory.c b/hypervisor/lib/memory.c index 9197f4e8a..9b0974e1b 100644 --- a/hypervisor/lib/memory.c +++ b/hypervisor/lib/memory.c @@ -259,7 +259,7 @@ void free(const void *ptr) } } -void *memchr(const void *void_s, int c, size_t n) +void *memchr(const void *void_s, int32_t c, size_t n) { uint8_t val = (uint8_t)c; uint8_t *ptr = (uint8_t *)void_s; diff --git a/hypervisor/lib/string.c b/hypervisor/lib/string.c index a9c566fb5..8c51b1ca6 100644 --- a/hypervisor/lib/string.c +++ b/hypervisor/lib/string.c @@ -37,7 +37,7 @@ long strtol_deci(const char *nptr) const char *s = nptr; char c; uint64_t acc, cutoff, cutlim; - int neg = 0, any; + int32_t neg = 0, any; uint64_t base = 10UL; /* @@ -117,7 +117,7 @@ uint64_t strtoul_hex(const char *nptr) char c, digit; uint64_t acc, cutoff, cutlim; uint64_t base = 16UL; - int any; + int32_t any; /* * See strtol for comments as to the logic used. @@ -157,9 +157,9 @@ uint64_t strtoul_hex(const char *nptr) return acc; } -int atoi(const char *str) +int32_t atoi(const char *str) { - return (int)strtol_deci(str); + return (int32_t)strtol_deci(str); } char *strchr(char *s_arg, char ch) @@ -377,7 +377,7 @@ size_t strnlen_s(const char *str_arg, size_t maxlen_arg) return count; } -int strcmp(const char *s1_arg, const char *s2_arg) +int32_t strcmp(const char *s1_arg, const char *s2_arg) { const char *s1 = s1_arg; const char *s2 = s2_arg; @@ -389,7 +389,7 @@ int strcmp(const char *s1_arg, const char *s2_arg) return *s1 - *s2; } -int strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg) +int32_t strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg) { const char *s1 = s1_arg; const char *s2 = s2_arg; diff --git a/hypervisor/partition/apl-mrb/mptable.c b/hypervisor/partition/apl-mrb/mptable.c index 04fe4503d..4359e9726 100644 --- a/hypervisor/partition/apl-mrb/mptable.c +++ b/hypervisor/partition/apl-mrb/mptable.c @@ -288,7 +288,7 @@ static uint8_t mpt_compute_checksum(void *base, size_t len) return (256U - sum); } -int mptable_build(struct acrn_vm *vm) +int32_t mptable_build(struct acrn_vm *vm) { char *startaddr; char *curraddr; diff --git a/hypervisor/partition/cb2_dnv/mptable.c b/hypervisor/partition/cb2_dnv/mptable.c index 0888cf2c9..cc92730af 100644 --- a/hypervisor/partition/cb2_dnv/mptable.c +++ b/hypervisor/partition/cb2_dnv/mptable.c @@ -320,7 +320,7 @@ static uint8_t mpt_compute_checksum(void *base, size_t len) return (256U - sum); } -int mptable_build(struct acrn_vm *vm) +int32_t mptable_build(struct acrn_vm *vm) { char *startaddr; char *curraddr;