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] [PATCH] pciback: restore PCI BARs on D3->D0 transition

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] pciback: restore PCI BARs on D3->D0 transition
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Mon, 26 Mar 2007 13:29:03 -0600
Delivery-date: Mon, 26 Mar 2007 12:28:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: HP OSLO R&D
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
   Ever since xen-unstable cset 14308 ("pci back: Fix registration of of
filters on subsections of config space") I've been getting an MCA on the
*2nd* boot of a driver domain using an e1000 NIC.  Cset 14308 allowed
the proper setup of the PM control registers, so the NIC is put in the
D3 power state when the driver domain shuts down.  Unfortunately,
pci_set_power_state() won't restore the BARs on a D3hot/cold to D0
transition.  There are some comments in this upstream cset about why
that is:

http://www.kernel.org/hg/linux-2.6/rev/8f33e29c89a7

However, we obviously can't expect PCI devices to work without their
BARs properly programmed.  The patch below adds a call to
pci_restore_bars() as a workaround until we can figure out why the PCI
code doesn't do this for us.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 56caf0e37e6a 
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_capability_pm.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_capability_pm.c       
Mon Mar 26 10:10:31 2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_capability_pm.c       
Mon Mar 26 13:13:23 2007 -0600
@@ -33,7 +33,7 @@ static int pm_ctrl_write(struct pci_dev 
 {
        int err;
        u16 cur_value;
-       pci_power_t new_state;
+       pci_power_t new_state, old_state;
 
        /* Handle setting power state separately */
        new_state = (pci_power_t)(new_value & PCI_PM_CTRL_STATE_MASK);
@@ -52,9 +52,20 @@ static int pm_ctrl_write(struct pci_dev 
 
        /* Let pci core handle the power management change */
        dev_dbg(&dev->dev, "set power state to %x\n", new_state);
+       old_state = dev->current_state;
        err = pci_set_power_state(dev, new_state);
        if (err)
                err = PCIBIOS_SET_FAILED;
+
+       /*
+        * Linux does not currently restore the BARs on a transition from
+        * D3hot/cold to D0.  Fixup here.
+        */
+       if (new_state == PCI_D0 &&
+           (old_state == PCI_D3hot || old_state == PCI_D3cold)) {
+               if (!(cur_value & PCI_PM_CTRL_NO_SOFT_RESET))
+                       pci_restore_bars(dev);
+       }
 
       out:
        return err;



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

<Prev in Thread] Current Thread [Next in Thread>