mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: pugs@cisco.com
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	kvm@vger.kernel.org, alex.williamson@redhat.com
Subject: [PATCH] vfio: Fix PCI 2.3 shared interrupt
Date: Wed, 03 Nov 2010 14:17:33 -0600	[thread overview]
Message-ID: <20101103201732.7400.28058.stgit@s20.home> (raw)

Trying to be too clever with setting the irq_disabled flag.  PCI 2.3
disabled devices can still share IRQs, which can lead to clearing
the irq_disabled flag, preventing the EOI from registering, and leaving
the device without interrupts.  Interrupt handler should only ever
set irq_disabled and we can exit earlier to avoid the config space
access if we know we're disabled.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 drivers/vfio/vfio_intrs.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/vfio/vfio_intrs.c b/drivers/vfio/vfio_intrs.c
index 604082c..73e3deb 100644
--- a/drivers/vfio/vfio_intrs.c
+++ b/drivers/vfio/vfio_intrs.c
@@ -57,6 +57,12 @@ irqreturn_t vfio_interrupt(int irq, void *dev_id)
 
 	spin_lock_irq(&vdev->irqlock);
 
+	/* INTX disabled interrupts can still be shared */
+	if (vdev->irq_disabled) {
+		spin_unlock_irq(&vdev->irqlock);
+		return ret;
+	}
+
 	if (vdev->pci_2_3) {
 		pci_block_user_cfg_access(pdev);
 
@@ -87,7 +93,8 @@ done:
 		ret = IRQ_HANDLED;
 	}
 
-	vdev->irq_disabled = (ret == IRQ_HANDLED);
+	if (ret == IRQ_HANDLED)
+		vdev->irq_disabled = true;
 
 	spin_unlock_irq(&vdev->irqlock);
 


             reply	other threads:[~2010-11-03 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 20:17 Alex Williamson [this message]
2010-11-03 21:03 ` Tom Lyon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101103201732.7400.28058.stgit@s20.home \
    --to=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pugs@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®