Skip to content

Commit

Permalink
hv: use int32_t replace int
Browse files Browse the repository at this point in the history
Since it's typedef in "include/lib/types.h"

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
  • Loading branch information
lifeix authored and wenlingz committed Dec 12, 2018
1 parent e8f3a2d commit e3fc6c3
Show file tree
Hide file tree
Showing 91 changed files with 472 additions and 471 deletions.
8 changes: 4 additions & 4 deletions hypervisor/arch/x86/assign.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -731,7 +731,7 @@ int ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin,
* - 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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions hypervisor/arch/x86/cpu.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions hypervisor/arch/x86/cpu_state_tbl.c
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions hypervisor/arch/x86/cpuid.c
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions hypervisor/arch/x86/ept.c
Expand Up @@ -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;
Expand Down Expand Up @@ -158,9 +158,9 @@ int ept_violation_vmexit_handler(struct acrn_vcpu *vcpu)
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;

Expand Down
30 changes: 15 additions & 15 deletions hypervisor/arch/x86/guest/guest.c
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -215,14 +215,14 @@ static int local_gva2gpa_common(struct acrn_vcpu *vcpu, const struct page_walk_i
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);
Expand Down Expand Up @@ -265,12 +265,12 @@ static int local_gva2gpa_pae(struct acrn_vcpu *vcpu, struct page_walk_info *pw_i
* - 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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e3fc6c3

Please sign in to comment.