Skip to content

Commit 112b5b8

Browse files
junjiemao1lijinxia
authored andcommitted
HV: guest: cleanup of remaining integral type violations
Clean up most reported integral-type-related violations still existing under arch/x86/guest/. The remaining reports that are not trivial to suppress will be explained in separate documents. Also move acpi_info outside acrn_common.h as the structure is no longer shared with DM. v1 -> v2: * Move struct acpi_info to bsp_extern.h Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 1a1ee93 commit 112b5b8

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

hypervisor/arch/x86/guest/guest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int _gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_info,
146146
int ret = 0;
147147
int fault = 0;
148148

149-
if (pw_info->level < 1) {
149+
if (pw_info->level < 1U) {
150150
return -EINVAL;
151151
}
152152

@@ -198,7 +198,7 @@ static int _gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_info,
198198
fault = 1;
199199
}
200200

201-
if (pw_info->pse && (i > 0 && ((entry & MMU_32BIT_PDE_PS) != 0U))) {
201+
if (pw_info->pse && (i > 0U && ((entry & MMU_32BIT_PDE_PS) != 0U))) {
202202
break;
203203
}
204204
addr = entry;

hypervisor/arch/x86/guest/instr_emul.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ emulate_bittest(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
14351435
{
14361436
uint64_t val, rflags, bitmask;
14371437
int error;
1438-
uint32_t bitoff;
1438+
uint64_t bitoff;
14391439
uint8_t size;
14401440

14411441
/*
@@ -1602,7 +1602,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum cpu_reg_name seg,
16021602
"%s: invalid segment %d", __func__, seg);
16031603
ASSERT(length == 1U || length == 2U || length == 4U || length == 8U,
16041604
"%s: invalid operand size %hhu", __func__, length);
1605-
ASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0,
1605+
ASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0U,
16061606
"%s: invalid prot %#x", __func__, prot);
16071607

16081608
firstoff = offset;

hypervisor/arch/x86/guest/vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ int start_vm(struct vm *vm)
270270
vm->state = VM_STARTED;
271271

272272
/* Only start BSP (vid = 0) and let BSP start other APs */
273-
vcpu = vcpu_from_vid(vm, 0);
273+
vcpu = vcpu_from_vid(vm, 0U);
274274
ASSERT(vcpu != NULL, "vm%d, vcpu0", vm->attr.id);
275275
schedule_vcpu(vcpu);
276276

hypervisor/arch/x86/guest/vpic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
#define vm_pic(vm) (vm->vpic)
3939

40-
#define ACRN_DBG_PIC 6
40+
#define ACRN_DBG_PIC 6U
4141

4242
enum irqstate {
4343
IRQSTATE_ASSERT,
@@ -232,7 +232,7 @@ static void vpic_notify_intr(struct vpic *vpic)
232232
*/
233233
pic->intr_raised = true;
234234
if (vpic->vm->vpic_wire_mode == VPIC_WIRE_INTR) {
235-
struct vcpu *vcpu = vcpu_from_vid(vpic->vm, 0);
235+
struct vcpu *vcpu = vcpu_from_vid(vpic->vm, 0U);
236236

237237
ASSERT(vcpu != NULL, "vm%d, vcpu0", vpic->vm->attr.id);
238238
vcpu_inject_extint(vcpu);
@@ -423,7 +423,7 @@ static int vpic_ocw2(struct vpic *vpic, struct pic *pic, uint8_t val)
423423
/* if level ack PTDEV */
424424
if ((pic->elc & (1U << (isr_bit & 0x7U))) != 0U) {
425425
ptdev_intx_ack(vpic->vm,
426-
master_pic(vpic, pic) ? isr_bit : isr_bit + 8U,
426+
(master_pic(vpic, pic) ? isr_bit : isr_bit + 8U),
427427
PTDEV_VPIN_PIC);
428428
}
429429
} else if ((val & OCW2_SL) != 0U && pic->rotate) {

hypervisor/bsp/include/bsp_extern.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
#define BSP_EXTERN_H
2020

2121
#define UOS_DEFAULT_START_ADDR (0x100000000UL)
22+
23+
struct acpi_info {
24+
uint8_t x86_family;
25+
uint8_t x86_model;
26+
struct pm_s_state_data pm_s_state;
27+
/* TODO: we can add more acpi info field here if needed. */
28+
};
29+
2230
/**********************************/
2331
/* EXTERNAL VARIABLES */
2432
/**********************************/

hypervisor/bsp/uefi/platform_acpi_info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <hypervisor.h>
1212

1313
const struct acpi_info host_acpi_info = {
14-
-1, /* x86 family */
15-
-1, /* x86 model */
14+
0, /* x86 family */
15+
0, /* x86 model */
1616
{
1717
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1a EVT */
1818
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b EVT */

hypervisor/include/public/acrn_common.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,6 @@ struct pm_s_state_data {
340340
uint64_t *wake_vector_64;
341341
}__attribute__((aligned(8)));
342342

343-
struct acpi_info {
344-
int16_t x86_family;
345-
int16_t x86_model;
346-
struct pm_s_state_data pm_s_state;
347-
/* TODO: we can add more acpi info field here if needed. */
348-
};
349-
350343
/**
351344
* @brief Info PM command from DM/VHM.
352345
*

0 commit comments

Comments
 (0)