|
|
0a122b |
From 4e1c9f340ef7820e28c55ad286a631cb9e63967a Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
Message-Id: <4e1c9f340ef7820e28c55ad286a631cb9e63967a.1387276076.git.minovotn@redhat.com>
|
|
|
0a122b |
In-Reply-To: <e610718166120379517e80d1a7aa12d60294209b.1387276076.git.minovotn@redhat.com>
|
|
|
0a122b |
References: <e610718166120379517e80d1a7aa12d60294209b.1387276076.git.minovotn@redhat.com>
|
|
|
0a122b |
From: Alex Williamson <alex.williamson@redhat.com>
|
|
|
0a122b |
Date: Mon, 9 Dec 2013 17:48:46 +0100
|
|
|
0a122b |
Subject: [PATCH 06/16] vfio-pci: Release all MSI-X vectors when disabled
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Alex Williamson <alex.williamson@redhat.com>
|
|
|
0a122b |
Message-id: <20131209174830.21963.40720.stgit@bling.home>
|
|
|
0a122b |
Patchwork-id: 56091
|
|
|
0a122b |
O-Subject: [RHEL7 qemu-kvm PATCH] vfio-pci: Release all MSI-X vectors when disabled
|
|
|
0a122b |
Bugzilla: 1029743
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Bandan Das <bsd@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Amos Kong <akong@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1029743
|
|
|
0a122b |
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6696250
|
|
|
0a122b |
Upstream: 3e40ba0faf0822fa78336fe6cd9d677ea9b14f1b
|
|
|
0a122b |
|
|
|
0a122b |
We were relying on msix_unset_vector_notifiers() to release all the
|
|
|
0a122b |
vectors when we disable MSI-X, but this only happens when MSI-X is
|
|
|
0a122b |
still enabled on the device. Perform further cleanup by releasing
|
|
|
0a122b |
any remaining vectors listed as in-use after this call. This caused
|
|
|
0a122b |
a leak of IRQ routes on hotplug depending on how the guest OS prepared
|
|
|
0a122b |
the device for removal.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
0a122b |
Cc: qemu-stable@nongnu.org
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/misc/vfio.c | 12 ++++++++++++
|
|
|
0a122b |
1 file changed, 12 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/misc/vfio.c | 12 ++++++++++++
|
|
|
0a122b |
1 file changed, 12 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
|
|
|
0a122b |
index 5a6925c..250f96f 100644
|
|
|
0a122b |
--- a/hw/misc/vfio.c
|
|
|
0a122b |
+++ b/hw/misc/vfio.c
|
|
|
0a122b |
@@ -886,8 +886,20 @@ static void vfio_disable_msi_common(VFIODevice *vdev)
|
|
|
0a122b |
|
|
|
0a122b |
static void vfio_disable_msix(VFIODevice *vdev)
|
|
|
0a122b |
{
|
|
|
0a122b |
+ int i;
|
|
|
0a122b |
+
|
|
|
0a122b |
msix_unset_vector_notifiers(&vdev->pdev);
|
|
|
0a122b |
|
|
|
0a122b |
+ /*
|
|
|
0a122b |
+ * MSI-X will only release vectors if MSI-X is still enabled on the
|
|
|
0a122b |
+ * device, check through the rest and release it ourselves if necessary.
|
|
|
0a122b |
+ */
|
|
|
0a122b |
+ for (i = 0; i < vdev->nr_vectors; i++) {
|
|
|
0a122b |
+ if (vdev->msi_vectors[i].use) {
|
|
|
0a122b |
+ vfio_msix_vector_release(&vdev->pdev, i);
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+
|
|
|
0a122b |
if (vdev->nr_vectors) {
|
|
|
0a122b |
vfio_disable_irqindex(vdev, VFIO_PCI_MSIX_IRQ_INDEX);
|
|
|
0a122b |
}
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.11.7
|
|
|
0a122b |
|