diff options
author | Alexandru Elisei <alexandru.elisei@arm.com> | 2021-10-12 14:25:07 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-10-13 08:36:59 +0100 |
commit | 5f44d5d6e45f72a376ad29dfffe18850276f625b (patch) | |
tree | d3a4690d916325f17d895484d963729aad584eb7 | |
parent | 34bfe5f632a4a82fad197bb0db12d3369ef0f7b2 (diff) | |
download | kvmtool-5f44d5d6e45f72a376ad29dfffe18850276f625b.tar.gz |
vfio/pci: Rename PBA offset in device descriptor to fd_offset
The MSI-X capability defines a PBA offset, which is the offset of the PBA
array in the BAR that holds the array.
kvmtool uses the field "pba_offset" in struct msix_cap (which represents
the MSIX capability) to refer to the [PBA offset:BAR] field of the
capability; and the field "offset" in the struct vfio_pci_msix_pba to refer
to offset of the PBA array in the device descriptor created by the VFIO
driver.
As we're getting ready to add yet another field that represents an offset
to struct vfio_pci_msix_pba, try to avoid ambiguities by renaming the
struct's "offset" field to "fd_offset".
No functional change intended.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20211012132510.42134-5-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | include/kvm/vfio.h | 2 | ||||
-rw-r--r-- | vfio/pci.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/kvm/vfio.h b/include/kvm/vfio.h index 28223cf2..8cdf04fc 100644 --- a/include/kvm/vfio.h +++ b/include/kvm/vfio.h @@ -48,7 +48,7 @@ struct vfio_pci_msix_table { struct vfio_pci_msix_pba { size_t size; - off_t offset; /* in VFIO device fd */ + off_t fd_offset; /* in VFIO device fd */ unsigned int bar; u32 guest_phys_addr; }; @@ -256,7 +256,7 @@ static void vfio_pci_msix_pba_access(struct kvm_cpu *vcpu, u64 addr, u8 *data, * TODO: emulate PBA. Hardware MSI-X is never masked, so reading the PBA * is completely useless here. Note that Linux doesn't use PBA. */ - if (pread(vdev->fd, data, len, pba->offset + offset) != (ssize_t)len) + if (pread(vdev->fd, data, len, pba->fd_offset + offset) != (ssize_t)len) vfio_dev_err(vdev, "cannot access MSIX PBA\n"); } @@ -815,8 +815,8 @@ static int vfio_pci_fixup_cfg_space(struct vfio_device *vdev) if (msix) { /* Add a shortcut to the PBA region for the MMIO handler */ int pba_index = VFIO_PCI_BAR0_REGION_INDEX + pdev->msix_pba.bar; - pdev->msix_pba.offset = vdev->regions[pba_index].info.offset + - (msix->pba_offset & PCI_MSIX_PBA_OFFSET); + pdev->msix_pba.fd_offset = vdev->regions[pba_index].info.offset + + (msix->pba_offset & PCI_MSIX_PBA_OFFSET); /* Tidy up the capability */ msix->table_offset &= PCI_MSIX_TABLE_BIR; |