diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-09 14:03:48 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-09 14:03:48 -0400 |
| commit | 40bca9dbab4dd6d5a78beccdbbb1c7218136b562 (patch) | |
| tree | 188150cd56bef23a3baba97120b2759b23461064 | |
| parent | 9ef11ceb0d380d4c9b43083fd920049aa05d3f8d (diff) | |
| parent | 73659be769a4f0ac26a6b3fc6699754adba36485 (diff) | |
Merge tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki:
"Fixes for some issues discovered after recent changes and for some
that have just been found lately regardless of those changes
(intel_pstate, intel_idle, PM core, mailbox/pcc, turbostat) plus
support for some new CPU models (intel_idle, Intel RAPL driver,
turbostat) and documentation updates (intel_pstate, PM core).
Specifics:
- intel_pstate fixes for two issues exposed by the recent switch over
from using timers and for one issue introduced during the 4.4 cycle
plus new comments describing data structures used by the driver
(Rafael Wysocki, Srinivas Pandruvada).
- intel_idle fixes related to CPU offline/online (Richard Cochran).
- intel_idle support (new CPU IDs and state definitions mostly) for
Skylake-X and Kabylake processors (Len Brown).
- PCC mailbox driver fix for an out-of-bounds memory access that may
cause the kernel to panic() (Shanker Donthineni).
- New (missing) CPU ID for one apparently overlooked Haswell model in
the Intel RAPL power capping driver (Srinivas Pandruvada).
- Fix for the PM core's wakeup IRQs framework to make it work after
wakeup settings reconfiguration from sysfs (Grygorii Strashko).
- Runtime PM documentation update to make it describe what needs to
be done during device removal more precisely (Krzysztof Kozlowski).
- Stale comment removal cleanup in the cpufreq-dt driver (Viresh
Kumar).
- turbostat utility fixes and support for Broxton, Skylake-X and
Kabylake processors (Len Brown)"
* tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits)
PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
tools/power turbostat: work around RC6 counter wrap
tools/power turbostat: initial KBL support
tools/power turbostat: initial SKX support
tools/power turbostat: decode BXT TSC frequency via CPUID
tools/power turbostat: initial BXT support
tools/power turbostat: print IRTL MSRs
tools/power turbostat: SGX state should print only if --debug
intel_idle: Add KBL support
intel_idle: Add SKX support
intel_idle: Clean up all registered devices on exit.
intel_idle: Propagate hot plug errors.
intel_idle: Don't overreact to a cpuidle registration failure.
intel_idle: Setup the timer broadcast only on successful driver load.
intel_idle: Avoid a double free of the per-CPU data.
intel_idle: Fix dangling registration on error path.
intel_idle: Fix deallocation order on the driver exit path.
intel_idle: Remove redundant initialization calls.
intel_idle: Fix a helper function's return value.
intel_idle: remove useless return from void function.
...
| -rw-r--r-- | Documentation/power/runtime_pm.txt | 4 | ||||
| -rw-r--r-- | arch/x86/include/asm/msr-index.h | 8 | ||||
| -rw-r--r-- | drivers/base/power/wakeup.c | 2 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq-dt.c | 3 | ||||
| -rw-r--r-- | drivers/cpufreq/intel_pstate.c | 206 | ||||
| -rw-r--r-- | drivers/idle/intel_idle.c | 97 | ||||
| -rw-r--r-- | drivers/mailbox/pcc.c | 4 | ||||
| -rw-r--r-- | drivers/powercap/intel_rapl.c | 1 | ||||
| -rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 117 |
9 files changed, 380 insertions, 62 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 7328cf85236c..1fd1fbe9ce95 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
| @@ -586,6 +586,10 @@ drivers to make their ->remove() callbacks avoid races with runtime PM directly, | |||
| 586 | but also it allows of more flexibility in the handling of devices during the | 586 | but also it allows of more flexibility in the handling of devices during the |
| 587 | removal of their drivers. | 587 | removal of their drivers. |
| 588 | 588 | ||
| 589 | Drivers in ->remove() callback should undo the runtime PM changes done | ||
| 590 | in ->probe(). Usually this means calling pm_runtime_disable(), | ||
| 591 | pm_runtime_dont_use_autosuspend() etc. | ||
| 592 | |||
| 589 | The user space can effectively disallow the driver of the device to power manage | 593 | The user space can effectively disallow the driver of the device to power manage |
| 590 | it at run time by changing the value of its /sys/devices/.../power/control | 594 | it at run time by changing the value of its /sys/devices/.../power/control |
| 591 | attribute to "on", which causes pm_runtime_forbid() to be called. In principle, | 595 | attribute to "on", which causes pm_runtime_forbid() to be called. In principle, |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 426e946ed0c0..5b3c9a55f51c 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
| @@ -167,6 +167,14 @@ | |||
| 167 | #define MSR_PKG_C9_RESIDENCY 0x00000631 | 167 | #define MSR_PKG_C9_RESIDENCY 0x00000631 |
| 168 | #define MSR_PKG_C10_RESIDENCY 0x00000632 | 168 | #define MSR_PKG_C10_RESIDENCY 0x00000632 |
| 169 | 169 | ||
| 170 | /* Interrupt Response Limit */ | ||
| 171 | #define MSR_PKGC3_IRTL 0x0000060a | ||
| 172 | #define MSR_PKGC6_IRTL 0x0000060b | ||
| 173 | #define MSR_PKGC7_IRTL 0x0000060c | ||
| 174 | #define MSR_PKGC8_IRTL 0x00000633 | ||
| 175 | #define MSR_PKGC9_IRTL 0x00000634 | ||
| 176 | #define MSR_PKGC10_IRTL 0x00000635 | ||
| 177 | |||
| 170 | /* Run Time Average Power Limiting (RAPL) Interface */ | 178 | /* Run Time Average Power Limiting (RAPL) Interface */ |
| 171 | 179 | ||
| 172 | #define MSR_RAPL_POWER_UNIT 0x00000606 | 180 | #define MSR_RAPL_POWER_UNIT 0x00000606 |
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index a1e0b9ab847a..5fb7718f256c 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
| @@ -246,6 +246,8 @@ static int device_wakeup_attach(struct device *dev, struct wakeup_source *ws) | |||
| 246 | return -EEXIST; | 246 | return -EEXIST; |
| 247 | } | 247 | } |
| 248 | dev->power.wakeup = ws; | 248 | dev->power.wakeup = ws; |
| 249 | if (dev->power.wakeirq) | ||
| 250 | device_wakeup_attach_irq(dev, dev->power.wakeirq); | ||
| 249 | spin_unlock_irq(&dev->power.lock); | 251 | spin_unlock_irq(&dev->power.lock); |
| 250 | return 0; | 252 | return 0; |
| 251 | } | 253 | } |
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index f951f911786e..5f8dbe640a20 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
| @@ -4,9 +4,6 @@ | |||
| 4 | * Copyright (C) 2014 Linaro. | 4 | * Copyright (C) 2014 Linaro. |
| 5 | * Viresh Kumar <viresh.kumar@linaro.org> | 5 | * Viresh Kumar <viresh.kumar@linaro.org> |
| 6 | * | 6 | * |
| 7 | * The OPP code in function set_target() is reused from | ||
| 8 | * drivers/cpufreq/omap-cpufreq.c | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 4b644526fd59..8b5a415ee14a 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -64,6 +64,25 @@ static inline int ceiling_fp(int32_t x) | |||
| 64 | return ret; | 64 | return ret; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | /** | ||
| 68 | * struct sample - Store performance sample | ||
| 69 | * @core_pct_busy: Ratio of APERF/MPERF in percent, which is actual | ||
| 70 | * performance during last sample period | ||
| 71 | * @busy_scaled: Scaled busy value which is used to calculate next | ||
| 72 | * P state. This can be different than core_pct_busy | ||
| 73 | * to account for cpu idle period | ||
| 74 | * @aperf: Difference of actual performance frequency clock count | ||
| 75 | * read from APERF MSR between last and current sample | ||
| 76 | * @mperf: Difference of maximum performance frequency clock count | ||
| 77 | * read from MPERF MSR between last and current sample | ||
| 78 | * @tsc: Difference of time stamp counter between last and | ||
| 79 | * current sample | ||
| 80 | * @freq: Effective frequency calculated from APERF/MPERF | ||
| 81 | * @time: Current time from scheduler | ||
| 82 | * | ||
| 83 | * This structure is used in the cpudata structure to store performance sample | ||
| 84 | * data for choosing next P State. | ||
| 85 | */ | ||
| 67 | struct sample { | 86 | struct sample { |
| 68 | int32_t core_pct_busy; | 87 | int32_t core_pct_busy; |
| 69 | int32_t busy_scaled; | 88 | int32_t busy_scaled; |
| @@ -74,6 +93,20 @@ struct sample { | |||
| 74 | u64 time; | 93 | u64 time; |
| 75 | }; | 94 | }; |
| 76 | 95 | ||
| 96 | /** | ||
| 97 | * struct pstate_data - Store P state data | ||
| 98 | * @current_pstate: Current requested P state | ||
| 99 | * @min_pstate: Min P state possible for this platform | ||
| 100 | * @max_pstate: Max P state possible for this platform | ||
| 101 | * @max_pstate_physical:This is physical Max P state for a processor | ||
| 102 | * This can be higher than the max_pstate which can | ||
| 103 | * be limited by platform thermal design power limits | ||
| 104 | * @scaling: Scaling factor to convert frequency to cpufreq | ||
| 105 | * frequency units | ||
| 106 | * @turbo_pstate: Max Turbo P state possible for this platform | ||
| 107 | * | ||
| 108 | * Stores the per cpu model P state limits and current P state. | ||
| 109 | */ | ||
| 77 | struct pstate_data { | 110 | struct pstate_data { |
| 78 | int current_pstate; | 111 | int current_pstate; |
| 79 | int min_pstate; | 112 | int min_pstate; |
| @@ -83,6 +116,19 @@ struct pstate_data { | |||
| 83 | int turbo_pstate; | 116 | int turbo_pstate; |
| 84 | }; | 117 | }; |
| 85 | 118 | ||
| 119 | /** | ||
| 120 | * struct vid_data - Stores voltage information data | ||
| 121 | * @min: VID data for this platform corresponding to | ||
| 122 | * the lowest P state | ||
| 123 | * @max: VID data corresponding to the highest P State. | ||
| 124 | * @turbo: VID data for turbo P state | ||
| 125 | * @ratio: Ratio of (vid max - vid min) / | ||
| 126 | * (max P state - Min P State) | ||
| 127 | * | ||
| 128 | * Stores the voltage data for DVFS (Dynamic Voltage and Frequency Scaling) | ||
| 129 | * This data is used in Atom platforms, where in addition to target P state, | ||
| 130 | * the voltage data needs to be specified to select next P State. | ||
| 131 | */ | ||
| 86 | struct vid_data { | 132 | struct vid_data { |
| 87 | int min; | 133 | int min; |
| 88 | int max; | 134 | int max; |
| @@ -90,6 +136,18 @@ struct vid_data { | |||
| 90 | int32_t ratio; | 136 | int32_t ratio; |
| 91 | }; | 137 | }; |
| 92 | 138 | ||
| 139 | /** | ||
| 140 | * struct _pid - Stores PID data | ||
| 141 | * @setpoint: Target set point for busyness or performance | ||
| 142 | * @integral: Storage for accumulated error values | ||
| 143 | * @p_gain: PID proportional gain | ||
| 144 | * @i_gain: PID integral gain | ||
| 145 | * @d_gain: PID derivative gain | ||
| 146 | * @deadband: PID deadband | ||
| 147 | * @last_err: Last error storage for integral part of PID calculation | ||
| 148 | * | ||
| 149 | * Stores PID coefficients and last error for PID controller. | ||
| 150 | */ | ||
| 93 | struct _pid { | 151 | struct _pid { |
| 94 | int setpoint; | 152 | int setpoint; |
| 95 | int32_t integral; | 153 | int32_t integral; |
| @@ -100,6 +158,23 @@ struct _pid { | |||
| 100 | int32_t last_err; | 158 | int32_t last_err; |
| 101 | }; | 159 | }; |
| 102 | 160 | ||
| 161 | /** | ||
| 162 | * struct cpudata - Per CPU instance data storage | ||
| 163 | * @cpu: CPU number for this instance data | ||
| 164 | * @update_util: CPUFreq utility callback information | ||
| 165 | * @pstate: Stores P state limits for this CPU | ||
| 166 | * @vid: Stores VID limits for this CPU | ||
| 167 | * @pid: Stores PID parameters for this CPU | ||
| 168 | * @last_sample_time: Last Sample time | ||
| 169 | * @prev_aperf: Last APERF value read from APERF MSR | ||
| 170 | * @prev_mperf: Last MPERF value read from MPERF MSR | ||
| 171 | * @prev_tsc: Last timestamp counter (TSC) value | ||
| 172 | * @prev_cummulative_iowait: IO Wait time difference from last and | ||
| 173 | * current sample | ||
| 174 | * @sample: Storage for storing last Sample data | ||
| 175 | |||
