[PATCH 05/17] vfio/pci: Limit eventfd signaling to interrupt management code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VFIO PCI interrupt management has full support for configuring,
signaling, and clearing the eventfds associated with device request
notification and error interrupts.

Core VFIO PCI duplicates eventfd signaling while also accessing
data that should be contained within the interrupt management code.

Remove the duplicate eventfd signaling from core VFIO PCI
and rely on VFIO PCI interrupt management for eventfd signaling.

Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
---
 drivers/vfio/pci/vfio_pci_core.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index de097174e455..a8235b9c1a81 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1868,21 +1868,20 @@ void vfio_pci_core_request(struct vfio_device *core_vdev, unsigned int count)
 	struct vfio_pci_core_device *vdev =
 		container_of(core_vdev, struct vfio_pci_core_device, vdev);
 	struct pci_dev *pdev = vdev->pdev;
+	int ret;
 
-	mutex_lock(&vdev->igate);
+	ret = vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE |
+				      VFIO_IRQ_SET_ACTION_TRIGGER,
+				      VFIO_PCI_REQ_IRQ_INDEX, 0, 1, NULL);
 
-	if (vdev->req_trigger) {
-		if (!(count % 10))
-			pci_notice_ratelimited(pdev,
-				"Relaying device request to user (#%u)\n",
-				count);
-		eventfd_signal(vdev->req_trigger);
-	} else if (count == 0) {
+	if (!ret && !(count % 10)) {
+		pci_notice_ratelimited(pdev,
+				       "Relaying device request to user (#%u)\n",
+				       count);
+	} else if (ret && count == 0) {
 		pci_warn(pdev,
-			"No device request channel registered, blocked until released by user\n");
+			 "No device request channel registered, blocked until released by user\n");
 	}
-
-	mutex_unlock(&vdev->igate);
 }
 EXPORT_SYMBOL_GPL(vfio_pci_core_request);
 
@@ -2292,12 +2291,9 @@ pci_ers_result_t vfio_pci_core_aer_err_detected(struct pci_dev *pdev,
 {
 	struct vfio_pci_core_device *vdev = dev_get_drvdata(&pdev->dev);
 
-	mutex_lock(&vdev->igate);
-
-	if (vdev->err_trigger)
-		eventfd_signal(vdev->err_trigger);
-
-	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, 1, NULL);
 
 	return PCI_ERS_RESULT_CAN_RECOVER;
 }
-- 
2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux