linux-stable/drivers/cpufreq
Srinivas Pandruvada 984edbdccc cpufreq: intel_pstate: Support for energy performance hints with HWP
It is possible to provide hints to the HWP algorithms in the processor
to be more performance centric to more energy centric. These hints are
provided by using HWP energy performance preference (EPP) or energy
performance bias (EPB) settings.

The scope of these settings is per logical processor, which means that
each of the logical processors in the package can be programmed with a
different value.

This change provides cpufreq sysfs interface to provide hint. For each
policy, two additional attributes will be available to check and provide
hint. These attributes will only be present when the intel_pstate driver
is using HWP mode.

These attributes are:
 - energy_performance_available_preferences
 - energy_performance_preference

To get list of supported hints:
$ cat energy_performance_available_preferences
default performance balance_performance balance_power power

The current preference can be read or changed via cpufreq sysfs
attribute "energy_performance_preference". Reading from this attribute
will display current effective setting changed via any method. User can
write any of the valid preference string to this attribute. User can
always restore to power-on default by writing "default".

Implementation
Since these hints can be provided by direct MSR write or using some tools
like x86_energy_perf_policy, the driver internally doesn't maintain any
state. The user operation will result in direct read/write of MSR: 0x774
(HWP_REQUEST_MSR). Also driver use read modify write to update other
fields in this MSR.

Summary of changes:
 - struct cpudata field epp_saved is renamed to epp_powersave, as this
   stores the value to restore once policy is switched from performance
   to powersave to restore original powersave EPP value.
 - A new struct cpudata field epp_saved is used to store the raw MSR
   EPP/EPB value when a CPU goes offline or on suspend and restore on
   online/resume. This ensures that EPP value is restored to correct
   value irrespective of the means used to set.
 - EPP/EPB value ranges are fixed for each preference, which can be
   set for the cpufreq sysfs, so user request is mapped to/from this
   range.
 - New attributes are only added when HWP is present.
 - Since EPP value of 0 is valid the fields are initialized to
   -EINVAL when not valid. The field epp_default is read only once
   after powerup to avoid reading on subsequent CPU online operation
 - New suspend callback to store epp on suspend operation
 - Don't invalidate old epp_saved field on resume and online as now
   we can restore last epp value on suspend and this field can still
   have old EPP value sampled during switch to performance from
   powersave.
 - While here optimized setting of cpu_data->epp_powersave = epp in
   intel_pstate_hwp_set() as this was done in both true and false
   paths.
 - epp/epb set function returns error to caller on failure to pass
   on to user space for display.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-12-08 01:43:05 +01:00
