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-changelog

[Xen-changelog] [linux-2.6.18-xen] PCI: restore saved SR-IOV state

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] PCI: restore saved SR-IOV state
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Mar 2009 07:25:24 -0700
Delivery-date: Wed, 18 Mar 2009 07:26:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1237376358 0
# Node ID 589a78a593f361fcadd57fd4ec0c8a1905a3b312
# Parent  fb46e5625c614ac086e852e3633f29309378812f
PCI: restore saved SR-IOV state

Restore the volatile registers in the SR-IOV capability after the
D3->D0 transition.

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
---
 drivers/pci/iov.c |   29 +++++++++++++++++++++++++++++
 drivers/pci/pci.c |    2 ++
 drivers/pci/pci.h |    4 ++++
 3 files changed, 35 insertions(+)

diff -r fb46e5625c61 -r 589a78a593f3 drivers/pci/iov.c
--- a/drivers/pci/iov.c Wed Mar 18 11:39:04 2009 +0000
+++ b/drivers/pci/iov.c Wed Mar 18 11:39:18 2009 +0000
@@ -125,6 +125,25 @@ static void sriov_release(struct pci_dev
        dev->sriov = NULL;
 }
 
+static void sriov_restore_state(struct pci_dev *dev)
+{
+       int i;
+       u16 ctrl;
+       struct pci_sriov *iov = dev->sriov;
+
+       pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &ctrl);
+       if (ctrl & PCI_SRIOV_CTRL_VFE)
+               return;
+
+       for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++)
+               pci_update_resource(dev, i);
+
+       pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz);
+       pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
+       if (iov->ctrl & PCI_SRIOV_CTRL_VFE)
+               msleep(100);
+}
+
 /**
  * pci_iov_init - initialize the IOV capability
  * @dev: the PCI device
@@ -173,3 +192,13 @@ int pci_iov_resource_bar(struct pci_dev 
        return dev->sriov->pos + PCI_SRIOV_BAR +
                4 * (resno - PCI_IOV_RESOURCES);
 }
+
+/**
+ * pci_restore_iov_state - restore the state of the IOV capability
+ * @dev: the PCI device
+ */
+void pci_restore_iov_state(struct pci_dev *dev)
+{
+       if (dev->is_physfn)
+               sriov_restore_state(dev);
+}
diff -r fb46e5625c61 -r 589a78a593f3 drivers/pci/pci.c
--- a/drivers/pci/pci.c Wed Mar 18 11:39:04 2009 +0000
+++ b/drivers/pci/pci.c Wed Mar 18 11:39:18 2009 +0000
@@ -562,6 +562,8 @@ pci_restore_state(struct pci_dev *dev)
        pci_restore_pcix_state(dev);
        pci_restore_msi_state(dev);
        pci_restore_msix_state(dev);
+       pci_restore_iov_state(dev);
+
        return 0;
 }
 
diff -r fb46e5625c61 -r 589a78a593f3 drivers/pci/pci.h
--- a/drivers/pci/pci.h Wed Mar 18 11:39:04 2009 +0000
+++ b/drivers/pci/pci.h Wed Mar 18 11:39:18 2009 +0000
@@ -154,6 +154,7 @@ extern void pci_iov_release(struct pci_d
 extern void pci_iov_release(struct pci_dev *dev);
 extern int pci_iov_resource_bar(struct pci_dev *dev, int resno,
                                enum pci_bar_type *type);
+extern void pci_restore_iov_state(struct pci_dev *dev);
 #else
 static inline int pci_iov_init(struct pci_dev *dev)
 {
@@ -168,4 +169,7 @@ static inline int pci_iov_resource_bar(s
 {
        return 0;
 }
+static inline void pci_restore_iov_state(struct pci_dev *dev)
+{
+}
 #endif /* CONFIG_PCI_IOV */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] PCI: restore saved SR-IOV state, Xen patchbot-linux-2.6.18-xen <=