HV:misc:fix "signed/unsigned conversion with cast"

Signed/unsigned conversion should add cast explicitily
or change the type of them to the same.

V1->V2:Fixed the 0U to 0UL because of the mistakes.
V2->V3:remove unsed macro

Signed-off-by: HuiHuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi
2018-07-16 12:08:59 +08:00
committed by lijinxia
parent 619c600021
commit aa5027a30c
12 changed files with 95 additions and 92 deletions

View File

@@ -20,9 +20,9 @@ static void run_vcpu_pre_work(struct vcpu *vcpu)
void vcpu_thread(struct vcpu *vcpu)
{
uint64_t vmexit_begin = 0, vmexit_end = 0;
uint16_t basic_exit_reason = 0;
uint64_t tsc_aux_hyp_cpu = vcpu->pcpu_id;
uint64_t vmexit_begin = 0UL, vmexit_end = 0UL;
uint16_t basic_exit_reason = 0U;
uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id;
int32_t ret = 0;
/* If vcpu is not launched, we need to do init_vmcs first */

View File

@@ -623,7 +623,7 @@ int64_t hcall_assign_ptdev(struct vm *vm, uint64_t vmid, uint64_t param)
}
/* TODO: how to get vm's address width? */
target_vm->iommu_domain = create_iommu_domain(vmid,
target_vm->arch_vm.nworld_eptp, 48);
target_vm->arch_vm.nworld_eptp, 48U);
if (target_vm->iommu_domain == NULL) {
return -ENODEV;
}

View File

@@ -60,7 +60,7 @@ int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
union vhm_request_buffer *req_buf = NULL;
uint16_t cur;
ASSERT(sizeof(*req) == (4096/VHM_REQUEST_MAX),
ASSERT(sizeof(*req) == (4096U/VHM_REQUEST_MAX),
"vhm_request page broken!");
@@ -99,7 +99,7 @@ int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
#ifdef HV_DEBUG
static void _get_req_info_(struct vhm_request *req, int *id, char *type,
char *state, char *dir, long *addr, long *val)
char *state, char *dir, int64_t *addr, long *val)
{
(void)strcpy_s(dir, 16, "NONE");
*addr = 0;

View File

@@ -128,7 +128,7 @@ static int ptdev_interrupt_handler(__unused int irq, void *data)
/* active intr with irq registering */
void
ptdev_activate_entry(struct ptdev_remapping_info *entry, int phys_irq,
ptdev_activate_entry(struct ptdev_remapping_info *entry, uint32_t phys_irq,
bool lowpri)
{
struct dev_handler_node *node;

View File

@@ -56,8 +56,8 @@ static uint64_t create_zero_page(struct vm *vm)
(uint32_t)(uint64_t)sw_linux->bootargs_load_addr;
/* set constant arguments in zero page */
zeropage->hdr.loader_type = 0xff;
zeropage->hdr.load_flags |= (1U << 5); /* quiet */
zeropage->hdr.loader_type = 0xffU;
zeropage->hdr.load_flags |= (1U << 5U); /* quiet */
/* Create/add e820 table entries in zeropage */
zeropage->e820_nentries = create_e820_table(zeropage->e820);
@@ -82,7 +82,7 @@ int load_guest(struct vm *vm, struct vcpu *vcpu)
/* hardcode vcpu entry addr(kernel entry) & rsi (zeropage)*/
(void)memset(cur_context->guest_cpu_regs.longs,
0, sizeof(uint64_t)*NUM_GPRS);
0U, sizeof(uint64_t)*NUM_GPRS);
hva = GPA2HVA(vm, lowmem_gpa_top -
MEM_4K - MEM_2K);
@@ -122,10 +122,10 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
/* calculate the kernel entry point */
zeropage = (struct zero_page *)
vm->sw.kernel_info.kernel_src_addr;
kernel_entry_offset = (zeropage->hdr.setup_sects + 1) * 512;
kernel_entry_offset = (zeropage->hdr.setup_sects + 1U) * 512U;
if (vcpu->arch_vcpu.cpu_mode == CPU_MODE_64BIT) {
/* 64bit entry is the 512bytes after the start */
kernel_entry_offset += 512;
kernel_entry_offset += 512U;
}
vm->sw.kernel_info.kernel_entry_addr =
@@ -152,7 +152,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
* zeropage
*/
(void)memset(cur_context->guest_cpu_regs.longs,
0, sizeof(uint64_t) * NUM_GPRS);
0U, sizeof(uint64_t) * NUM_GPRS);
/* Get host-physical address for guest bootargs */
hva = GPA2HVA(vm,