Skip to content

Commit dd27a70

Browse files
rchatreawilliam
authored andcommitted
vfio/pci: Probe and store ability to support dynamic MSI-X
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@redhat.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/f1ae022c060ecb7e527f4f53c8ccafe80768da47.1683740667.git.reinette.chatre@intel.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 9cd0f6d commit dd27a70

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,11 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
530530
vdev->msix_bar = table & PCI_MSIX_TABLE_BIR;
531531
vdev->msix_offset = table & PCI_MSIX_TABLE_OFFSET;
532532
vdev->msix_size = ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) * 16;
533-
} else
533+
vdev->has_dyn_msix = pci_msix_can_alloc_dyn(pdev);
534+
} else {
534535
vdev->msix_bar = 0xFF;
536+
vdev->has_dyn_msix = false;
537+
}
535538

536539
if (!vfio_vga_disabled() && vfio_pci_is_vga(pdev))
537540
vdev->has_vga = true;

include/linux/vfio_pci_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct vfio_pci_core_device {
6868
u16 msix_size;
6969
u32 msix_offset;
7070
u32 rbar[7];
71+
bool has_dyn_msix:1;
7172
bool pci_2_3:1;
7273
bool virq_disabled:1;
7374
bool reset_works:1;

0 commit comments

Comments
 (0)