Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI PM: Restore config spaces of all devices during early resume

At present the configuration spaces of PCI devices that have no
drivers or no PM support in the drivers (either legacy or through a
pm object) are not saved during suspend and, consequently, they are
not restored during resume. This generally may lead to the state of
the system being slightly inconsistent after the resume, so it's
better to save and restore the configuration spaces of these devices
as well.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>

+9 -7
+9 -7
drivers/pci/pci-driver.c
··· 516 516 if (pci_has_legacy_pm_support(pci_dev)) 517 517 return pci_legacy_suspend(dev, PMSG_SUSPEND); 518 518 519 + pci_dev->state_saved = false; 520 + 519 521 if (!pm) { 520 522 pci_pm_default_suspend(pci_dev); 521 523 goto Fixup; 522 524 } 523 - 524 - pci_dev->state_saved = false; 525 525 526 526 if (pm->suspend) { 527 527 pci_power_t prev = pci_dev->current_state; ··· 554 554 if (pci_has_legacy_pm_support(pci_dev)) 555 555 return pci_legacy_suspend_late(dev, PMSG_SUSPEND); 556 556 557 - if (!pm) 557 + if (!pm) { 558 + pci_save_state(pci_dev); 558 559 return 0; 560 + } 559 561 560 562 if (pm->suspend_noirq) { 561 563 pci_power_t prev = pci_dev->current_state; ··· 652 650 if (pci_has_legacy_pm_support(pci_dev)) 653 651 return pci_legacy_suspend(dev, PMSG_FREEZE); 654 652 653 + pci_dev->state_saved = false; 654 + 655 655 if (!pm) { 656 656 pci_pm_default_suspend(pci_dev); 657 657 return 0; 658 658 } 659 - 660 - pci_dev->state_saved = false; 661 659 662 660 if (pm->freeze) { 663 661 int error; ··· 740 738 if (pci_has_legacy_pm_support(pci_dev)) 741 739 return pci_legacy_suspend(dev, PMSG_HIBERNATE); 742 740 741 + pci_dev->state_saved = false; 742 + 743 743 if (!pm) { 744 744 pci_pm_default_suspend(pci_dev); 745 745 goto Fixup; 746 746 } 747 - 748 - pci_dev->state_saved = false; 749 747 750 748 if (pm->poweroff) { 751 749 int error;