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

[Xen-devel] [PATCH] [pv-ops] fix dom0 S3 when MSI is used.


  • To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
  • From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
  • Date: Wed, 17 Mar 2010 16:46:47 +0800
  • Accept-language: zh-CN, en-US
  • Acceptlanguage: zh-CN, en-US
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 17 Mar 2010 01:48:57 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acp5wfAcsm1C2OHiR5quyLaywVfLNhL5zeGg
  • Thread-topic: [PATCH] [pv-ops] fix dom0 S3 when MSI is used.

The old commit a234848f works only when the device supports D3hot; when the
device only supports D3cold, the device doesn't work properly after resuming
from Dom0 S3.
A better workaround is invoking the PHYSDEVOP_restore_msi hypercall.
The patch reverts the old commit and invokes the hypercall.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b40c6d0..c6bffe2 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -20,6 +20,7 @@
 #include <asm/errno.h>
 #include <asm/io.h>
 
+#include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 
 #include "pci.h"
@@ -271,8 +272,7 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg)
 {
        struct irq_desc *desc = irq_to_desc(irq);
 
-       if (!xen_initial_domain())
-               write_msi_msg_desc(desc, msg);
+       write_msi_msg_desc(desc, msg);
 }
 
 static int msi_free_irqs(struct pci_dev* dev);
@@ -347,6 +347,20 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
 
 void pci_restore_msi_state(struct pci_dev *dev)
 {
+       if (xen_initial_domain()) {
+               struct physdev_restore_msi physdev;
+
+               if (!dev->msi_enabled && !dev->msix_enabled)
+                       return;
+
+               pci_intx_for_msi(dev, 0);
+
+               physdev.bus = dev->bus->number;
+               physdev.devfn = dev->devfn;
+               HYPERVISOR_physdev_op(PHYSDEVOP_restore_msi, &physdev);
+
+               return;
+       }
        __pci_restore_msi_state(dev);
        __pci_restore_msix_state(dev);
 }
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index ac5de37..516d2b4 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -144,6 +144,13 @@ struct physdev_manage_pci {
        uint8_t devfn;
 };
 
+#define PHYSDEVOP_restore_msi          19
+struct physdev_restore_msi {
+       /* IN */
+       uint8_t bus;
+       uint8_t devfn;
+};
+
 #define PHYSDEVOP_manage_pci_add_ext   20
 struct physdev_manage_pci_ext {
        /* IN */

Attachment: fix_pvops_dom0_s3.patch
Description: fix_pvops_dom0_s3.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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