From: Jan Kiszka <[email protected]>

Make sure to re-register the IRQ of an assigned device as INTx when the
guest disables MSI[X] mode again.

Acked-by: Michael S. Tsirkin <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index a25f3e0..e97f565 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1136,7 +1136,10 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev, 
unsigned int ctrl_pos)
         if (kvm_assign_irq(kvm_context, &assigned_irq_data) < 0)
             perror("assigned_dev_enable_msi: assign irq");
 
+        assigned_dev->girq = -1;
         assigned_dev->irq_requested_type = assigned_irq_data.flags;
+    } else {
+        assign_irq(assigned_dev);
     }
 }
 #endif
@@ -1276,7 +1279,10 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev, 
unsigned int ctrl_pos)
             perror("assigned_dev_enable_msix: assign irq");
             return;
         }
+        assigned_dev->girq = -1;
         assigned_dev->irq_requested_type = assigned_irq_data.flags;
+    } else {
+        assign_irq(assigned_dev);
     }
 }
 #endif
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to