mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
HV:common:fix "integer type violations"
fix integer type violations,keep some violations which related to hypcall and msix_entry_index. V1->V2:1.modified API_MAJOR_VERSION from Makefile 2.sync acrn_common.h changed to device model Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -21,7 +21,7 @@ static void run_vcpu_pre_work(struct vcpu *vcpu)
|
||||
void vcpu_thread(struct vcpu *vcpu)
|
||||
{
|
||||
uint64_t vmexit_begin = 0UL, vmexit_end = 0UL;
|
||||
uint16_t basic_exit_reason = 0U;
|
||||
uint32_t basic_exit_reason = 0U;
|
||||
uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id;
|
||||
int32_t ret = 0;
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <version.h>
|
||||
#include <reloc.h>
|
||||
|
||||
#define ACRN_DBG_HYCALL 6
|
||||
#define ACRN_DBG_HYCALL 6U
|
||||
|
||||
bool is_hypercall_from_ring0(void)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ int64_t hcall_get_api_version(struct vm *vm, uint64_t param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_vpic_irqline(struct vm *vm, int irq, enum irq_mode mode)
|
||||
static int handle_vpic_irqline(struct vm *vm, uint32_t irq, enum irq_mode mode)
|
||||
{
|
||||
int32_t ret = -1;
|
||||
|
||||
@@ -69,7 +69,7 @@ static int handle_vpic_irqline(struct vm *vm, int irq, enum irq_mode mode)
|
||||
}
|
||||
|
||||
static int
|
||||
handle_vioapic_irqline(struct vm *vm, int irq, enum irq_mode mode)
|
||||
handle_vioapic_irqline(struct vm *vm, uint32_t irq, enum irq_mode mode)
|
||||
{
|
||||
int32_t ret = -1;
|
||||
|
||||
@@ -141,16 +141,16 @@ int64_t hcall_create_vm(struct vm *vm, uint64_t param)
|
||||
struct acrn_create_vm cv;
|
||||
struct vm_description vm_desc;
|
||||
|
||||
(void)memset((void *)&cv, 0, sizeof(cv));
|
||||
(void)memset((void *)&cv, 0U, sizeof(cv));
|
||||
if (copy_from_gpa(vm, &cv, param, sizeof(cv)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset(&vm_desc, 0, sizeof(vm_desc));
|
||||
(void)memset(&vm_desc, 0U, sizeof(vm_desc));
|
||||
vm_desc.sworld_enabled =
|
||||
(!!(cv.vm_flag & (SECURE_WORLD_ENABLED)));
|
||||
(void)memcpy_s(&vm_desc.GUID[0], 16, &cv.GUID[0], 16);
|
||||
((cv.vm_flag & (SECURE_WORLD_ENABLED)) != 0U);
|
||||
(void)memcpy_s(&vm_desc.GUID[0], 16U, &cv.GUID[0], 16U);
|
||||
ret = create_vm(&vm_desc, &target_vm);
|
||||
|
||||
if (ret != 0) {
|
||||
@@ -292,7 +292,7 @@ int64_t hcall_inject_msi(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&msi, 0, sizeof(msi));
|
||||
(void)memset((void *)&msi, 0U, sizeof(msi));
|
||||
if (copy_from_gpa(vm, &msi, param, sizeof(msi)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
return -1;
|
||||
@@ -313,7 +313,7 @@ int64_t hcall_set_ioreq_buffer(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&iobuf, 0, sizeof(iobuf));
|
||||
(void)memset((void *)&iobuf, 0U, sizeof(iobuf));
|
||||
|
||||
if (copy_from_gpa(vm, &iobuf, param, sizeof(iobuf)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@@ -468,7 +468,7 @@ int64_t hcall_set_vm_memmap(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&memmap, 0, sizeof(memmap));
|
||||
(void)memset((void *)&memmap, 0U, sizeof(memmap));
|
||||
|
||||
if (copy_from_gpa(vm, &memmap, param, sizeof(memmap)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@@ -501,7 +501,7 @@ int64_t hcall_set_vm_memmaps(struct vm *vm, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&set_memmaps, 0, sizeof(set_memmaps));
|
||||
(void)memset((void *)&set_memmaps, 0U, sizeof(set_memmaps));
|
||||
|
||||
if (copy_from_gpa(vm, &set_memmaps, param, sizeof(set_memmaps)) != 0) {
|
||||
pr_err("%s: Unable copy param from vm\n", __func__);
|
||||
@@ -542,7 +542,7 @@ int64_t hcall_remap_pci_msix(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&remap, 0, sizeof(remap));
|
||||
(void)memset((void *)&remap, 0U, sizeof(remap));
|
||||
|
||||
if (copy_from_gpa(vm, &remap, param, sizeof(remap)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@@ -582,7 +582,7 @@ int64_t hcall_gpa_to_hpa(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&v_gpa2hpa, 0, sizeof(v_gpa2hpa));
|
||||
(void)memset((void *)&v_gpa2hpa, 0U, sizeof(v_gpa2hpa));
|
||||
|
||||
if (copy_from_gpa(vm, &v_gpa2hpa, param, sizeof(v_gpa2hpa)) != 0) {
|
||||
pr_err("HCALL gpa2hpa: Unable copy param from vm\n");
|
||||
@@ -665,7 +665,7 @@ int64_t hcall_set_ptdev_intr_info(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&irq, 0, sizeof(irq));
|
||||
(void)memset((void *)&irq, 0U, sizeof(irq));
|
||||
|
||||
if (copy_from_gpa(vm, &irq, param, sizeof(irq)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@@ -697,7 +697,7 @@ hcall_reset_ptdev_intr_info(struct vm *vm, uint64_t vmid, uint64_t param)
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)memset((void *)&irq, 0, sizeof(irq));
|
||||
(void)memset((void *)&irq, 0U, sizeof(irq));
|
||||
|
||||
if (copy_from_gpa(vm, &irq, param, sizeof(irq)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@@ -722,7 +722,7 @@ int64_t hcall_setup_sbuf(struct vm *vm, uint64_t param)
|
||||
struct sbuf_setup_param ssp;
|
||||
uint64_t *hva;
|
||||
|
||||
(void)memset((void *)&ssp, 0, sizeof(ssp));
|
||||
(void)memset((void *)&ssp, 0U, sizeof(ssp));
|
||||
|
||||
if (copy_from_gpa(vm, &ssp, param, sizeof(ssp)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <hypervisor.h>
|
||||
|
||||
#define ACRN_DBG_IOREQUEST 6
|
||||
#define ACRN_DBG_IOREQUEST 6U
|
||||
|
||||
static void fire_vhm_interrupt(void)
|
||||
{
|
||||
@@ -19,7 +19,7 @@ static void fire_vhm_interrupt(void)
|
||||
vm0 = get_vm_from_vmid(0U);
|
||||
ASSERT(vm0 != NULL, "VM Pointer is NULL");
|
||||
|
||||
vcpu = vcpu_from_vid(vm0, 0);
|
||||
vcpu = vcpu_from_vid(vm0, 0U);
|
||||
ASSERT(vcpu != NULL, "vcpu_from_vid failed");
|
||||
|
||||
vlapic_intr_edge(vcpu, VECTOR_VIRT_IRQ_VHM);
|
||||
@@ -101,53 +101,53 @@ int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
|
||||
static void _get_req_info_(struct vhm_request *req, int *id, char *type,
|
||||
char *state, char *dir, int64_t *addr, long *val)
|
||||
{
|
||||
(void)strcpy_s(dir, 16, "NONE");
|
||||
(void)strcpy_s(dir, 16U, "NONE");
|
||||
*addr = 0;
|
||||
*val = 0;
|
||||
*id = req->client;
|
||||
|
||||
switch (req->type) {
|
||||
case REQ_PORTIO:
|
||||
(void)strcpy_s(type, 16, "PORTIO");
|
||||
(void)strcpy_s(type, 16U, "PORTIO");
|
||||
if (req->reqs.pio_request.direction == REQUEST_READ) {
|
||||
(void)strcpy_s(dir, 16, "READ");
|
||||
(void)strcpy_s(dir, 16U, "READ");
|
||||
} else {
|
||||
(void)strcpy_s(dir, 16, "WRITE");
|
||||
(void)strcpy_s(dir, 16U, "WRITE");
|
||||
}
|
||||
*addr = req->reqs.pio_request.address;
|
||||
*val = req->reqs.pio_request.value;
|
||||
break;
|
||||
case REQ_MMIO:
|
||||
case REQ_WP:
|
||||
(void)strcpy_s(type, 16, "MMIO/WP");
|
||||
(void)strcpy_s(type, 16U, "MMIO/WP");
|
||||
if (req->reqs.mmio_request.direction == REQUEST_READ) {
|
||||
(void)strcpy_s(dir, 16, "READ");
|
||||
(void)strcpy_s(dir, 16U, "READ");
|
||||
} else {
|
||||
(void)strcpy_s(dir, 16, "WRITE");
|
||||
(void)strcpy_s(dir, 16U, "WRITE");
|
||||
}
|
||||
*addr = req->reqs.mmio_request.address;
|
||||
*val = req->reqs.mmio_request.value;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
(void)strcpy_s(type, 16, "UNKNOWN");
|
||||
(void)strcpy_s(type, 16U, "UNKNOWN");
|
||||
}
|
||||
|
||||
switch (req->processed) {
|
||||
case REQ_STATE_SUCCESS:
|
||||
(void)strcpy_s(state, 16, "SUCCESS");
|
||||
(void)strcpy_s(state, 16U, "SUCCESS");
|
||||
break;
|
||||
case REQ_STATE_PENDING:
|
||||
(void)strcpy_s(state, 16, "PENDING");
|
||||
(void)strcpy_s(state, 16U, "PENDING");
|
||||
break;
|
||||
case REQ_STATE_PROCESSING:
|
||||
(void)strcpy_s(state, 16, "PROCESS");
|
||||
(void)strcpy_s(state, 16U, "PROCESS");
|
||||
break;
|
||||
case REQ_STATE_FAILED:
|
||||
(void)strcpy_s(state, 16, "FAILED");
|
||||
(void)strcpy_s(state, 16U, "FAILED");
|
||||
break;
|
||||
default:
|
||||
(void)strcpy_s(state, 16, "UNKNOWN");
|
||||
(void)strcpy_s(state, 16U, "UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ static uint64_t create_zero_page(struct vm *vm)
|
||||
zeropage = (struct zero_page *)((char *)hva + MEM_4K);
|
||||
|
||||
/* clear the zeropage */
|
||||
(void)memset(zeropage, 0, MEM_2K);
|
||||
(void)memset(zeropage, 0U, MEM_2K);
|
||||
|
||||
/* copy part of the header into the zero page */
|
||||
hva = GPA2HVA(vm, (uint64_t)vm->sw.kernel_info.kernel_load_addr);
|
||||
@@ -122,7 +122,7 @@ 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 + 1U) * 512U;
|
||||
kernel_entry_offset = (uint32_t)(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 += 512U;
|
||||
@@ -193,7 +193,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
reserving_1g_pages);
|
||||
(void)strcpy_s((char *)hva
|
||||
+vm->sw.linux_info.bootargs_size,
|
||||
100, dyn_bootargs);
|
||||
100U, dyn_bootargs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user