[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230418163803.46a96fdc.alex.williamson@redhat.com>
Date: Tue, 18 Apr 2023 16:38:03 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: Reinette Chatre <reinette.chatre@...el.com>
Cc: jgg@...dia.com, yishaih@...dia.com,
shameerali.kolothum.thodi@...wei.com, kevin.tian@...el.com,
tglx@...utronix.de, darwi@...utronix.de, kvm@...r.kernel.org,
dave.jiang@...el.com, jing2.liu@...el.com, ashok.raj@...el.com,
fenghua.yu@...el.com, tom.zanussi@...ux.intel.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 08/10] vfio/pci: Probe and store ability to support
dynamic MSI-X
On Tue, 18 Apr 2023 10:29:19 -0700
Reinette Chatre <reinette.chatre@...el.com> wrote:
> Not all MSI-X devices support dynamic MSI-X allocation. Whether
> a device supports dynamic MSI-X should be queried using
> pci_msix_can_alloc_dyn().
>
> Instead of scattering code with pci_msix_can_alloc_dyn(),
> probe this ability once and store it as a property of the
> virtual device.
>
> Suggested-by: Alex Williamson <alex.williamson@...hat.com>
> Signed-off-by: Reinette Chatre <reinette.chatre@...el.com>
> ---
> Changes since V2:
> - New patch. (Alex)
>
> drivers/vfio/pci/vfio_pci_core.c | 5 ++++-
> include/linux/vfio_pci_core.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index ae0e161c7fc9..a3635a8e54c8 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -530,8 +530,11 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
> vdev->msix_bar = table & PCI_MSIX_TABLE_BIR;
> vdev->msix_offset = table & PCI_MSIX_TABLE_OFFSET;
> vdev->msix_size = ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) * 16;
> - } else
> + vdev->has_dyn_msix = pci_msix_can_alloc_dyn(pdev);
> + } else {
> vdev->msix_bar = 0xFF;
> + vdev->has_dyn_msix = false;
> + }
>
> if (!vfio_vga_disabled() && vfio_pci_is_vga(pdev))
> vdev->has_vga = true;
> diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
> index 148fd1ae6c1c..4f070f2d6fde 100644
> --- a/include/linux/vfio_pci_core.h
> +++ b/include/linux/vfio_pci_core.h
> @@ -67,6 +67,7 @@ struct vfio_pci_core_device {
> u8 msix_bar;
> u16 msix_size;
> u32 msix_offset;
> + bool has_dyn_msix;
> u32 rbar[7];
> bool pci_2_3;
> bool virq_disabled;
Nit, the whole data structure probably needs to be sorted with pahole,
but creating a hole here for locality to other msix fields should
probably be secondary to keeping the structure well packed, which
suggests including this new field among the bools below. Thanks,
Alex
Powered by blists - more mailing lists