diff options
author | Felipe Franciosi <felipe@nutanix.com> | 2019-10-03 17:54:18 +0100 |
---|---|---|
committer | Felipe Franciosi <felipe@nutanix.com> | 2019-10-03 17:54:56 +0100 |
commit | 203d8e99852db1d30840c940ead1f23f3b6985dd (patch) | |
tree | ded3c1b0d1dc61365a6a22452bc7bc71074af1a2 | |
parent | 9e73c73ac9adc6ee49632ef8be2bf8d987087912 (diff) | |
download | libvfio-user-203d8e99852db1d30840c940ead1f23f3b6985dd.zip libvfio-user-203d8e99852db1d30840c940ead1f23f3b6985dd.tar.gz libvfio-user-203d8e99852db1d30840c940ead1f23f3b6985dd.tar.bz2 |
Minor alignment fixes
-rw-r--r-- | kmod/muser.c | 13 | ||||
-rw-r--r-- | lib/libmuser.c | 14 |
2 files changed, 15 insertions, 12 deletions
diff --git a/kmod/muser.c b/kmod/muser.c index b0c997c..f0b4700 100644 --- a/kmod/muser.c +++ b/kmod/muser.c @@ -884,11 +884,10 @@ int muser_open(struct mdev_device *mdev) muser_dbg("failed to register notifier: %d", err); err2 = dma_unmap_all(mudev, false); if (unlikely(err2)) - muser_dbg("failed to DMA unmap all regions: %d", - err2); - err2 = - vfio_unregister_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, - &mudev->iommu_notifier); + muser_dbg("failed to DMA unmap all regions: %d", err2); + err2 = vfio_unregister_notifier(mdev_dev(mdev), + VFIO_IOMMU_NOTIFY, + &mudev->iommu_notifier); if (unlikely(err2)) muser_info("failed to unregister notifier: %d", err); @@ -906,7 +905,7 @@ static int dma_unmap_all(struct muser_dev *mudev, bool skip_user) mutex_lock(&mudev->dev_lock); while (!list_empty(&mudev->dma_list)) { dma_map = list_first_entry(&mudev->dma_list, - struct vfio_dma_mapping, entry); + struct vfio_dma_mapping, entry); list_move(&dma_map->entry, &head); } mutex_unlock(&mudev->dev_lock); @@ -915,7 +914,7 @@ static int dma_unmap_all(struct muser_dev *mudev, bool skip_user) int err; dma_map = list_first_entry(&head, struct vfio_dma_mapping, - entry); + entry); list_del(&dma_map->entry); if (!skip_user) { err = muser_process_dma_unmap(mudev, dma_map); diff --git a/lib/libmuser.c b/lib/libmuser.c index b0165ce..df4ac91 100644 --- a/lib/libmuser.c +++ b/lib/libmuser.c @@ -708,10 +708,12 @@ do_access(lm_ctx_t * const lm_ctx, char * const buf, size_t count, loff_t pos, lm_log(lm_ctx, LM_ERR, "bad region %d\n", idx); return -EINVAL; } + if (idx == LM_DEV_CFG_REG_IDX) { return handle_pci_config_space_access(lm_ctx, buf, count, offset, is_write, pci_info->reg_info[idx].fn); } + /* * Checking whether a callback exists might sound expensive however this * code is not performance critical. This works well when we don't expect a @@ -1152,8 +1154,7 @@ lm_ctx_create(lm_dev_info_t * const dev_info) memcpy(&lm_ctx->pci_info, &dev_info->pci_info, sizeof(lm_pci_info_t)); if (!memcmp(&lm_ctx->pci_info.reg_info[LM_DEV_CFG_REG_IDX], &zero_reg_info, - sizeof zero_reg_info)) - { + sizeof zero_reg_info)) { static const lm_reg_info_t default_cfg_reg_info = { .flags = LM_REG_FLAG_RW, .size = PCI_CFG_SPACE_SIZE, @@ -1194,9 +1195,12 @@ lm_ctx_create(lm_dev_info_t * const dev_info) goto out; } - init_pci_hdr(&lm_ctx->pci_config_space->hdr, &dev_info->pci_info.id, - &dev_info->pci_info.cc, &dev_info->pci_info.ss, - dev_info->pci_info.irq_count[LM_DEV_INTX_IRQ_IDX]); + init_pci_hdr(&lm_ctx->pci_config_space->hdr, + &dev_info->pci_info.id, + &dev_info->pci_info.cc, + &dev_info->pci_info.ss, + dev_info->pci_info.irq_count[LM_DEV_INTX_IRQ_IDX]); + for (i = 0; i < ARRAY_SIZE(lm_ctx->pci_config_space->hdr.bars); i++) { if ((dev_info->pci_info.reg_info[i].flags & LM_REG_FLAG_MEM) == 0) { lm_ctx->pci_config_space->hdr.bars[i].io.region_type |= 0x1; |