]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PCI / PM: Do not clear state_saved in pci_pm_freeze() when smart suspend is set
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 20 Apr 2018 12:22:02 +0000 (15:22 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:24:45 +0000 (12:24 +0200)
commitbd5a9802fb4fe274d7567d2a2da90f1177dee8d0
treecf660dd3878caa5216151fd029f569f53cfa1058
parent9fcee428e69532ff5d08fd93aa071e48a4f9404e
PCI / PM: Do not clear state_saved in pci_pm_freeze() when smart suspend is set

BugLink: http://bugs.launchpad.net/bugs/1778265
commit ae860a19f37c686e7c5816e96640168b7174a096 upstream.

If a driver uses DPM_FLAG_SMART_SUSPEND and the device is already
runtime suspended when hibernate is started PCI core skips runtime
resuming the device but still clears pci_dev->state_saved. After the
hibernation image is written pci_pm_thaw_noirq() makes sure subsequent
thaw phases for the device are also skipped leaving it runtime suspended
with pci_dev->state_saved == false.

When the device is eventually runtime resumed pci_pm_runtime_resume()
restores config space by calling pci_restore_standard_config(), however
because pci_dev->state_saved == false pci_restore_state() never actually
restores the config space leaving the device in a state that is not what
the driver might expect.

For example here is what happens for intel-lpss I2C devices once the
hibernation snapshot is taken:

  intel-lpss 0000:00:15.0: power state changed by ACPI to D0
  intel-lpss 0000:00:1e.0: power state changed by ACPI to D3cold
  video LNXVIDEO:00: Restoring backlight state
  PM: hibernation exit
  i2c_designware i2c_designware.1: Unknown Synopsys component type: 0xffffffff
  i2c_designware i2c_designware.0: Unknown Synopsys component type: 0xffffffff
  i2c_designware i2c_designware.1: timeout in disabling adapter
  i2c_designware i2c_designware.0: timeout in disabling adapter

Since PCI config space is not restored the device is still in D3hot
making MMIO register reads return 0xffffffff.

Fix this by clearing pci_dev->state_saved only if we actually end up
runtime resuming the device.

Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account)
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: 4.15+ <stable@vger.kernel.org> # 4.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/pci/pci-driver.c