aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-15 01:24:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-15 01:24:25 -0400
commite37720e25df1cb70958a59716135385683e728b3 (patch)
treedb852b7c4a35164ea54fd5c3bcc56c787bbde958 /drivers/pci/pci.c
parent867eacd7fb975273703766f52f485f08471a1ae9 (diff)
parent6df609b24b23845d2ad85b01814e7ad27f607e92 (diff)
Merge tag 'pm-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix a recently exposed issue in the PCI device wakeup code and one older problem related to PCI device wakeup that has been reported recently, modify one more piece of computations in intel_pstate to get rid of a rounding error, fix a possible race in the schedutil cpufreq governor, fix the device PM QoS sysfs interface to correctly handle invalid user input, fix return values of two probe routines in devfreq drivers and constify an attribute_group structure in devfreq. Specifics: - Avoid clearing the PCI PME Enable bit for devices as a result of config space restoration which confuses AML executed afterward and causes wakeup events to be lost on some systems (Rafael Wysocki). - Fix the native PCIe PME interrupts handling in the cases when the PME IRQ is set up as a system wakeup one so that runtime PM remote wakeup works as expected after system resume on systems where that happens (Rafael Wysocki). - Fix the device PM QoS sysfs interface to handle invalid user input correctly instead of using an unititialized variable value as the latency tolerance for the device at hand (Dan Carpenter). - Get rid of one more rounding error from intel_pstate computations (Srinivas Pandruvada). - Fix the schedutil cpufreq governor to prevent it from possibly accessing unititialized data structures from governor callbacks in some cases on systems when multiple CPUs share a single cpufreq policy object (Vikram Mulukutla). - Fix the return values of probe routines in two devfreq drivers (Gustavo Silva). - Constify an attribute_group structure in devfreq (Arvind Yadav)" * tag 'pm-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PCI / PM: Fix native PME handling during system suspend/resume PCI / PM: Restore PME Enable after config space restoration cpufreq: schedutil: Fix sugov_start() versus sugov_update_shared() race PM / QoS: return -EINVAL for bogus strings cpufreq: intel_pstate: Fix ratio setting for min_perf_pct PM / devfreq: constify attribute_group structures. PM / devfreq: tegra: fix error return code in tegra_devfreq_probe() PM / devfreq: rk3399_dmc: fix error return code in rk3399_dmcfreq_probe()
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d88edf5c563b..af0cc3456dc1 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1801,7 +1801,11 @@ static void __pci_pme_active(struct pci_dev *dev, bool enable)
1801 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); 1801 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr);
1802} 1802}
1803 1803
1804static void pci_pme_restore(struct pci_dev *dev) 1804/**
1805 * pci_pme_restore - Restore PME configuration after config space restore.
1806 * @dev: PCI device to update.
1807 */
1808void pci_pme_restore(struct pci_dev *dev)
1805{ 1809{
1806 u16 pmcsr; 1810 u16 pmcsr;
1807 1811
@@ -1811,6 +1815,7 @@ static void pci_pme_restore(struct pci_dev *dev)
1811 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1815 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1812 if (dev->wakeup_prepared) { 1816 if (dev->wakeup_prepared) {
1813 pmcsr |= PCI_PM_CTRL_PME_ENABLE; 1817 pmcsr |= PCI_PM_CTRL_PME_ENABLE;
1818 pmcsr &= ~PCI_PM_CTRL_PME_STATUS;
1814 } else { 1819 } else {
1815 pmcsr &= ~PCI_PM_CTRL_PME_ENABLE; 1820 pmcsr &= ~PCI_PM_CTRL_PME_ENABLE;
1816 pmcsr |= PCI_PM_CTRL_PME_STATUS; 1821 pmcsr |= PCI_PM_CTRL_PME_STATUS;
@@ -1907,14 +1912,9 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
1907{ 1912{
1908 int ret = 0; 1913 int ret = 0;
1909 1914
1910 /* 1915 /* Don't do the same thing twice in a row for one device. */
1911 * Don't do the same thing twice in a row for one device, but restore 1916 if (!!enable == !!dev->wakeup_prepared)
1912 * PME Enable in case it has been updated by config space restoration.
1913 */
1914 if (!!enable == !!dev->wakeup_prepared) {
1915 pci_pme_restore(dev);
1916 return 0; 1917 return 0;
1917 }
1918 1918
1919 /* 1919 /*
1920 * According to "PCI System Architecture" 4th ed. by Tom Shanley & Don 1920 * According to "PCI System Architecture" 4th ed. by Tom Shanley & Don