Re: [PATCH v2 8/8] cpufreq: intel_pstate: Use CPPC to get max performance

From: kbuild test robot
Date: Thu Sep 01 2016 - 18:32:39 EST


Hi Srinivas,

[auto build test ERROR on tip/sched/core]
[also build test ERROR on v4.8-rc4 next-20160825]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url: https://github.com/0day-ci/linux/commits/Srinivas-Pandruvada/Support-Intel-Turbo-Boost-Max-Technology-3-0/20160902-053224
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

warning: (X86_INTEL_PSTATE && ACPI_CPPC_CPUFREQ) selects ACPI_CPPC_LIB which has unmet direct dependencies (ACPI && ACPI_PROCESSOR && !ACPI_CPU_FREQ_PSS)
>> drivers/cpufreq/intel_pstate.c:202:8: error: redefinition of 'struct cpudata'
struct cpudata {
^~~~~~~
In file included from drivers/cpufreq/intel_pstate.c:47:0:
include/acpi/cppc_acpi.h:117:8: note: originally defined here
struct cpudata {
^~~~~~~
drivers/cpufreq/intel_pstate.c: In function 'intel_pstate_init_acpi_perf_limits':
>> drivers/cpufreq/intel_pstate.c:399:35: error: invalid application of 'sizeof' to incomplete type 'struct cppc_cpudata'
cpu->cppc_data = kzalloc(sizeof(struct cppc_cpudata),
^~~~~~
>> drivers/cpufreq/intel_pstate.c:404:30: error: dereferencing pointer to incomplete type 'struct cppc_cpudata'
perf_caps = &cpu->cppc_data->perf_caps;
^~

vim +202 drivers/cpufreq/intel_pstate.c

938d21a2a Philippe Longepe 2015-11-09 41 #define ATOM_VIDS 0x66b
938d21a2a Philippe Longepe 2015-11-09 42 #define ATOM_TURBO_RATIOS 0x66c
938d21a2a Philippe Longepe 2015-11-09 43 #define ATOM_TURBO_VIDS 0x66d
61d8d2abc Dirk Brandewie 2014-02-12 44
9522a2ff9 Srinivas Pandruvada 2016-04-27 45 #ifdef CONFIG_ACPI
9522a2ff9 Srinivas Pandruvada 2016-04-27 46 #include <acpi/processor.h>
cc2eccd40 Srinivas Pandruvada 2016-09-01 @47 #include <acpi/cppc_acpi.h>
9522a2ff9 Srinivas Pandruvada 2016-04-27 48 #endif
9522a2ff9 Srinivas Pandruvada 2016-04-27 49
f0fe3cd7e Dirk Brandewie 2014-05-29 50 #define FRAC_BITS 8
93f0822df Dirk Brandewie 2013-02-06 51 #define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
93f0822df Dirk Brandewie 2013-02-06 52 #define fp_toint(X) ((X) >> FRAC_BITS)
f0fe3cd7e Dirk Brandewie 2014-05-29 53
a1c9787dc Rafael J. Wysocki 2016-05-11 54 #define EXT_BITS 6
a1c9787dc Rafael J. Wysocki 2016-05-11 55 #define EXT_FRAC_BITS (EXT_BITS + FRAC_BITS)
a1c9787dc Rafael J. Wysocki 2016-05-11 56
93f0822df Dirk Brandewie 2013-02-06 57 static inline int32_t mul_fp(int32_t x, int32_t y)
93f0822df Dirk Brandewie 2013-02-06 58 {
93f0822df Dirk Brandewie 2013-02-06 59 return ((int64_t)x * (int64_t)y) >> FRAC_BITS;
93f0822df Dirk Brandewie 2013-02-06 60 }
93f0822df Dirk Brandewie 2013-02-06 61
7180dddf7 Prarit Bhargava 2015-06-15 62 static inline int32_t div_fp(s64 x, s64 y)
93f0822df Dirk Brandewie 2013-02-06 63 {
7180dddf7 Prarit Bhargava 2015-06-15 64 return div64_s64((int64_t)x << FRAC_BITS, y);
93f0822df Dirk Brandewie 2013-02-06 65 }
93f0822df Dirk Brandewie 2013-02-06 66
d022a65ed Dirk Brandewie 2014-10-13 67 static inline int ceiling_fp(int32_t x)
d022a65ed Dirk Brandewie 2014-10-13 68 {
d022a65ed Dirk Brandewie 2014-10-13 69 int mask, ret;
d022a65ed Dirk Brandewie 2014-10-13 70
d022a65ed Dirk Brandewie 2014-10-13 71 ret = fp_toint(x);
d022a65ed Dirk Brandewie 2014-10-13 72 mask = (1 << FRAC_BITS) - 1;
d022a65ed Dirk Brandewie 2014-10-13 73 if (x & mask)
d022a65ed Dirk Brandewie 2014-10-13 74 ret += 1;
d022a65ed Dirk Brandewie 2014-10-13 75 return ret;
d022a65ed Dirk Brandewie 2014-10-13 76 }
d022a65ed Dirk Brandewie 2014-10-13 77
a1c9787dc Rafael J. Wysocki 2016-05-11 78 static inline u64 mul_ext_fp(u64 x, u64 y)
a1c9787dc Rafael J. Wysocki 2016-05-11 79 {
a1c9787dc Rafael J. Wysocki 2016-05-11 80 return (x * y) >> EXT_FRAC_BITS;
a1c9787dc Rafael J. Wysocki 2016-05-11 81 }
a1c9787dc Rafael J. Wysocki 2016-05-11 82
a1c9787dc Rafael J. Wysocki 2016-05-11 83 static inline u64 div_ext_fp(u64 x, u64 y)
a1c9787dc Rafael J. Wysocki 2016-05-11 84 {
a1c9787dc Rafael J. Wysocki 2016-05-11 85 return div64_u64(x << EXT_FRAC_BITS, y);
a1c9787dc Rafael J. Wysocki 2016-05-11 86 }
a1c9787dc Rafael J. Wysocki 2016-05-11 87
13ad7701f Srinivas Pandruvada 2016-04-03 88 /**
13ad7701f Srinivas Pandruvada 2016-04-03 89 * struct sample - Store performance sample
a1c9787dc Rafael J. Wysocki 2016-05-11 90 * @core_avg_perf: Ratio of APERF/MPERF which is the actual average
13ad7701f Srinivas Pandruvada 2016-04-03 91 * performance during last sample period
13ad7701f Srinivas Pandruvada 2016-04-03 92 * @busy_scaled: Scaled busy value which is used to calculate next
a1c9787dc Rafael J. Wysocki 2016-05-11 93 * P state. This can be different than core_avg_perf
13ad7701f Srinivas Pandruvada 2016-04-03 94 * to account for cpu idle period
13ad7701f Srinivas Pandruvada 2016-04-03 95 * @aperf: Difference of actual performance frequency clock count
13ad7701f Srinivas Pandruvada 2016-04-03 96 * read from APERF MSR between last and current sample
13ad7701f Srinivas Pandruvada 2016-04-03 97 * @mperf: Difference of maximum performance frequency clock count
13ad7701f Srinivas Pandruvada 2016-04-03 98 * read from MPERF MSR between last and current sample
13ad7701f Srinivas Pandruvada 2016-04-03 99 * @tsc: Difference of time stamp counter between last and
13ad7701f Srinivas Pandruvada 2016-04-03 100 * current sample
13ad7701f Srinivas Pandruvada 2016-04-03 101 * @time: Current time from scheduler
13ad7701f Srinivas Pandruvada 2016-04-03 102 *
13ad7701f Srinivas Pandruvada 2016-04-03 103 * This structure is used in the cpudata structure to store performance sample
13ad7701f Srinivas Pandruvada 2016-04-03 104 * data for choosing next P State.
13ad7701f Srinivas Pandruvada 2016-04-03 105 */
93f0822df Dirk Brandewie 2013-02-06 106 struct sample {
a1c9787dc Rafael J. Wysocki 2016-05-11 107 int32_t core_avg_perf;
157386b6f Philippe Longepe 2015-12-04 108 int32_t busy_scaled;
93f0822df Dirk Brandewie 2013-02-06 109 u64 aperf;
93f0822df Dirk Brandewie 2013-02-06 110 u64 mperf;
4055fad34 Doug Smythies 2015-04-11 111 u64 tsc;
a4675fbc4 Rafael J. Wysocki 2016-02-05 112 u64 time;
93f0822df Dirk Brandewie 2013-02-06 113 };
93f0822df Dirk Brandewie 2013-02-06 114
13ad7701f Srinivas Pandruvada 2016-04-03 115 /**
13ad7701f Srinivas Pandruvada 2016-04-03 116 * struct pstate_data - Store P state data
13ad7701f Srinivas Pandruvada 2016-04-03 117 * @current_pstate: Current requested P state
13ad7701f Srinivas Pandruvada 2016-04-03 118 * @min_pstate: Min P state possible for this platform
13ad7701f Srinivas Pandruvada 2016-04-03 119 * @max_pstate: Max P state possible for this platform
13ad7701f Srinivas Pandruvada 2016-04-03 120 * @max_pstate_physical:This is physical Max P state for a processor
13ad7701f Srinivas Pandruvada 2016-04-03 121 * This can be higher than the max_pstate which can
13ad7701f Srinivas Pandruvada 2016-04-03 122 * be limited by platform thermal design power limits
13ad7701f Srinivas Pandruvada 2016-04-03 123 * @scaling: Scaling factor to convert frequency to cpufreq
13ad7701f Srinivas Pandruvada 2016-04-03 124 * frequency units
13ad7701f Srinivas Pandruvada 2016-04-03 125 * @turbo_pstate: Max Turbo P state possible for this platform
13ad7701f Srinivas Pandruvada 2016-04-03 126 *
13ad7701f Srinivas Pandruvada 2016-04-03 127 * Stores the per cpu model P state limits and current P state.
13ad7701f Srinivas Pandruvada 2016-04-03 128 */
93f0822df Dirk Brandewie 2013-02-06 129 struct pstate_data {
93f0822df Dirk Brandewie 2013-02-06 130 int current_pstate;
93f0822df Dirk Brandewie 2013-02-06 131 int min_pstate;
93f0822df Dirk Brandewie 2013-02-06 132 int max_pstate;
3bcc6fa97 Srinivas Pandruvada 2015-10-14 133 int max_pstate_physical;
b27580b05 Dirk Brandewie 2014-10-13 134 int scaling;
93f0822df Dirk Brandewie 2013-02-06 135 int turbo_pstate;
93f0822df Dirk Brandewie 2013-02-06 136 };
93f0822df Dirk Brandewie 2013-02-06 137
13ad7701f Srinivas Pandruvada 2016-04-03 138 /**
13ad7701f Srinivas Pandruvada 2016-04-03 139 * struct vid_data - Stores voltage information data
13ad7701f Srinivas Pandruvada 2016-04-03 140 * @min: VID data for this platform corresponding to
13ad7701f Srinivas Pandruvada 2016-04-03 141 * the lowest P state
13ad7701f Srinivas Pandruvada 2016-04-03 142 * @max: VID data corresponding to the highest P State.
13ad7701f Srinivas Pandruvada 2016-04-03 143 * @turbo: VID data for turbo P state
13ad7701f Srinivas Pandruvada 2016-04-03 144 * @ratio: Ratio of (vid max - vid min) /
13ad7701f Srinivas Pandruvada 2016-04-03 145 * (max P state - Min P State)
13ad7701f Srinivas Pandruvada 2016-04-03 146 *
13ad7701f Srinivas Pandruvada 2016-04-03 147 * Stores the voltage data for DVFS (Dynamic Voltage and Frequency Scaling)
13ad7701f Srinivas Pandruvada 2016-04-03 148 * This data is used in Atom platforms, where in addition to target P state,
13ad7701f Srinivas Pandruvada 2016-04-03 149 * the voltage data needs to be specified to select next P State.
13ad7701f Srinivas Pandruvada 2016-04-03 150 */
007bea098 Dirk Brandewie 2013-12-18 151 struct vid_data {
21855ff5b Dirk Brandewie 2014-05-08 152 int min;
21855ff5b Dirk Brandewie 2014-05-08 153 int max;
21855ff5b Dirk Brandewie 2014-05-08 154 int turbo;
007bea098 Dirk Brandewie 2013-12-18 155 int32_t ratio;
007bea098 Dirk Brandewie 2013-12-18 156 };
007bea098 Dirk Brandewie 2013-12-18 157
13ad7701f Srinivas Pandruvada 2016-04-03 158 /**
13ad7701f Srinivas Pandruvada 2016-04-03 159 * struct _pid - Stores PID data
13ad7701f Srinivas Pandruvada 2016-04-03 160 * @setpoint: Target set point for busyness or performance
13ad7701f Srinivas Pandruvada 2016-04-03 161 * @integral: Storage for accumulated error values
13ad7701f Srinivas Pandruvada 2016-04-03 162 * @p_gain: PID proportional gain
13ad7701f Srinivas Pandruvada 2016-04-03 163 * @i_gain: PID integral gain
13ad7701f Srinivas Pandruvada 2016-04-03 164 * @d_gain: PID derivative gain
13ad7701f Srinivas Pandruvada 2016-04-03 165 * @deadband: PID deadband
13ad7701f Srinivas Pandruvada 2016-04-03 166 * @last_err: Last error storage for integral part of PID calculation
13ad7701f Srinivas Pandruvada 2016-04-03 167 *
13ad7701f Srinivas Pandruvada 2016-04-03 168 * Stores PID coefficients and last error for PID controller.
13ad7701f Srinivas Pandruvada 2016-04-03 169 */
93f0822df Dirk Brandewie 2013-02-06 170 struct _pid {
93f0822df Dirk Brandewie 2013-02-06 171 int setpoint;
93f0822df Dirk Brandewie 2013-02-06 172 int32_t integral;
93f0822df Dirk Brandewie 2013-02-06 173 int32_t p_gain;
93f0822df Dirk Brandewie 2013-02-06 174 int32_t i_gain;
93f0822df Dirk Brandewie 2013-02-06 175 int32_t d_gain;
93f0822df Dirk Brandewie 2013-02-06 176 int deadband;
d253d2a52 Brennan Shacklett 2013-10-21 177 int32_t last_err;
93f0822df Dirk Brandewie 2013-02-06 178 };
93f0822df Dirk Brandewie 2013-02-06 179
13ad7701f Srinivas Pandruvada 2016-04-03 180 /**
13ad7701f Srinivas Pandruvada 2016-04-03 181 * struct cpudata - Per CPU instance data storage
13ad7701f Srinivas Pandruvada 2016-04-03 182 * @cpu: CPU number for this instance data
13ad7701f Srinivas Pandruvada 2016-04-03 183 * @update_util: CPUFreq utility callback information
4578ee7e1 Chen Yu 2016-05-11 184 * @update_util_set: CPUFreq utility callback is set
13ad7701f Srinivas Pandruvada 2016-04-03 185 * @pstate: Stores P state limits for this CPU
13ad7701f Srinivas Pandruvada 2016-04-03 186 * @vid: Stores VID limits for this CPU
13ad7701f Srinivas Pandruvada 2016-04-03 187 * @pid: Stores PID parameters for this CPU
13ad7701f Srinivas Pandruvada 2016-04-03 188 * @last_sample_time: Last Sample time
13ad7701f Srinivas Pandruvada 2016-04-03 189 * @prev_aperf: Last APERF value read from APERF MSR
13ad7701f Srinivas Pandruvada 2016-04-03 190 * @prev_mperf: Last MPERF value read from MPERF MSR
13ad7701f Srinivas Pandruvada 2016-04-03 191 * @prev_tsc: Last timestamp counter (TSC) value
13ad7701f Srinivas Pandruvada 2016-04-03 192 * @prev_cummulative_iowait: IO Wait time difference from last and
13ad7701f Srinivas Pandruvada 2016-04-03 193 * current sample
13ad7701f Srinivas Pandruvada 2016-04-03 194 * @sample: Storage for storing last Sample data
9522a2ff9 Srinivas Pandruvada 2016-04-27 195 * @acpi_perf_data: Stores ACPI perf information read from _PSS
9522a2ff9 Srinivas Pandruvada 2016-04-27 196 * @valid_pss_table: Set to true for valid ACPI _PSS entries found
cc2eccd40 Srinivas Pandruvada 2016-09-01 197 * @cppc_data: Stores CPPC information for HWP capable CPUs
cc2eccd40 Srinivas Pandruvada 2016-09-01 198 * @valid_cppc_table: Set to true for valid CPPC entries are found
13ad7701f Srinivas Pandruvada 2016-04-03 199 *
13ad7701f Srinivas Pandruvada 2016-04-03 200 * This structure stores per CPU instance data for all CPUs.
13ad7701f Srinivas Pandruvada 2016-04-03 201 */
93f0822df Dirk Brandewie 2013-02-06 @202 struct cpudata {
93f0822df Dirk Brandewie 2013-02-06 203 int cpu;
93f0822df Dirk Brandewie 2013-02-06 204
a4675fbc4 Rafael J. Wysocki 2016-02-05 205 struct update_util_data update_util;
4578ee7e1 Chen Yu 2016-05-11 206 bool update_util_set;
93f0822df Dirk Brandewie 2013-02-06 207
93f0822df Dirk Brandewie 2013-02-06 208 struct pstate_data pstate;
007bea098 Dirk Brandewie 2013-12-18 209 struct vid_data vid;
93f0822df Dirk Brandewie 2013-02-06 210 struct _pid pid;
93f0822df Dirk Brandewie 2013-02-06 211
a4675fbc4 Rafael J. Wysocki 2016-02-05 212 u64 last_sample_time;
93f0822df Dirk Brandewie 2013-02-06 213 u64 prev_aperf;
93f0822df Dirk Brandewie 2013-02-06 214 u64 prev_mperf;
4055fad34 Doug Smythies 2015-04-11 215 u64 prev_tsc;
63d1d656a Philippe Longepe 2015-12-04 216 u64 prev_cummulative_iowait;
d37e2b764 Dirk Brandewie 2014-02-12 217 struct sample sample;
9522a2ff9 Srinivas Pandruvada 2016-04-27 218 #ifdef CONFIG_ACPI
9522a2ff9 Srinivas Pandruvada 2016-04-27 219 struct acpi_processor_performance acpi_perf_data;
9522a2ff9 Srinivas Pandruvada 2016-04-27 220 bool valid_pss_table;
cc2eccd40 Srinivas Pandruvada 2016-09-01 221 struct cppc_cpudata *cppc_data;
cc2eccd40 Srinivas Pandruvada 2016-09-01 222 bool valid_cppc_table;
9522a2ff9 Srinivas Pandruvada 2016-04-27 223 #endif
93f0822df Dirk Brandewie 2013-02-06 224 };
93f0822df Dirk Brandewie 2013-02-06 225
93f0822df Dirk Brandewie 2013-02-06 226 static struct cpudata **all_cpu_data;
13ad7701f Srinivas Pandruvada 2016-04-03 227
13ad7701f Srinivas Pandruvada 2016-04-03 228 /**
13ad7701f Srinivas Pandruvada 2016-04-03 229 * struct pid_adjust_policy - Stores static PID configuration data
13ad7701f Srinivas Pandruvada 2016-04-03 230 * @sample_rate_ms: PID calculation sample rate in ms
13ad7701f Srinivas Pandruvada 2016-04-03 231 * @sample_rate_ns: Sample rate calculation in ns
13ad7701f Srinivas Pandruvada 2016-04-03 232 * @deadband: PID deadband
13ad7701f Srinivas Pandruvada 2016-04-03 233 * @setpoint: PID Setpoint
13ad7701f Srinivas Pandruvada 2016-04-03 234 * @p_gain_pct: PID proportional gain
13ad7701f Srinivas Pandruvada 2016-04-03 235 * @i_gain_pct: PID integral gain
13ad7701f Srinivas Pandruvada 2016-04-03 236 * @d_gain_pct: PID derivative gain
13ad7701f Srinivas Pandruvada 2016-04-03 237 *
13ad7701f Srinivas Pandruvada 2016-04-03 238 * Stores per CPU model static PID configuration data.
13ad7701f Srinivas Pandruvada 2016-04-03 239 */
93f0822df Dirk Brandewie 2013-02-06 240 struct pstate_adjust_policy {
93f0822df Dirk Brandewie 2013-02-06 241 int sample_rate_ms;
a4675fbc4 Rafael J. Wysocki 2016-02-05 242 s64 sample_rate_ns;
93f0822df Dirk Brandewie 2013-02-06 243 int deadband;
93f0822df Dirk Brandewie 2013-02-06 244 int setpoint;
93f0822df Dirk Brandewie 2013-02-06 245 int p_gain_pct;
93f0822df Dirk Brandewie 2013-02-06 246 int d_gain_pct;
93f0822df Dirk Brandewie 2013-02-06 247 int i_gain_pct;
93f0822df Dirk Brandewie 2013-02-06 248 };
93f0822df Dirk Brandewie 2013-02-06 249
13ad7701f Srinivas Pandruvada 2016-04-03 250 /**
13ad7701f Srinivas Pandruvada 2016-04-03 251 * struct pstate_funcs - Per CPU model specific callbacks
13ad7701f Srinivas Pandruvada 2016-04-03 252 * @get_max: Callback to get maximum non turbo effective P state
13ad7701f Srinivas Pandruvada 2016-04-03 253 * @get_max_physical: Callback to get maximum non turbo physical P state
13ad7701f Srinivas Pandruvada 2016-04-03 254 * @get_min: Callback to get minimum P state
13ad7701f Srinivas Pandruvada 2016-04-03 255 * @get_turbo: Callback to get turbo P state
13ad7701f Srinivas Pandruvada 2016-04-03 256 * @get_scaling: Callback to get frequency scaling factor
13ad7701f Srinivas Pandruvada 2016-04-03 257 * @get_val: Callback to convert P state to actual MSR write value
13ad7701f Srinivas Pandruvada 2016-04-03 258 * @get_vid: Callback to get VID data for Atom platforms
13ad7701f Srinivas Pandruvada 2016-04-03 259 * @get_target_pstate: Callback to a function to calculate next P state to use
13ad7701f Srinivas Pandruvada 2016-04-03 260 *
13ad7701f Srinivas Pandruvada 2016-04-03 261 * Core and Atom CPU models have different way to get P State limits. This
13ad7701f Srinivas Pandruvada 2016-04-03 262 * structure is used to store those callbacks.
13ad7701f Srinivas Pandruvada 2016-04-03 263 */
016c81508 Dirk Brandewie 2013-10-21 264 struct pstate_funcs {
016c81508 Dirk Brandewie 2013-10-21 265 int (*get_max)(void);
3bcc6fa97 Srinivas Pandruvada 2015-10-14 266 int (*get_max_physical)(void);
016c81508 Dirk Brandewie 2013-10-21 267 int (*get_min)(void);
016c81508 Dirk Brandewie 2013-10-21 268 int (*get_turbo)(void);
b27580b05 Dirk Brandewie 2014-10-13 269 int (*get_scaling)(void);
fdfdb2b13 Rafael J. Wysocki 2016-03-18 270 u64 (*get_val)(struct cpudata*, int pstate);
007bea098 Dirk Brandewie 2013-12-18 271 void (*get_vid)(struct cpudata *);
157386b6f Philippe Longepe 2015-12-04 272 int32_t (*get_target_pstate)(struct cpudata *);
93f0822df Dirk Brandewie 2013-02-06 273 };
93f0822df Dirk Brandewie 2013-02-06 274
13ad7701f Srinivas Pandruvada 2016-04-03 275 /**
13ad7701f Srinivas Pandruvada 2016-04-03 276 * struct cpu_defaults- Per CPU model default config data
13ad7701f Srinivas Pandruvada 2016-04-03 277 * @pid_policy: PID config data
13ad7701f Srinivas Pandruvada 2016-04-03 278 * @funcs: Callback function data
13ad7701f Srinivas Pandruvada 2016-04-03 279 */
016c81508 Dirk Brandewie 2013-10-21 280 struct cpu_defaults {
016c81508 Dirk Brandewie 2013-10-21 281 struct pstate_adjust_policy pid_policy;
016c81508 Dirk Brandewie 2013-10-21 282 struct pstate_funcs funcs;
016c81508 Dirk Brandewie 2013-10-21 283 };
016c81508 Dirk Brandewie 2013-10-21 284
157386b6f Philippe Longepe 2015-12-04 285 static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu);
e70eed2b6 Philippe Longepe 2015-12-04 286 static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu);
157386b6f Philippe Longepe 2015-12-04 287
4a7cb7a96 Jisheng Zhang 2016-06-27 288 static struct pstate_adjust_policy pid_params __read_mostly;
4a7cb7a96 Jisheng Zhang 2016-06-27 289 static struct pstate_funcs pstate_funcs __read_mostly;
4a7cb7a96 Jisheng Zhang 2016-06-27 290 static int hwp_active __read_mostly;
016c81508 Dirk Brandewie 2013-10-21 291
9522a2ff9 Srinivas Pandruvada 2016-04-27 292 #ifdef CONFIG_ACPI
9522a2ff9 Srinivas Pandruvada 2016-04-27 293 static bool acpi_ppc;
9522a2ff9 Srinivas Pandruvada 2016-04-27 294 #endif
13ad7701f Srinivas Pandruvada 2016-04-03 295
13ad7701f Srinivas Pandruvada 2016-04-03 296 /**
13ad7701f Srinivas Pandruvada 2016-04-03 297 * struct perf_limits - Store user and policy limits
13ad7701f Srinivas Pandruvada 2016-04-03 298 * @no_turbo: User requested turbo state from intel_pstate sysfs
13ad7701f Srinivas Pandruvada 2016-04-03 299 * @turbo_disabled: Platform turbo status either from msr
13ad7701f Srinivas Pandruvada 2016-04-03 300 * MSR_IA32_MISC_ENABLE or when maximum available pstate
13ad7701f Srinivas Pandruvada 2016-04-03 301 * matches the maximum turbo pstate
13ad7701f Srinivas Pandruvada 2016-04-03 302 * @max_perf_pct: Effective maximum performance limit in percentage, this
13ad7701f Srinivas Pandruvada 2016-04-03 303 * is minimum of either limits enforced by cpufreq policy
13ad7701f Srinivas Pandruvada 2016-04-03 304 * or limits from user set limits via intel_pstate sysfs
13ad7701f Srinivas Pandruvada 2016-04-03 305 * @min_perf_pct: Effective minimum performance limit in percentage, this
13ad7701f Srinivas Pandruvada 2016-04-03 306 * is maximum of either limits enforced by cpufreq policy
13ad7701f Srinivas Pandruvada 2016-04-03 307 * or limits from user set limits via intel_pstate sysfs
13ad7701f Srinivas Pandruvada 2016-04-03 308 * @max_perf: This is a scaled value between 0 to 255 for max_perf_pct
13ad7701f Srinivas Pandruvada 2016-04-03 309 * This value is used to limit max pstate
13ad7701f Srinivas Pandruvada 2016-04-03 310 * @min_perf: This is a scaled value between 0 to 255 for min_perf_pct
13ad7701f Srinivas Pandruvada 2016-04-03 311 * This value is used to limit min pstate
13ad7701f Srinivas Pandruvada 2016-04-03 312 * @max_policy_pct: The maximum performance in percentage enforced by
13ad7701f Srinivas Pandruvada 2016-04-03 313 * cpufreq setpolicy interface
13ad7701f Srinivas Pandruvada 2016-04-03 314 * @max_sysfs_pct: The maximum performance in percentage enforced by
13ad7701f Srinivas Pandruvada 2016-04-03 315 * intel pstate sysfs interface
13ad7701f Srinivas Pandruvada 2016-04-03 316 * @min_policy_pct: The minimum performance in percentage enforced by
13ad7701f Srinivas Pandruvada 2016-04-03 317 * cpufreq setpolicy interface
13ad7701f Srinivas Pandruvada 2016-04-03 318 * @min_sysfs_pct: The minimum performance in percentage enforced by
13ad7701f Srinivas Pandruvada 2016-04-03 319 * intel pstate sysfs interface
13ad7701f Srinivas Pandruvada 2016-04-03 320 *
13ad7701f Srinivas Pandruvada 2016-04-03 321 * Storage for user and policy defined limits.
13ad7701f Srinivas Pandruvada 2016-04-03 322 */
93f0822df Dirk Brandewie 2013-02-06 323 struct perf_limits {
93f0822df Dirk Brandewie 2013-02-06 324 int no_turbo;
dd5fbf70f Dirk Brandewie 2014-06-20 325 int turbo_disabled;
93f0822df Dirk Brandewie 2013-02-06 326 int max_perf_pct;
93f0822df Dirk Brandewie 2013-02-06 327 int min_perf_pct;
93f0822df Dirk Brandewie 2013-02-06 328 int32_t max_perf;
93f0822df Dirk Brandewie 2013-02-06 329 int32_t min_perf;
d8f469e9c Dirk Brandewie 2013-05-07 330 int max_policy_pct;
d8f469e9c Dirk Brandewie 2013-05-07 331 int max_sysfs_pct;
a04759924 Kristen Carlson Accardi 2015-01-29 332 int min_policy_pct;
a04759924 Kristen Carlson Accardi 2015-01-29 333 int min_sysfs_pct;
93f0822df Dirk Brandewie 2013-02-06 334 };
93f0822df Dirk Brandewie 2013-02-06 335
51443fbf3 Prarit Bhargava 2015-10-15 336 static struct perf_limits performance_limits = {
51443fbf3 Prarit Bhargava 2015-10-15 337 .no_turbo = 0,
51443fbf3 Prarit Bhargava 2015-10-15 338 .turbo_disabled = 0,
51443fbf3 Prarit Bhargava 2015-10-15 339 .max_perf_pct = 100,
51443fbf3 Prarit Bhargava 2015-10-15 340 .max_perf = int_tofp(1),
51443fbf3 Prarit Bhargava 2015-10-15 341 .min_perf_pct = 100,
51443fbf3 Prarit Bhargava 2015-10-15 342 .min_perf = int_tofp(1),
51443fbf3 Prarit Bhargava 2015-10-15 343 .max_policy_pct = 100,
51443fbf3 Prarit Bhargava 2015-10-15 344 .max_sysfs_pct = 100,
51443fbf3 Prarit Bhargava 2015-10-15 345 .min_policy_pct = 0,
51443fbf3 Prarit Bhargava 2015-10-15 346 .min_sysfs_pct = 0,
51443fbf3 Prarit Bhargava 2015-10-15 347 };
51443fbf3 Prarit Bhargava 2015-10-15 348
51443fbf3 Prarit Bhargava 2015-10-15 349 static struct perf_limits powersave_limits = {
93f0822df Dirk Brandewie 2013-02-06 350 .no_turbo = 0,
4521e1a0c Gabriele Mazzotta 2014-10-13 351 .turbo_disabled = 0,
93f0822df Dirk Brandewie 2013-02-06 352 .max_perf_pct = 100,
93f0822df Dirk Brandewie 2013-02-06 353 .max_perf = int_tofp(1),
93f0822df Dirk Brandewie 2013-02-06 354 .min_perf_pct = 0,
93f0822df Dirk Brandewie 2013-02-06 355 .min_perf = 0,
d8f469e9c Dirk Brandewie 2013-05-07 356 .max_policy_pct = 100,
d8f469e9c Dirk Brandewie 2013-05-07 357 .max_sysfs_pct = 100,
a04759924 Kristen Carlson Accardi 2015-01-29 358 .min_policy_pct = 0,
a04759924 Kristen Carlson Accardi 2015-01-29 359 .min_sysfs_pct = 0,
93f0822df Dirk Brandewie 2013-02-06 360 };
93f0822df Dirk Brandewie 2013-02-06 361
51443fbf3 Prarit Bhargava 2015-10-15 362 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
51443fbf3 Prarit Bhargava 2015-10-15 363 static struct perf_limits *limits = &performance_limits;
51443fbf3 Prarit Bhargava 2015-10-15 364 #else
51443fbf3 Prarit Bhargava 2015-10-15 365 static struct perf_limits *limits = &powersave_limits;
51443fbf3 Prarit Bhargava 2015-10-15 366 #endif
51443fbf3 Prarit Bhargava 2015-10-15 367
9522a2ff9 Srinivas Pandruvada 2016-04-27 368 #ifdef CONFIG_ACPI
cc2eccd40 Srinivas Pandruvada 2016-09-01 369 static cpumask_t cppc_rd_cpu_mask;
cc2eccd40 Srinivas Pandruvada 2016-09-01 370
cc2eccd40 Srinivas Pandruvada 2016-09-01 371 /* Call set_sched_itmt from a work function to be able to use hotplug locks */
cc2eccd40 Srinivas Pandruvada 2016-09-01 372 static void intel_pstste_sched_itmt_work_fn(struct work_struct *work)
cc2eccd40 Srinivas Pandruvada 2016-09-01 373 {
cc2eccd40 Srinivas Pandruvada 2016-09-01 374 set_sched_itmt(true);
cc2eccd40 Srinivas Pandruvada 2016-09-01 375 }
cc2eccd40 Srinivas Pandruvada 2016-09-01 376
cc2eccd40 Srinivas Pandruvada 2016-09-01 377 static DECLARE_WORK(sched_itmt_work, intel_pstste_sched_itmt_work_fn);
2b3ec7650 Srinivas Pandruvada 2016-04-27 378
2b3ec7650 Srinivas Pandruvada 2016-04-27 379 static bool intel_pstate_get_ppc_enable_status(void)
2b3ec7650 Srinivas Pandruvada 2016-04-27 380 {
2b3ec7650 Srinivas Pandruvada 2016-04-27 381 if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER ||
2b3ec7650 Srinivas Pandruvada 2016-04-27 382 acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER)
2b3ec7650 Srinivas Pandruvada 2016-04-27 383 return true;
2b3ec7650 Srinivas Pandruvada 2016-04-27 384
2b3ec7650 Srinivas Pandruvada 2016-04-27 385 return acpi_ppc;
2b3ec7650 Srinivas Pandruvada 2016-04-27 386 }
2b3ec7650 Srinivas Pandruvada 2016-04-27 387
9522a2ff9 Srinivas Pandruvada 2016-04-27 388 static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
9522a2ff9 Srinivas Pandruvada 2016-04-27 389 {
9522a2ff9 Srinivas Pandruvada 2016-04-27 390 struct cpudata *cpu;
9522a2ff9 Srinivas Pandruvada 2016-04-27 391 int ret;
9522a2ff9 Srinivas Pandruvada 2016-04-27 392 int i;
9522a2ff9 Srinivas Pandruvada 2016-04-27 393
cc2eccd40 Srinivas Pandruvada 2016-09-01 394 cpu = all_cpu_data[policy->cpu];
cc2eccd40 Srinivas Pandruvada 2016-09-01 395
cc2eccd40 Srinivas Pandruvada 2016-09-01 396 if (hwp_active) {
cc2eccd40 Srinivas Pandruvada 2016-09-01 397 struct cppc_perf_caps *perf_caps;
cc2eccd40 Srinivas Pandruvada 2016-09-01 398
cc2eccd40 Srinivas Pandruvada 2016-09-01 @399 cpu->cppc_data = kzalloc(sizeof(struct cppc_cpudata),
cc2eccd40 Srinivas Pandruvada 2016-09-01 400 GFP_KERNEL);
cc2eccd40 Srinivas Pandruvada 2016-09-01 401 if (!cpu->cppc_data)
e59a8f7ff Srinivas Pandruvada 2016-05-04 402 return;

:::::: The code at line 202 was first introduced by commit
:::::: 93f0822dff5dae2f0a2645f16300c14af41ca777 cpufreq/x86: Add P-state driver for sandy bridge.

:::::: TO: Dirk Brandewie <dirk.brandewie@xxxxxxxxx>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data