@@ -83,6 +83,23 @@ done:
return ret;
}
+int vfio_irq_eoi(struct vfio_dev *vdev)
+{
+ struct pci_dev *pdev = vdev->pdev;
+ u16 cmd;
+
+ spin_lock_irq(&vdev->irqlock);
+ pci_block_user_cfg_access(pdev);
+
+ pci_read_config_word(pdev, PCI_COMMAND, &cmd);
+ cmd &= ~PCI_COMMAND_INTX_DISABLE;
+ pci_write_config_word(pdev, PCI_COMMAND, cmd);
+
+ pci_unblock_user_cfg_access(pdev);
+ spin_unlock_irq(&vdev->irqlock);
+ return 0;
+}
+
/*
* MSI and MSI-X Interrupt handler.
* Just signal an event
@@ -464,6 +464,10 @@ static long vfio_unl_ioctl(struct file *filep,
ret = vfio_domain_unset(vdev);
break;
+ case VFIO_IRQ_EOI:
+ ret = vfio_irq_eoi(vdev);
+ break;
+
default:
return -EINVAL;
}
@@ -155,6 +155,7 @@ void vfio_error_resume(struct pci_dev *);
#define VFIO_SUSPEND_REPLY_TIMEOUT (5*HZ)
irqreturn_t vfio_interrupt(int, void *);
+int vfio_irq_eoi(struct vfio_dev *);
#endif /* __KERNEL__ */
@@ -198,6 +199,8 @@ struct vfio_dma_map {
/* Unset the IOMMU domain */
#define VFIO_DOMAIN_UNSET _IO(';', 108)
+/* Re-enable INTx */
+#define VFIO_IRQ_EOI _IO(';', 109)
/*
* Reads, writes, and mmaps determine which PCI BAR (or config space)
* from the high level bits of the file offset