[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen-unstable] qemu-xen-trad: fix msi_translate with PV event delivery



commit 3e66da7266c84638c0e22a09c9d2b07529802576
Author: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date:   Thu Aug 30 16:11:32 2012 +0100

    qemu-xen-trad: fix msi_translate with PV event delivery
    
    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@xxxxxxxxxxxxx>
    Tested-by: Rolu <rolu@xxxxxxxx>
---
 hw/pass-through.c |   25 +++++++++++--------------
 hw/pt-msi.c       |   14 ++------------
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 6e396e3..304c438 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -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))
             {
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index 70c4023..73f737d 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -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)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.