Bjorn Helgaas 327ccbbcc1 PCI/PM: Return error when changing power state from D3cold
pci_raw_set_power_state() uses the Power Management capability to change a
device's power state.  The capability is in config space, which is
accessible in D0, D1, D2, and D3hot, but not in D3cold.

If we call pci_raw_set_power_state() on a device that's in D3cold, config
reads fail and return ~0 data, which we erroneously interpreted as "the
device is in D3hot", leading to messages like this:

  pcieport 0000:03:00.0: Refused to change power state, currently in D3

The PCI_PM_CTRL has several RsvdP fields, so ~0 is never a valid register
value.  If we get that value, print a more informative message and return
an error.

Changing the power state of a device from D3cold must be done by a platform
power management method or some other non-config space mechanism.

Link: https://lore.kernel.org/r/20190822200551.129039-4-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2019-11-20 17:36:48 -06:00
..
2019-09-23 19:16:01 -07:00
2019-09-23 19:16:01 -07:00
2019-09-23 19:16:01 -07:00
2019-07-09 07:24:53 -05:00
2018-03-19 14:20:43 -05:00
2019-09-23 16:10:15 -05:00
2019-09-23 19:16:01 -07:00
2019-07-09 07:24:53 -05:00
2019-09-23 16:10:08 -05:00
2018-03-19 14:20:43 -05:00
2018-10-02 10:14:32 +02:00
2019-09-23 19:16:01 -07:00
2019-09-23 19:16:01 -07:00
2018-06-29 21:17:26 -05:00
2019-07-23 18:32:50 -05:00
2018-03-19 14:20:43 -05:00
2019-06-13 16:49:45 -05:00
2019-09-23 16:10:31 -05:00
2019-05-13 18:34:46 -05:00