The eventfds associated with device request notification and error IRQ are managed by the VFIO PCI interrupt management code contained in vfio_pci_intrs.c. The VFIO PCI interrupt management code supports acquiring, releasing, as well as signaling of these eventfd. The VFIO PCI core code duplicates the signaling of device request notification and error interrupts and does so by acquiring the lock and accessing data that should ideally be contained within the VFIO PCI interrupt management code. Do not duplicate but instead call existing VFIO PCI interrupt management code to signal device request notification and error interrupts. Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx> --- drivers/vfio/pci/vfio_pci_core.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index d2847ca2f0cb..de097174e455 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -700,16 +700,12 @@ void vfio_pci_core_close_device(struct vfio_device *core_vdev) #endif vfio_pci_core_disable(vdev); - mutex_lock(&vdev->igate); - if (vdev->err_trigger) { - eventfd_ctx_put(vdev->err_trigger); - vdev->err_trigger = NULL; - } - if (vdev->req_trigger) { - eventfd_ctx_put(vdev->req_trigger); - vdev->req_trigger = NULL; - } - mutex_unlock(&vdev->igate); + vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE | + VFIO_IRQ_SET_ACTION_TRIGGER, + VFIO_PCI_ERR_IRQ_INDEX, 0, 0, NULL); + vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE | + VFIO_IRQ_SET_ACTION_TRIGGER, + VFIO_PCI_REQ_IRQ_INDEX, 0, 0, NULL); } EXPORT_SYMBOL_GPL(vfio_pci_core_close_device); -- 2.34.1