]> xenbits.xensource.com Git - qemu-xen-4.1-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>
Tue, 13 Nov 2012 18:17:34 +0000 (18:17 +0000)
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>
(cherry picked from commit 3e66da7266c84638c0e22a09c9d2b07529802576)

hw/pass-through.c
hw/pt-msi.c

index 9c5620da2076f32add7356e15ec6021c54d4f049..41926c6efa8644c262d9c13f6132e530e6ef62af 100644 (file)
@@ -3803,21 +3803,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 71fa6f00414566bdbd0d0c0cff6fa853275b485e..fcec36a0f27c7c7d85e2a3b7cc11d0290e1481ff 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;
 }
 
 /* MSI-X virtulization functions */