Skip to content

Commit 98c49c7

Browse files
Shawnshhlijinxia
authored andcommitted
HV:guest:add suffix U to the numeric constant
Add suffix U to the numeric constant Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent b74358d commit 98c49c7

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

hypervisor/arch/x86/guest/instr_emul.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ emulate_movs(struct vcpu *vcpu, __unused uint64_t gpa, struct vie *vie,
691691
* The count register is %rcx, %ecx or %cx depending on the
692692
* address size of the instruction.
693693
*/
694-
if ((rcx & vie_size2mask(vie->addrsize)) == 0) {
694+
if ((rcx & vie_size2mask(vie->addrsize)) == 0UL) {
695695
error = 0;
696696
goto done;
697697
}
@@ -745,7 +745,7 @@ emulate_movs(struct vcpu *vcpu, __unused uint64_t gpa, struct vie *vie,
745745
/*
746746
* Repeat the instruction if the count register is not zero.
747747
*/
748-
if ((rcx & vie_size2mask(vie->addrsize)) != 0)
748+
if ((rcx & vie_size2mask(vie->addrsize)) != 0UL)
749749
VCPU_RETAIN_RIP(vcpu);
750750
}
751751
done:
@@ -763,7 +763,7 @@ emulate_stos(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
763763
uint64_t val;
764764
uint64_t rcx, rdi, rflags;
765765

766-
opsize = (vie->op.op_byte == 0xAA) ? 1 : vie->opsize;
766+
opsize = (vie->op.op_byte == 0xAAU) ? 1 : vie->opsize;
767767
repeat = vie->repz_present | vie->repnz_present;
768768

769769
if (repeat != 0) {

hypervisor/arch/x86/guest/vioapic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ vioapic_read(struct vioapic *vioapic, uint32_t addr)
244244
(regnum < IOAPIC_REDTBL + vioapic_pincount(vioapic->vm) * 2) != 0) {
245245
pin = (regnum - IOAPIC_REDTBL) / 2;
246246
if (((regnum - IOAPIC_REDTBL) % 2) != 0)
247-
rshift = 32;
247+
rshift = 32U;
248248
else
249-
rshift = 0;
249+
rshift = 0U;
250250

251251
return vioapic->rtbl[pin].reg >> rshift;
252252
}
@@ -427,7 +427,7 @@ vioapic_mmio_rw(struct vioapic *vioapic, uint64_t gpa,
427427
if (size != 4 || (offset != IOREGSEL && offset != IOWIN &&
428428
offset != IOEOI)) {
429429
if (doread)
430-
*data = 0;
430+
*data = 0UL;
431431
return 0;
432432
}
433433

@@ -581,7 +581,7 @@ int vioapic_mmio_access_handler(struct vcpu *vcpu, struct mem_io *mmio,
581581
int ret = 0;
582582

583583
/* Note all RW to IOAPIC are 32-Bit in size */
584-
ASSERT(mmio->access_size == 4,
584+
ASSERT(mmio->access_size == 4U,
585585
"All RW to LAPIC must be 32-bits in size");
586586

587587
if (mmio->read_write == HV_MEM_IO_READ) {
@@ -637,7 +637,7 @@ void get_vioapic_info(char *str, int str_max, int vmid)
637637
size -= len;
638638
str += len;
639639

640-
rte = 0;
640+
rte = 0UL;
641641
for (pin = 0 ; pin < vioapic_pincount(vm); pin++) {
642642
vioapic_get_rte(vm, pin, (void *)&rte);
643643
low = rte;

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ static void vlapic_reset_timer(struct vlapic *vlapic)
279279
timer = &vlapic->vlapic_timer.timer;
280280
del_timer(timer);
281281
timer->mode = 0;
282-
timer->fire_tsc = 0;
283-
timer->period_in_cycle = 0;
282+
timer->fire_tsc = 0UL;
283+
timer->period_in_cycle = 0UL;
284284
}
285285

286286
static bool
@@ -296,7 +296,7 @@ set_expiration(struct vlapic *vlapic)
296296
tmicr = vlapic_timer->tmicr;
297297
divisor_shift = vlapic_timer->divisor_shift;
298298

299-
if (!tmicr || divisor_shift > 8)
299+
if (!tmicr || divisor_shift > 8U)
300300
return false;
301301

302302
delta = tmicr << divisor_shift;
@@ -325,8 +325,8 @@ static void vlapic_update_lvtt(struct vlapic *vlapic,
325325
del_timer(timer);
326326
timer->mode = (timer_mode == APIC_LVTT_TM_PERIODIC) ?
327327
TICK_MODE_PERIODIC: TICK_MODE_ONESHOT;
328-
timer->fire_tsc = 0;
329-
timer->period_in_cycle = 0;
328+
timer->fire_tsc = 0UL;
329+
timer->period_in_cycle = 0UL;
330330

331331
vlapic_timer->mode = timer_mode;
332332
}
@@ -385,7 +385,7 @@ static uint64_t vlapic_get_tsc_deadline_msr(struct vlapic *vlapic)
385385
if (!vlapic_lvtt_tsc_deadline(vlapic))
386386
return 0;
387387

388-
return (vlapic->vlapic_timer.timer.fire_tsc == 0) ? 0 :
388+
return (vlapic->vlapic_timer.timer.fire_tsc == 0UL) ? 0UL :
389389
vlapic->vcpu->guest_msrs[IDX_TSC_DEADLINE];
390390

391391
}
@@ -412,7 +412,7 @@ static void vlapic_set_tsc_deadline_msr(struct vlapic *vlapic,
412412

413413
add_timer(timer);
414414
} else
415-
timer->fire_tsc = 0;
415+
timer->fire_tsc = 0UL;
416416
}
417417

418418
static void
@@ -422,7 +422,7 @@ vlapic_esr_write_handler(struct vlapic *vlapic)
422422

423423
lapic = vlapic->apic_page;
424424
lapic->esr = vlapic->esr_pending;
425-
vlapic->esr_pending = 0;
425+
vlapic->esr_pending = 0U;
426426
}
427427

428428
/*
@@ -652,7 +652,7 @@ vlapic_fire_lvt(struct vlapic *vlapic, uint32_t lvt)
652652

653653
switch (mode) {
654654
case APIC_LVT_DM_FIXED:
655-
if (vec < 16) {
655+
if (vec < 16U) {
656656
vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR);
657657
return 0;
658658
}
@@ -876,7 +876,7 @@ vlapic_calcdest(struct vm *vm, uint64_t *dmask, uint32_t dest,
876876
uint64_t amask;
877877
uint16_t vcpu_id;
878878

879-
if (dest == 0xff) {
879+
if (dest == 0xffU) {
880880
/*
881881
* Broadcast in both logical and physical modes.
882882
*/
@@ -888,7 +888,7 @@ vlapic_calcdest(struct vm *vm, uint64_t *dmask, uint32_t dest,
888888
/*
889889
* Physical mode: destination is LAPIC ID.
890890
*/
891-
*dmask = 0;
891+
*dmask = 0UL;
892892
vcpu_id = vm_apicid2vcpu_id(vm, dest);
893893
if (vcpu_id < phys_cpu_num)
894894
bitmap_set(vcpu_id, dmask);
@@ -910,7 +910,7 @@ vlapic_calcdest(struct vm *vm, uint64_t *dmask, uint32_t dest,
910910
* Logical mode: match each APIC that has a bit set
911911
* in its LDR that matches a bit in the ldest.
912912
*/
913-
*dmask = 0;
913+
*dmask = 0UL;
914914
amask = vm_active_cpus(vm);
915915
while ((vcpu_id = ffs64(amask)) != INVALID_BIT_INDEX) {
916916
bitmap_clear(vcpu_id, &amask);
@@ -995,7 +995,7 @@ vlapic_set_cr8(struct vlapic *vlapic, uint64_t val)
995995
uint8_t tpr;
996996

997997
if ((val & ~0xfUL) != 0U) {
998-
vcpu_inject_gp(vlapic->vcpu, 0);
998+
vcpu_inject_gp(vlapic->vcpu, 0U);
999999
return;
10001000
}
10011001

@@ -1030,10 +1030,10 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic)
10301030
dest = icrval >> (32 + 24);
10311031
vec = icrval & APIC_VECTOR_MASK;
10321032
mode = icrval & APIC_DELMODE_MASK;
1033-
phys = ((icrval & APIC_DESTMODE_LOG) == 0);
1033+
phys = ((icrval & APIC_DESTMODE_LOG) == 0UL);
10341034
shorthand = icrval & APIC_DEST_MASK;
10351035

1036-
if (mode == APIC_DELMODE_FIXED && vec < 16) {
1036+
if (mode == APIC_DELMODE_FIXED && vec < 16U) {
10371037
vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR);
10381038
dev_dbg(ACRN_DBG_LAPIC, "Ignoring invalid IPI %d", vec);
10391039
return 0;
@@ -1248,12 +1248,12 @@ vlapic_read(struct vlapic *vlapic, int mmio_access, uint64_t offset,
12481248
dev_dbg(ACRN_DBG_LAPIC,
12491249
"x2APIC MSR read from offset %#lx in xAPIC mode",
12501250
offset);
1251-
*data = 0;
1251+
*data = 0UL;
12521252
goto done;
12531253
}
12541254

12551255
if (offset > sizeof(*lapic)) {
1256-
*data = 0;
1256+
*data = 0UL;
12571257
goto done;
12581258
}
12591259

@@ -1346,7 +1346,7 @@ vlapic_read(struct vlapic *vlapic, int mmio_access, uint64_t offset,
13461346
case APIC_OFFSET_TIMER_ICR:
13471347
/* if TSCDEADLINE mode always return 0*/
13481348
if (vlapic_lvtt_tsc_deadline(vlapic))
1349-
*data = 0;
1349+
*data = 0UL;
13501350
else
13511351
*data = lapic->icr_timer;
13521352
break;
@@ -1360,11 +1360,11 @@ vlapic_read(struct vlapic *vlapic, int mmio_access, uint64_t offset,
13601360
/*
13611361
* XXX generate a GP fault if vlapic is in x2apic mode
13621362
*/
1363-
*data = 0;
1363+
*data = 0UL;
13641364
break;
13651365
case APIC_OFFSET_RRR:
13661366
default:
1367-
*data = 0;
1367+
*data = 0UL;
13681368
break;
13691369
}
13701370
done:

hypervisor/arch/x86/guest/vmsr.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ void disable_msr_interception(uint8_t *bitmap, uint32_t msr)
5757
uint8_t *write_map;
5858
uint8_t value;
5959
/* low MSR */
60-
if (msr < 0x1FFF) {
60+
if (msr < 0x1FFFU) {
6161
read_map = bitmap;
6262
write_map = bitmap + 2048;
63-
} else if ((msr >= 0xc0000000) && (msr <= 0xc0001fff)) {
63+
} else if ((msr >= 0xc0000000U) && (msr <= 0xc0001fffU)) {
6464
read_map = bitmap + 1024;
6565
write_map = bitmap + 3072;
6666
} else {
@@ -177,7 +177,7 @@ int rdmsr_vmexit_handler(struct vcpu *vcpu)
177177
#ifdef CONFIG_MTRR_ENABLED
178178
v = mtrr_rdmsr(vcpu, msr);
179179
#else
180-
vcpu_inject_gp(vcpu, 0);
180+
vcpu_inject_gp(vcpu, 0U);
181181
#endif
182182
break;
183183
}
@@ -232,7 +232,7 @@ int rdmsr_vmexit_handler(struct vcpu *vcpu)
232232
msr <= MSR_IA32_VMX_TRUE_ENTRY_CTLS))) {
233233
pr_warn("rdmsr: %lx should not come here!", msr);
234234
}
235-
vcpu_inject_gp(vcpu, 0);
235+
vcpu_inject_gp(vcpu, 0U);
236236
v = 0UL;
237237
break;
238238
}
@@ -293,13 +293,13 @@ int wrmsr_vmexit_handler(struct vcpu *vcpu)
293293
#ifdef CONFIG_MTRR_ENABLED
294294
mtrr_wrmsr(vcpu, msr, v);
295295
#else
296-
vcpu_inject_gp(vcpu, 0);
296+
vcpu_inject_gp(vcpu, 0U);
297297
#endif
298298
break;
299299
}
300300
case MSR_IA32_MTRR_CAP:
301301
{
302-
vcpu_inject_gp(vcpu, 0);
302+
vcpu_inject_gp(vcpu, 0U);
303303
break;
304304
}
305305
case MSR_IA32_BIOS_SIGN_ID:
@@ -366,7 +366,7 @@ int wrmsr_vmexit_handler(struct vcpu *vcpu)
366366
msr <= MSR_IA32_VMX_TRUE_ENTRY_CTLS))) {
367367
pr_warn("rdmsr: %lx should not come here!", msr);
368368
}
369-
vcpu_inject_gp(vcpu, 0);
369+
vcpu_inject_gp(vcpu, 0U);
370370
break;
371371
}
372372
}

0 commit comments

Comments
 (0)