..
acpi-cpufreq.c cpufreq: acpi-cpufreq: drop rdmsr_on_cpus() usage 2016-11-28 14:31:06 +01:00
amd_freq_sensitivity.c cpufreq: Reuse new freq-table helpers 2016-07-07 00:14:27 +02:00
arm_big_little.c cpufreq: arm_big_little: use generic OPP functions for {init, free}_opp_table 2016-05-05 01:40:04 +02:00
arm_big_little.h cpufreq: arm_big_little: use generic OPP functions for {init, free}_opp_table 2016-05-05 01:40:04 +02:00
arm_big_little_dt.c cpufreq: arm_big_little: use generic OPP functions for {init, free}_opp_table 2016-05-05 01:40:04 +02:00
at32ap-cpufreq.c
blackfin-cpufreq.c blackfin-cpufreq: Mark cpu_set_cclk() as static 2015-12-28 01:51:36 +01:00
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: make symbol brcm_avs_cpufreq_attr static 2016-11-11 01:32:53 +01:00
cppc_cpufreq.c cpufreq / CPPC: Add MODULE_DEVICE_TABLE for cppc_cpufreq driver 2016-10-21 15:11:23 +02:00
cpufreq-dt-platdev.c cpufreq: dt: Add support for zx296718 2016-11-30 22:42:47 +01:00
cpufreq-dt.c cpufreq: dt: Support governor tunables per policy 2016-09-13 02:39:12 +02:00
cpufreq-dt.h cpufreq: dt: Support governor tunables per policy 2016-09-13 02:39:12 +02:00
cpufreq-nforce2.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
cpufreq.c cpufreq: Make cpufreq_update_policy() void 2016-11-21 14:35:43 +01:00
cpufreq_conservative.c cpufreq: conservative: Fix comment explaining frequency updates 2016-11-16 23:15:56 +01:00
cpufreq_governor.c cpufreq: conservative: Decrease frequency faster for deferred updates 2016-11-16 23:15:56 +01:00
cpufreq_governor.h cpufreq: conservative: Decrease frequency faster for deferred updates 2016-11-16 23:15:56 +01:00
cpufreq_governor_attr_set.c cpufreq: governor: Move abstract gov_attr_set code to seperate file 2016-04-02 01:09:01 +02:00
cpufreq_ondemand.c cpufreq: ondemand: Set MIN_FREQUENCY_UP_THRESHOLD to 1 2016-12-01 22:43:33 +01:00
cpufreq_ondemand.h cpufreq: ondemand: Don't keep a copy of freq_table pointer 2016-06-09 00:58:06 +02:00
cpufreq_performance.c cpufreq: governor: Get rid of governor events 2016-06-02 23:24:15 +02:00
cpufreq_powersave.c cpufreq: governor: Get rid of governor events 2016-06-02 23:24:15 +02:00
cpufreq_stats.c cpufreq: stats: New sysfs attribute for clearing statistics 2016-11-11 01:51:11 +01:00
cpufreq_userspace.c cpufreq: governor: Get rid of governor events 2016-06-02 23:24:15 +02:00
cris-artpec3-cpufreq.c
cris-etraxfs-cpufreq.c
davinci-cpufreq.c cpufreq: davinci: Reuse cpufreq_generic_frequency_table_verify() 2016-06-09 00:58:07 +02:00
dbx500-cpufreq.c
e_powersaver.c cpufreq: e_powersaver: Use IS_ENABLED() instead of checking for built-in or module 2016-04-27 22:42:34 +02:00
elanfreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
exynos5440-cpufreq.c
freq_table.c cpufreq: Handle sorted frequency tables more efficiently 2016-07-07 00:13:20 +02:00
gx-suspmod.c
highbank-cpufreq.c
ia64-acpi-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
imx6q-cpufreq.c
intel_pstate.c cpufreq: intel_pstate: Support for energy performance hints with HWP 2016-12-08 01:43:05 +01:00
Kconfig Merge branch 'pm-cpufreq-sched' into pm-cpufreq 2016-10-02 01:42:33 +02:00
Kconfig.arm cpufreq: brcmstb-avs-cpufreq: add debugfs support 2016-11-01 06:07:38 +01:00
Kconfig.powerpc
Kconfig.x86 cpufreq: intel_pstate: Enforce _PPC limits 2016-04-28 01:01:39 +02:00
kirkwood-cpufreq.c cpufreq: kirkwood: add missing \n to end of dev_err messages 2016-09-26 15:10:58 +02:00
longhaul.c Power management material for v4.7-rc1 2016-05-16 19:17:22 -07:00
longhaul.h
longrun.c
loongson1-cpufreq.c CPUFREQ: Loongson1: Replace goto out with return in ls1x_cpufreq_probe() 2016-05-13 14:02:08 +02:00
loongson2_cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
Makefile cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs 2016-11-01 06:07:37 +01:00
maple-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
mt8173-cpufreq.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2016-05-26 09:23:43 -07:00
mvebu-cpufreq.c cpufreq: mvebu: fix integer to pointer cast 2016-06-13 23:49:43 +02:00
omap-cpufreq.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
p4-clockmod.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
pasemi-cpufreq.c
pcc-cpufreq.c Revert "cpufreq: pcc-cpufreq: update default value of cpuinfo_transition_latency" 2016-07-22 23:51:06 +02:00
pmac32-cpufreq.c powerpc updates for 4.7 2016-05-20 10:12:41 -07:00
pmac64-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
powernow-k6.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
powernow-k7.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
powernow-k7.h
powernow-k8.c
powernow-k8.h
powernv-cpufreq.c cpufreq: powernv: Disable preemption while checking CPU throttling state 2016-11-16 23:29:59 +01:00
ppc_cbe_cpufreq.c
ppc_cbe_cpufreq.h cpufreq: e_powersaver: Use IS_ENABLED() instead of checking for built-in or module 2016-04-27 22:42:34 +02:00
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Remove cpufreq_frequency_get_table() 2016-06-09 00:58:05 +02:00
pxa2xx-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
pxa3xx-cpufreq.c
qoriq-cpufreq.c cpufreq: qoriq: Fix cooling device registration issue during suspend 2016-04-25 16:07:02 +02:00
s3c24xx-cpufreq-debugfs.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
s3c24xx-cpufreq.c cpufreq: Return index from cpufreq_frequency_table_target() 2016-06-09 00:58:06 +02:00
s3c64xx-cpufreq.c
s3c2410-cpufreq.c
s3c2412-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
s3c2416-cpufreq.c
s3c2440-cpufreq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
s5pv210-cpufreq.c ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
sa1100-cpufreq.c
sa1110-cpufreq.c ARM: sa1100: move StrongARM CPU ID checks to cputype.h 2016-08-23 10:25:17 +01:00
sc520_freq.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
scpi-cpufreq.c cpufreq-SCPI: Delete unnecessary assignment for the field "owner" 2016-08-18 03:42:32 +02:00
sfi-cpufreq.c
sh-cpufreq.c
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c
speedstep-centrino.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
speedstep-ich.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
speedstep-lib.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
speedstep-lib.h
speedstep-smi.c cpufreq: Use consistent prefixing via pr_fmt 2016-04-09 01:35:18 +02:00
sti-cpufreq.c cpufreq: st: add missing \n to end of dev_err message 2016-09-26 15:11:42 +02:00
tegra20-cpufreq.c
tegra124-cpufreq.c cpufreq: tegra124: No need of setting platform-data 2016-04-09 01:12:09 +02:00
unicore2-cpufreq.c
vexpress-spc-cpufreq.c cpufreq: arm_big_little: use generic OPP functions for {init, free}_opp_table 2016-05-05 01:40:04 +02:00