mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 01:37:44 +00:00
hv: fix 'Expression is not Boolean'
MISRA-C requires that the controlling expression of an if statement or an iteration-statement shall be Boolean type. v1 -> v2: * update the U suffix of constant to let the type of operands to bit operations (&) is the same. * update the type of 'i' from uint64_t to uint16_t in 'profiling_set_control' since it is limited by phys_cpu_num, which is uint16_t. Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -392,7 +392,7 @@ static void ptdev_intr_handle_irq(struct acrn_vm *vm,
|
||||
}
|
||||
|
||||
if (trigger_lvl) {
|
||||
if (entry->polarity) {
|
||||
if (entry->polarity != 0U) {
|
||||
vioapic_set_irq(vm, virt_sid->intx_id.pin,
|
||||
GSI_SET_LOW);
|
||||
} else {
|
||||
@@ -400,7 +400,7 @@ static void ptdev_intr_handle_irq(struct acrn_vm *vm,
|
||||
GSI_SET_HIGH);
|
||||
}
|
||||
} else {
|
||||
if (entry->polarity) {
|
||||
if (entry->polarity != 0U) {
|
||||
vioapic_set_irq(vm, virt_sid->intx_id.pin,
|
||||
GSI_FALLING_PULSE);
|
||||
} else {
|
||||
@@ -503,7 +503,7 @@ void ptdev_intx_ack(struct acrn_vm *vm, uint8_t virt_pin,
|
||||
*/
|
||||
switch (vpin_src) {
|
||||
case PTDEV_VPIN_IOAPIC:
|
||||
if (entry->polarity) {
|
||||
if (entry->polarity != 0U) {
|
||||
vioapic_set_irq(vm, virt_pin, GSI_SET_HIGH);
|
||||
} else {
|
||||
vioapic_set_irq(vm, virt_pin, GSI_SET_LOW);
|
||||
|
@@ -39,7 +39,7 @@ uint64_t vcpumask2pcpumask(struct acrn_vm *vm, uint64_t vdmask)
|
||||
struct acrn_vcpu *vcpu;
|
||||
|
||||
for (vcpu_id = 0U; vcpu_id < vm->hw.created_vcpus; vcpu_id++) {
|
||||
if (vdmask & (1U << vcpu_id)) {
|
||||
if ((vdmask & (1UL << vcpu_id)) != 0UL) {
|
||||
vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||
bitmap_set_lock(vcpu->pcpu_id, &dmask);
|
||||
}
|
||||
|
@@ -1039,7 +1039,7 @@ vlapic_calcdest(struct acrn_vm *vm, uint64_t *dmask, uint32_t dest,
|
||||
*dmask = 0UL;
|
||||
amask = vm_active_cpus(vm);
|
||||
for (vcpu_id = 0U; vcpu_id < vm->hw.created_vcpus; vcpu_id++) {
|
||||
if (amask & (1U << vcpu_id)) {
|
||||
if ((amask & (1UL << vcpu_id)) != 0UL) {
|
||||
vlapic = vm_lapic_from_vcpu_id(vm, vcpu_id);
|
||||
|
||||
if (is_x2apic_enabled(vlapic)){
|
||||
@@ -1281,7 +1281,7 @@ vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic)
|
||||
}
|
||||
|
||||
for (vcpu_id = 0U; vcpu_id < vlapic->vm->hw.created_vcpus; vcpu_id++) {
|
||||
if (dmask & (1U << vcpu_id)) {
|
||||
if ((dmask & (1UL << vcpu_id)) != 0UL) {
|
||||
target_vcpu = vcpu_from_vid(vlapic->vm, vcpu_id);
|
||||
|
||||
if (mode == APIC_DELMODE_FIXED) {
|
||||
@@ -1823,7 +1823,7 @@ vlapic_deliver_intr(struct acrn_vm *vm, bool level, uint32_t dest, bool phys,
|
||||
|
||||
for (vcpu_id = 0U; vcpu_id < vm->hw.created_vcpus; vcpu_id++) {
|
||||
struct acrn_vlapic *vlapic;
|
||||
if (dmask & (1U << vcpu_id)) {
|
||||
if ((dmask & (1UL << vcpu_id)) != 0UL) {
|
||||
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||
|
||||
/* only make request when vlapic enabled */
|
||||
@@ -1986,7 +1986,7 @@ vlapic_set_local_intr(struct acrn_vm *vm, uint16_t vcpu_id_arg, uint32_t vector)
|
||||
}
|
||||
error = 0;
|
||||
for (vcpu_id = 0U; vcpu_id < vm->hw.created_vcpus; vcpu_id++) {
|
||||
if (dmask & (1U << vcpu_id)) {
|
||||
if ((dmask & (1UL << vcpu_id)) != 0UL) {
|
||||
vlapic = vm_lapic_from_vcpu_id(vm, vcpu_id);
|
||||
error = vlapic_trigger_lvt(vlapic, vector);
|
||||
if (error != 0) {
|
||||
|
@@ -363,7 +363,7 @@ int prepare_vm(uint16_t pcpu_id)
|
||||
for (i = 1U; i < vm_desc->vm_hw_num_cores; i++)
|
||||
prepare_vcpu(vm, vm_desc->vm_pcpu_ids[i]);
|
||||
|
||||
if (!vm_sw_loader) {
|
||||
if (vm_sw_loader == NULL) {
|
||||
vm_sw_loader = general_sw_loader;
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ int prepare_vm0(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!vm_sw_loader) {
|
||||
if (vm_sw_loader == NULL) {
|
||||
vm_sw_loader = general_sw_loader;
|
||||
}
|
||||
|
||||
|
@@ -247,8 +247,8 @@ void init_paging(void)
|
||||
/* align to 2MB */
|
||||
high64_max_ram = (e820_mem.mem_top + PDE_SIZE - 1UL) & PDE_MASK;
|
||||
|
||||
if (high64_max_ram > (CONFIG_PLATFORM_RAM_SIZE + PLATFORM_LO_MMIO_SIZE) ||
|
||||
high64_max_ram < (1UL << 32U)) {
|
||||
if ((high64_max_ram > (CONFIG_PLATFORM_RAM_SIZE + PLATFORM_LO_MMIO_SIZE)) ||
|
||||
(high64_max_ram < (1UL << 32U))) {
|
||||
panic("Please configure HV_ADDRESS_SPACE correctly!\n");
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void init_paging(void)
|
||||
if (entry->type == E820_TYPE_RAM) {
|
||||
if (entry->baseaddr < (1UL << 32U)) {
|
||||
uint64_t end = entry->baseaddr + entry->length;
|
||||
if (end < (1UL << 32U) && (end > low32_max_ram)) {
|
||||
if ((end < (1UL << 32U)) && (end > low32_max_ram)) {
|
||||
low32_max_ram = end;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user