Skip to content

Commit a65f35c

Browse files
rchatreawilliam
authored andcommitted
vfio/pci: Consolidate irq cleanup on MSI/MSI-X disable
vfio_msi_disable() releases all previously allocated state associated with each interrupt before disabling MSI/MSI-X. vfio_msi_disable() iterates twice over the interrupt state: first directly with a for loop to do virqfd cleanup, followed by another for loop within vfio_msi_set_block() that removes the interrupt handler and its associated state using vfio_msi_set_vector_signal(). Simplify interrupt cleanup by iterating over allocated interrupts once. Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/837acb8cbe86a258a50da05e56a1f17c1a19abbe.1683740667.git.reinette.chatre@intel.com Signed-off-by: Alex Williamson <[email protected]>
1 parent 912b625 commit a65f35c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/vfio/pci/vfio_pci_intrs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,9 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
426426
for (i = 0; i < vdev->num_ctx; i++) {
427427
vfio_virqfd_disable(&vdev->ctx[i].unmask);
428428
vfio_virqfd_disable(&vdev->ctx[i].mask);
429+
vfio_msi_set_vector_signal(vdev, i, -1, msix);
429430
}
430431

431-
vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
432-
433432
cmd = vfio_pci_memory_lock_and_enable(vdev);
434433
pci_free_irq_vectors(pdev);
435434
vfio_pci_memory_unlock_and_restore(vdev, cmd);

0 commit comments

Comments
 (0)