From: Michael S. Tsirkin <m...@redhat.com>

When guest notifier is assigned, we set mask notifier,
which will assign kvm irqfd.
When guest notifier is unassigned, mask notifier is unset,
which should unassign kvm irqfd.

The way to do this is to call mask notifier telling it to mask the vector.
This, unless vector is already masked which unassigns irqfd already.

The logic in unassign was reversed, which left kvm irqfd assigned.

Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
Acked-by: Gerd Hoffmann <kra...@redhat.com>
Acked-by: Amit Shah <amit.s...@redhat.com>
Reported-by: Amit Shah <amit.s...@redhat.com>
Signed-off-by: Avi Kivity <a...@redhat.com>

diff --git a/hw/msix.c b/hw/msix.c
index 8f9a621..1398680 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -617,6 +617,7 @@ int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, 
void *opaque)
     assert(opaque);
     assert(!dev->msix_mask_notifier_opaque[vector]);
 
+    /* Unmask the new notifier unless vector is masked. */
     if (msix_is_masked(dev, vector)) {
         return 0;
     }
@@ -638,12 +639,13 @@ int msix_unset_mask_notifier(PCIDevice *dev, unsigned 
vector)
     assert(dev->msix_mask_notifier);
     assert(dev->msix_mask_notifier_opaque[vector]);
 
+    /* Mask the old notifier unless it is already masked. */
     if (msix_is_masked(dev, vector)) {
         return 0;
     }
     r = dev->msix_mask_notifier(dev, vector,
                                 dev->msix_mask_notifier_opaque[vector],
-                                msix_is_masked(dev, vector));
+                                !msix_is_masked(dev, vector));
     if (r < 0) {
         return r;
     }
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to