]> xenbits.xensource.com Git - qemu-xen-4.5-testing.git/commitdiff
qemu-xen-trad: fix msi_translate with PV event delivery
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 30 Aug 2012 15:11:32 +0000 (16:11 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 30 Aug 2012 15:11:32 +0000 (16:11 +0100)
When switching from msitranslate to straight msi we need to make sure
that we respect PV event delivery for the msi if the guest asked for it:

- completely disable MSI on the device in pt_disable_msi_translate;
- then enable MSI again (pt_msi_setup), mapping the correct pirq to it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Rolu <rolu@roce.org>
hw/pass-through.c
hw/pt-msi.c

index 6e396e37f0eeb04760a9cd98be93f2b6f3b09774..304c438e832d1e7ebc7f263d84f398ad38ad5a32 100644 (file)
@@ -3841,21 +3841,18 @@ static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
                 PT_LOG("guest enabling MSI, disable MSI-INTx translation\n");
                 pt_disable_msi_translate(ptdev);
             }
-            else
+            /* Init physical one */
+            PT_LOG("setup msi for dev %x\n", pd->devfn);
+            if (pt_msi_setup(ptdev))
             {
-                /* Init physical one */
-                PT_LOG("setup msi for dev %x\n", pd->devfn);
-                if (pt_msi_setup(ptdev))
-                {
-                   /* We do not broadcast the error to the framework code, so
-                    * that MSI errors are contained in MSI emulation code and
-                    * QEMU can go on running.
-                    * Guest MSI would be actually not working.
-                    */
-                   *value &= ~PCI_MSI_FLAGS_ENABLE;
-                   PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
-                   return 0;
-                }
+                /* We do not broadcast the error to the framework code, so
+                 * that MSI errors are contained in MSI emulation code and
+                 * QEMU can go on running.
+                 * Guest MSI would be actually not working.
+                 */
+                *value &= ~PCI_MSI_FLAGS_ENABLE;
+                PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
+                return 0;
             }
             if (pt_msi_update(ptdev))
             {
index 70c4023ba428345f87085b78b6a0dfbab78e4d65..73f737d00080740af9a17480636496ffe201598a 100644 (file)
@@ -263,16 +263,8 @@ void pt_disable_msi_translate(struct pt_dev *dev)
     uint8_t e_device = 0;
     uint8_t e_intx = 0;
 
-    /* MSI_ENABLE bit should be disabed until the new handler is set */
-    msi_set_enable(dev, 0);
-
-    e_device = PCI_SLOT(dev->dev.devfn);
-    e_intx = pci_intx(dev);
-
-    if (xc_domain_unbind_pt_irq(xc_handle, domid, dev->msi->pirq,
-                                 PT_IRQ_TYPE_MSI_TRANSLATE, 0,
-                                 e_device, e_intx, 0))
-        PT_LOG("Error: Unbinding pt irq for MSI-INTx failed!\n");
+    pt_msi_disable(dev);
+    dev->msi->flags |= MSI_FLAG_UNINIT;
 
     if (dev->machine_irq)
     {
@@ -280,8 +272,6 @@ void pt_disable_msi_translate(struct pt_dev *dev)
                                        0, e_device, e_intx))
             PT_LOG("Error: Rebinding of interrupt failed!\n");
     }
-
-    dev->msi_trans_en = 0;
 }
 
 static int pt_msix_update_one(struct pt_dev *dev, int entry_nr)