PCI PM: Fix hibernation breakage on EeePC 701
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 PCI PM: Fix hibernation breakage on EeePC 701
From: Rafael J. Wysocki <[email protected]>
Hibernation breaks on EeePC 701 as a result of attempting to put one of its (driverless) devices into a low power state. Avoid that by not attepmting to power manage driverless devices during hibernation.
--- drivers/pci/pci-driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +4 -1
@@ -660,7 +660,10 @@ static int pci_pm_poweroff(struct deviceif (pci_has_legacy_pm_support (pci_dev))return pci_legacy_suspend (dev,PMSG_HIBERNATE ); -if (drv && drv->pm && drv->pm->poweroff) { +if (!drv || !drv->pm) +return 0 ; + +if (drv->pm->poweroff) { error = drv->pm->poweroff (dev);suspend_report_result (drv->pm->poweroff, error); }
PATCH 2/3 PCI PM: Power up devices before restoring their state
In reply to a message not in the archiveFrom: Rafael J. Wysocki <[email protected]>
Devices that have MSI-X enabled before suspend to RAM or hibernation and that are in a low power state during resume will not be handled correctly by pci_restore_standard_config(). Namely, it first calls pci_restore_state() which calls pci_restore_msi_state(), which in turn executes __pci_restore_msix_state() that accesses the device's memory space to restore the contents of the MSI-X table. However, if the device is in a low power state at this point, it's memory space is not accessible.
The easiest way to fix this potential problem is to make pci_restore_standard_config() call pci_restore_state() after it has put the device into the full power state, D0. Fortunately, all of this is done with interrupts off, so the change of ordering should not cause any trouble.
--- drivers/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/pci.c +3 -3
@@ -1393,12 +1393,11 @@ int pci_restore_standard_config(struct ppci_power_t prev_state;int error; -pci_restore_state (dev);pci_update_current_state (dev,PCI_D0 ); prev_state = dev->current_state;if (prev_state ==PCI_D0 ) -return 0 ; + goto Restore; error =pci_raw_set_power_state (dev,PCI_D0 , false);if (error)
@@ -1421,7 +1420,8 @@ int pci_restore_standard_config(struct p dev->current_state =PCI_D0 ; -return 0 ; + Restore: +return pci_restore_state (dev); }/**
PATCH 3/3 PCI PM: Do not wait for buses in B2 or B3 during resume
In reply to a message not in the archiveFrom: Rafael J. Wysocki <[email protected]>
pci_restore_standard_config() adds extra delay for PCI buses in low power states (B2 or B3), but this is only correct for buses in B2, because the buses in B3 are reset when they are put back into B0. Thus we should wait for such buses to settle after the reset, but it's not a good idea to wait that long (1.1 s) with interrupts off.
On the other hand, we have never waited for buses in B2 and B3 during resume and it seems reasonable to go back to this well tested behaviour.
--- drivers/pci/pci.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/pci/pci.c +13 -13
@@ -1403,19 +1403,19 @@ int pci_restore_standard_config(struct pif (error)return error; -if (pci_is_bridge (dev)) { -if (prev_state >PCI_D1 ) -mdelay (PCI_PM_BUS_WAIT ); - }else { -switch (prev_state) { -case PCI_D3cold: -case PCI_D3hot: -mdelay (pci_pm_d3_delay); -break ; -case PCI_D2 : -udelay (PCI_PM_D2_DELAY ); -break ; - } +/* +* This assumes that we won't get a bus in B2 or B3 from the BIOS, but +* we've made this assumption forever and it appears to be universally +* satisfied. +*/ +switch (prev_state) { +case PCI_D3cold: +case PCI_D3hot: +mdelay (pci_pm_d3_delay); +break ; +case PCI_D2 : +udelay (PCI_PM_D2_DELAY ); +break ; } dev->current_state =PCI_D0 ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jesse Barnes
AppliedQuoted 8 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Hibernation breaks on EeePC 701 as a result of attempting to put one of its (driverless) devices into a low power state. Avoid that by not attepmting to power manage driverless devices during hibernation.
Signed-off-by Rafael J. Wysocki <[email protected]>Reported-and-tested-by Alan Jenkins <[email protected]>
Applied this series to my for-linus branch, thanks.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center