* [PATCH] vfio: Fix PCI 2.3 shared interrupt
@ 2010-11-03 20:17 Alex Williamson
2010-11-03 21:03 ` Tom Lyon
0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2010-11-03 20:17 UTC (permalink / raw)
To: pugs; +Cc: linux-kernel, linux-pci, kvm, alex.williamson
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vfio: Fix PCI 2.3 shared interrupt
2010-11-03 20:17 [PATCH] vfio: Fix PCI 2.3 shared interrupt Alex Williamson
@ 2010-11-03 21:03 ` Tom Lyon
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lyon @ 2010-11-03 21:03 UTC (permalink / raw)
To: Alex Williamson; +Cc: linux-kernel, linux-pci, kvm
Applied.
On Wednesday, November 03, 2010 01:17:33 pm Alex Williamson wrote:
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-03 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-03 20:17 [PATCH] vfio: Fix PCI 2.3 shared interrupt Alex Williamson
2010-11-03 21:03 ` Tom Lyon
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®