diff --git a/hypervisor/dm/vpci/core.c b/hypervisor/dm/vpci/core.c index bc023c165..d71c95614 100644 --- a/hypervisor/dm/vpci/core.c +++ b/hypervisor/dm/vpci/core.c @@ -30,7 +30,7 @@ #include #include "pci_priv.h" -inline uint32_t pci_vdev_read_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes) +uint32_t pci_vdev_read_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes) { uint32_t val; @@ -49,7 +49,7 @@ inline uint32_t pci_vdev_read_cfg(struct pci_vdev *vdev, uint32_t offset, uint32 return val; } -inline void pci_vdev_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) +void pci_vdev_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val) { switch (bytes) { case 1U: diff --git a/hypervisor/dm/vpci/msi.c b/hypervisor/dm/vpci/msi.c index ae95df8eb..a94aaf6dd 100644 --- a/hypervisor/dm/vpci/msi.c +++ b/hypervisor/dm/vpci/msi.c @@ -216,7 +216,7 @@ void populate_msi_struct(struct pci_vdev *vdev) static int vmsi_deinit(struct pci_vdev *vdev) { if (vdev->msi.capoff != 0U) { - ptdev_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, 1); + ptdev_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, 1U); } return 0; diff --git a/hypervisor/dm/vpci/msix.c b/hypervisor/dm/vpci/msix.c index 858ef4e29..ac322fed7 100644 --- a/hypervisor/dm/vpci/msix.c +++ b/hypervisor/dm/vpci/msix.c @@ -242,14 +242,14 @@ static int vmsix_table_mmio_access_handler(struct io_request *io_req, void *hand { struct mmio_request *mmio = &io_req->reqs.mmio; struct pci_vdev *vdev; - uint32_t offset; + uint64_t offset; uint64_t hva; vdev = (struct pci_vdev *)handler_private_data; - offset = (uint32_t)(mmio->address - vdev->msix.mmio_gpa); + offset = mmio->address - vdev->msix.mmio_gpa; - if (msixtable_access(vdev, offset)) { - vmsix_table_rw(vdev, mmio, offset); + if (msixtable_access(vdev, (uint32_t)offset)) { + vmsix_table_rw(vdev, mmio, (uint32_t)offset); } else { hva = vdev->msix.mmio_hva + offset; diff --git a/hypervisor/dm/vpci/partition_mode.c b/hypervisor/dm/vpci/partition_mode.c index b01dc7150..c4e72ab41 100644 --- a/hypervisor/dm/vpci/partition_mode.c +++ b/hypervisor/dm/vpci/partition_mode.c @@ -63,7 +63,7 @@ static int partition_mode_vpci_init(struct acrn_vm *vm) vdev->vpci = vpci; if ((vdev->ops != NULL) && (vdev->ops->init != NULL)) { - if (vdev->ops->init(vdev) != 0U) { + if (vdev->ops->init(vdev) != 0) { pr_err("%s() failed at PCI device (bdf %x)!", __func__, vdev->vbdf); } @@ -84,7 +84,7 @@ static void partition_mode_vpci_deinit(struct acrn_vm *vm) for (i = 0; i < vdev_array->num_pci_vdev; i++) { vdev = &vdev_array->vpci_vdev_list[i]; if ((vdev->ops != NULL) && (vdev->ops->deinit != NULL)) { - if (vdev->ops->deinit(vdev) != 0U) { + if (vdev->ops->deinit(vdev) != 0) { pr_err("vdev->ops->deinit failed!"); } } diff --git a/hypervisor/dm/vpci/pci_pt.c b/hypervisor/dm/vpci/pci_pt.c index 3cf3f90cc..538f9dc54 100644 --- a/hypervisor/dm/vpci/pci_pt.c +++ b/hypervisor/dm/vpci/pci_pt.c @@ -41,7 +41,7 @@ static int vdev_pt_init_validate(struct pci_vdev *vdev) { uint32_t idx; - for (idx = 0; idx < (uint32_t)PCI_BAR_COUNT; idx++) { + for (idx = 0U; idx < PCI_BAR_COUNT; idx++) { if ((vdev->bar[idx].base != 0x0UL) || ((vdev->bar[idx].size & 0xFFFUL) != 0x0UL) || ((vdev->bar[idx].type != PCIBAR_MEM32) diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index 372d98938..a9195129b 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -91,10 +91,7 @@ static void pci_cfg_io_write(struct acrn_vm *vm, uint16_t addr, size_t bytes, if (is_cfg_addr(addr)) { /* TODO: handling the non 4 bytes access */ if (bytes == 4U) { - pi->cached_bdf.bits.b = (uint8_t)(val >> 16U) & PCI_BUSMAX; - pi->cached_bdf.bits.d = (uint8_t)(val >> 11U) & PCI_SLOTMAX; - pi->cached_bdf.bits.f = (uint8_t)(val >> 8U) & PCI_FUNCMAX; - + pi->cached_bdf.value = (uint16_t)(val >> 8U); pi->cached_reg = val & PCI_REGMAX; pi->cached_enable = ((val & PCI_CFG_ENABLE) == PCI_CFG_ENABLE); }