WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] [pv-ops] fix dom0 S3 when MSI is used.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Thu, 18 Mar 2010 18:03:15 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 18 Mar 2010 18:04:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <ED3036A092A28F4C91B0B4360DD128EABDFB4D46@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <EADF0A36011179459010BDF5142A457501D006B913@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4FA716B1526C7C4DB0375C6DADBC4EA342A7A7E951@xxxxxxxxxxxxxxxxxxxxxxxxx> <EADF0A36011179459010BDF5142A457501D006BBAC@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4FA716B1526C7C4DB0375C6DADBC4EA342A7A7E95E@xxxxxxxxxxxxxxxxxxxxxxxxx> <EADF0A36011179459010BDF5142A457501D11C1BE3@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4B182D87.6030901@xxxxxxxx> <EADF0A36011179459010BDF5142A457501D11C20F8@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4B187513.80003@xxxxxxxx> <EADF0A36011179459010BDF5142A457501D13FDE62@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4B200727.8040000@xxxxxxxx> <1260436078.23698.45463.camel@xxxxxxxxxxxxxxxxxxxxxx> <4B2135CC.6000004@xxxxxxxx> <ED3036A092A28F4C91B0B4360DD128EABDFB4D46@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3
On 03/17/2010 01:46 AM, Cui, Dexuan wrote:
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.
What branches should I apply this to?  Both 2.6.31 and .32, or just .32?
A better workaround is invoking the PHYSDEVOP_restore_msi hypercall.
The patch reverts the old commit and invokes the hypercall.
Is this a new hypercall?

Aside from that, it looks fine as a stopgap until we do MSI properly.

Thanks,
    J

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 */


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