[PATCH,v1] vfio/platform: fix incorrect IRQ_NOAUTOEN setting

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

 



The issues happened when the interrupt is a edge
sensitive interrupt, so only set IRQ_NOAUTOEN and
enable irq manually if the interrupt is an level
sensitive interrupt.

Signed-off-by: Rick Song <songwenjun@xxxxxxxxxx>
---
 drivers/vfio/platform/vfio_platform_irq.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c
index 46d4750..a7b4b2e 100644
--- a/drivers/vfio/platform/vfio_platform_irq.c
+++ b/drivers/vfio/platform/vfio_platform_irq.c
@@ -185,7 +185,8 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
 	int ret;
 
 	if (irq->trigger) {
-		irq_clear_status_flags(irq->hwirq, IRQ_NOAUTOEN);
+		if (irq->flags & VFIO_IRQ_INFO_AUTOMASKED)
+			irq_clear_status_flags(irq->hwirq, IRQ_NOAUTOEN);
 		free_irq(irq->hwirq, irq);
 		kfree(irq->name);
 		eventfd_ctx_put(irq->trigger);
@@ -208,7 +209,9 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
 
 	irq->trigger = trigger;
 
-	irq_set_status_flags(irq->hwirq, IRQ_NOAUTOEN);
+	if (irq->flags & VFIO_IRQ_INFO_AUTOMASKED)
+		irq_set_status_flags(irq->hwirq, IRQ_NOAUTOEN);
+
 	ret = request_irq(irq->hwirq, handler, 0, irq->name, irq);
 	if (ret) {
 		kfree(irq->name);
@@ -217,7 +220,7 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
 		return ret;
 	}
 
-	if (!irq->masked)
+	if ((irq->flags & VFIO_IRQ_INFO_AUTOMASKED) && !irq->masked)
 		enable_irq(irq->hwirq);
 
 	return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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