diff --git a/hypervisor/arch/x86/guest/guest.c b/hypervisor/arch/x86/guest/guest.c index 894469a62..0af73aa5f 100644 --- a/hypervisor/arch/x86/guest/guest.c +++ b/hypervisor/arch/x86/guest/guest.c @@ -146,7 +146,7 @@ static int _gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_info, int ret = 0; int fault = 0; - if (pw_info->level < 1) { + if (pw_info->level < 1U) { return -EINVAL; } @@ -198,7 +198,7 @@ static int _gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_info, fault = 1; } - if (pw_info->pse && (i > 0 && ((entry & MMU_32BIT_PDE_PS) != 0U))) { + if (pw_info->pse && (i > 0U && ((entry & MMU_32BIT_PDE_PS) != 0U))) { break; } addr = entry; diff --git a/hypervisor/arch/x86/guest/instr_emul.c b/hypervisor/arch/x86/guest/instr_emul.c index 7c612b43e..cb7331cac 100644 --- a/hypervisor/arch/x86/guest/instr_emul.c +++ b/hypervisor/arch/x86/guest/instr_emul.c @@ -1435,7 +1435,7 @@ emulate_bittest(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, { uint64_t val, rflags, bitmask; int error; - uint32_t bitoff; + uint64_t bitoff; uint8_t size; /* @@ -1602,7 +1602,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum cpu_reg_name seg, "%s: invalid segment %d", __func__, seg); ASSERT(length == 1U || length == 2U || length == 4U || length == 8U, "%s: invalid operand size %hhu", __func__, length); - ASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0, + ASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0U, "%s: invalid prot %#x", __func__, prot); firstoff = offset; diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index a791a7930..7e2d44df9 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -270,7 +270,7 @@ int start_vm(struct vm *vm) vm->state = VM_STARTED; /* Only start BSP (vid = 0) and let BSP start other APs */ - vcpu = vcpu_from_vid(vm, 0); + vcpu = vcpu_from_vid(vm, 0U); ASSERT(vcpu != NULL, "vm%d, vcpu0", vm->attr.id); schedule_vcpu(vcpu); diff --git a/hypervisor/arch/x86/guest/vpic.c b/hypervisor/arch/x86/guest/vpic.c index efa2a73b9..4dd0c6e36 100644 --- a/hypervisor/arch/x86/guest/vpic.c +++ b/hypervisor/arch/x86/guest/vpic.c @@ -37,7 +37,7 @@ #define vm_pic(vm) (vm->vpic) -#define ACRN_DBG_PIC 6 +#define ACRN_DBG_PIC 6U enum irqstate { IRQSTATE_ASSERT, @@ -232,7 +232,7 @@ static void vpic_notify_intr(struct vpic *vpic) */ pic->intr_raised = true; if (vpic->vm->vpic_wire_mode == VPIC_WIRE_INTR) { - struct vcpu *vcpu = vcpu_from_vid(vpic->vm, 0); + struct vcpu *vcpu = vcpu_from_vid(vpic->vm, 0U); ASSERT(vcpu != NULL, "vm%d, vcpu0", vpic->vm->attr.id); vcpu_inject_extint(vcpu); @@ -423,7 +423,7 @@ static int vpic_ocw2(struct vpic *vpic, struct pic *pic, uint8_t val) /* if level ack PTDEV */ if ((pic->elc & (1U << (isr_bit & 0x7U))) != 0U) { ptdev_intx_ack(vpic->vm, - master_pic(vpic, pic) ? isr_bit : isr_bit + 8U, + (master_pic(vpic, pic) ? isr_bit : isr_bit + 8U), PTDEV_VPIN_PIC); } } else if ((val & OCW2_SL) != 0U && pic->rotate) { diff --git a/hypervisor/bsp/include/bsp_extern.h b/hypervisor/bsp/include/bsp_extern.h index 32de8ffab..691ba8caa 100644 --- a/hypervisor/bsp/include/bsp_extern.h +++ b/hypervisor/bsp/include/bsp_extern.h @@ -19,6 +19,14 @@ #define BSP_EXTERN_H #define UOS_DEFAULT_START_ADDR (0x100000000UL) + +struct acpi_info { + uint8_t x86_family; + uint8_t x86_model; + struct pm_s_state_data pm_s_state; + /* TODO: we can add more acpi info field here if needed. */ +}; + /**********************************/ /* EXTERNAL VARIABLES */ /**********************************/ diff --git a/hypervisor/bsp/uefi/platform_acpi_info.c b/hypervisor/bsp/uefi/platform_acpi_info.c index 51d259d5d..60bc0a02d 100644 --- a/hypervisor/bsp/uefi/platform_acpi_info.c +++ b/hypervisor/bsp/uefi/platform_acpi_info.c @@ -11,8 +11,8 @@ #include const struct acpi_info host_acpi_info = { - -1, /* x86 family */ - -1, /* x86 model */ + 0, /* x86 family */ + 0, /* x86 model */ { {SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1a EVT */ {SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b EVT */ diff --git a/hypervisor/include/public/acrn_common.h b/hypervisor/include/public/acrn_common.h index 1491b0e8c..fffafb8f5 100644 --- a/hypervisor/include/public/acrn_common.h +++ b/hypervisor/include/public/acrn_common.h @@ -340,13 +340,6 @@ struct pm_s_state_data { uint64_t *wake_vector_64; }__attribute__((aligned(8))); -struct acpi_info { - int16_t x86_family; - int16_t x86_model; - struct pm_s_state_data pm_s_state; - /* TODO: we can add more acpi info field here if needed. */ -}; - /** * @brief Info PM command from DM/VHM. *