From: Andre Przywara <andre.przywara@arm.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: will@kernel.org, julien.thierry.kdev@gmail.com,
kvm@vger.kernel.org, jean-philippe@linaro.org
Subject: Re: [PATCH v1 kvmtool 4/7] vfio/pci: Rename PBA offset in device descriptor to fd_offset
Date: Wed, 6 Oct 2021 16:10:54 +0100 [thread overview]
Message-ID: <20211006161054.66e2fa75@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20210913154413.14322-5-alexandru.elisei@arm.com>
On Mon, 13 Sep 2021 16:44:10 +0100
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> 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.
Makes sense, too many offsets.
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> ---
> include/kvm/vfio.h | 2 +-
> vfio/pci.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/kvm/vfio.h b/include/kvm/vfio.h
> index 28223cf..8cdf04f 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;
> };
> diff --git a/vfio/pci.c b/vfio/pci.c
> index 10ff99e..cc18311 100644
> --- a/vfio/pci.c
> +++ b/vfio/pci.c
> @@ -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;
next prev parent reply other threads:[~2021-10-06 15:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 15:44 [PATCH v1 kvmtool 0/7] vfio/pci: Fix MSIX table and PBA size allocation Alexandru Elisei
2021-09-13 15:44 ` [PATCH v1 kvmtool 1/7] arm/gicv2m: Set errno when gicv2_update_routing() fails Alexandru Elisei
2021-10-06 15:08 ` Andre Przywara
2021-09-13 15:44 ` [PATCH v1 kvmtool 2/7] vfio/pci.c: Remove double include for assert.h Alexandru Elisei
2021-10-06 15:09 ` Andre Przywara
2021-09-13 15:44 ` [PATCH v1 kvmtool 3/7] pci: Fix pci_dev_* print macros Alexandru Elisei
2021-09-14 9:13 ` [RESEND PATCH v1 kvmtool 4/8] vfio/pci: Rename PBA offset in device descriptor to fd_offset Alexandru Elisei
2021-10-06 15:10 ` [PATCH v1 kvmtool 3/7] pci: Fix pci_dev_* print macros Andre Przywara
2021-09-13 15:44 ` [PATCH v1 kvmtool 5/7] vfio/pci: Rework MSIX table and PBA physical size allocation Alexandru Elisei
2021-10-06 15:11 ` Andre Przywara
2021-10-11 14:39 ` Alexandru Elisei
2021-09-13 15:44 ` [PATCH v1 kvmtool 6/7] vfio/pci: Print an error when offset is outside of the MSIX table or PBA Alexandru Elisei
2021-10-06 15:11 ` Andre Przywara
2021-10-11 14:46 ` Alexandru Elisei
2021-09-13 15:44 ` [PATCH v1 kvmtool 7/7] vfio/pci: Align MSIX Table and PBA size allocation to 64k Alexandru Elisei
2021-10-06 15:11 ` Andre Przywara
2021-10-11 14:57 ` Alexandru Elisei
[not found] ` <20210913154413.14322-5-alexandru.elisei@arm.com>
2021-10-06 15:10 ` Andre Przywara [this message]
2021-10-12 8:31 ` [PATCH v1 kvmtool 0/7] vfio/pci: Fix MSIX table and PBA size allocation Will Deacon
2021-10-12 10:50 ` Alexandru Elisei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211006161054.66e2fa75@donnerap.cambridge.arm.com \
--to=andre.przywara@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=jean-philippe@linaro.org \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox