Commit bad2aed1 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Greg Kroah-Hartman

PM: ACPI/PCI: Resume all devices during hibernation

[ Upstream commit 501debd4 ]

Both the PCI bus type and the ACPI PM domain avoid resuming
runtime-suspended devices with DPM_FLAG_SMART_SUSPEND set during
hibernation (before creating the snapshot image of system memory),
but that turns out to be a mistake.  It leads to functional issues
and adds complexity that's hard to justify.

For this reason, resume all runtime-suspended PCI devices and all
devices in the ACPI PM domains before creating a snapshot image of
system memory during hibernation.

Fixes: 05087360 (ACPI / PM: Take SMART_SUSPEND driver flag into account)
Fixes: c4b65157 (PCI / PM: Take SMART_SUSPEND driver flag into account)
Link: https://lore.kernel.org/linux-acpi/917d4399-2e22-67b1-9d54-808561f9083f@uwyo.edu/T/#maf065fe6e4974f2a9d79f332ab99dfaba635f64cReported-by: default avatarRobert R. Howell <RHowell@uwyo.edu>
Tested-by: default avatarRobert R. Howell <RHowell@uwyo.edu>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d329e071
...@@ -1116,13 +1116,14 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); ...@@ -1116,13 +1116,14 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_early);
int acpi_subsys_freeze(struct device *dev) int acpi_subsys_freeze(struct device *dev)
{ {
/* /*
* This used to be done in acpi_subsys_prepare() for all devices and * Resume all runtime-suspended devices before creating a snapshot
* some drivers may depend on it, so do it here. Ideally, however, * image of system memory, because the restore kernel generally cannot
* runtime-suspended devices should not be touched during freeze/thaw * be expected to always handle them consistently and they need to be
* transitions. * put into the runtime-active metastate during system resume anyway,
* so it is better to ensure that the state saved in the image will be
* always consistent with that.
*/ */
if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) pm_runtime_resume(dev);
pm_runtime_resume(dev);
return pm_generic_freeze(dev); return pm_generic_freeze(dev);
} }
......
...@@ -959,15 +959,15 @@ static int pci_pm_freeze(struct device *dev) ...@@ -959,15 +959,15 @@ static int pci_pm_freeze(struct device *dev)
} }
/* /*
* This used to be done in pci_pm_prepare() for all devices and some * Resume all runtime-suspended devices before creating a snapshot
* drivers may depend on it, so do it here. Ideally, runtime-suspended * image of system memory, because the restore kernel generally cannot
* devices should not be touched during freeze/thaw transitions, * be expected to always handle them consistently and they need to be
* however. * put into the runtime-active metastate during system resume anyway,
* so it is better to ensure that the state saved in the image will be
* always consistent with that.
*/ */
if (!dev_pm_smart_suspend_and_suspended(dev)) { pm_runtime_resume(dev);
pm_runtime_resume(dev); pci_dev->state_saved = false;
pci_dev->state_saved = false;
}
if (pm->freeze) { if (pm->freeze) {
int error; int error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment