intel_pstate.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  1. /*
  2. * intel_pstate.c: Native P state management for Intel processors
  3. *
  4. * (C) Copyright 2012 Intel Corporation
  5. * Author: Dirk Brandewie <dirk.j.brandewie@intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; version 2
  10. * of the License.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/kernel_stat.h>
  14. #include <linux/module.h>
  15. #include <linux/ktime.h>
  16. #include <linux/hrtimer.h>
  17. #include <linux/tick.h>
  18. #include <linux/slab.h>
  19. #include <linux/sched.h>
  20. #include <linux/list.h>
  21. #include <linux/cpu.h>
  22. #include <linux/cpufreq.h>
  23. #include <linux/sysfs.h>
  24. #include <linux/types.h>
  25. #include <linux/fs.h>
  26. #include <linux/debugfs.h>
  27. #include <linux/acpi.h>
  28. #include <linux/vmalloc.h>
  29. #include <trace/events/power.h>
  30. #include <asm/div64.h>
  31. #include <asm/msr.h>
  32. #include <asm/cpu_device_id.h>
  33. #include <asm/cpufeature.h>
  34. #define BYT_RATIOS 0x66a
  35. #define BYT_VIDS 0x66b
  36. #define BYT_TURBO_RATIOS 0x66c
  37. #define BYT_TURBO_VIDS 0x66d
  38. #define FRAC_BITS 8
  39. #define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
  40. #define fp_toint(X) ((X) >> FRAC_BITS)
  41. static inline int32_t mul_fp(int32_t x, int32_t y)
  42. {
  43. return ((int64_t)x * (int64_t)y) >> FRAC_BITS;
  44. }
  45. static inline int32_t div_fp(s64 x, s64 y)
  46. {
  47. return div64_s64((int64_t)x << FRAC_BITS, y);
  48. }
  49. static inline int ceiling_fp(int32_t x)
  50. {
  51. int mask, ret;
  52. ret = fp_toint(x);
  53. mask = (1 << FRAC_BITS) - 1;
  54. if (x & mask)
  55. ret += 1;
  56. return ret;
  57. }
  58. struct sample {
  59. int32_t core_pct_busy;
  60. u64 aperf;
  61. u64 mperf;
  62. u64 tsc;
  63. int freq;
  64. ktime_t time;
  65. };
  66. struct pstate_data {
  67. int current_pstate;
  68. int min_pstate;
  69. int max_pstate;
  70. int scaling;
  71. int turbo_pstate;
  72. };
  73. struct vid_data {
  74. int min;
  75. int max;
  76. int turbo;
  77. int32_t ratio;
  78. };
  79. struct _pid {
  80. int setpoint;
  81. int32_t integral;
  82. int32_t p_gain;
  83. int32_t i_gain;
  84. int32_t d_gain;
  85. int deadband;
  86. int32_t last_err;
  87. };
  88. struct cpudata {
  89. int cpu;
  90. struct timer_list timer;
  91. struct pstate_data pstate;
  92. struct vid_data vid;
  93. struct _pid pid;
  94. ktime_t last_sample_time;
  95. u64 prev_aperf;
  96. u64 prev_mperf;
  97. u64 prev_tsc;
  98. struct sample sample;
  99. };
  100. static struct cpudata **all_cpu_data;
  101. struct pstate_adjust_policy {
  102. int sample_rate_ms;
  103. int deadband;
  104. int setpoint;
  105. int p_gain_pct;
  106. int d_gain_pct;
  107. int i_gain_pct;
  108. };
  109. struct pstate_funcs {
  110. int (*get_max)(void);
  111. int (*get_min)(void);
  112. int (*get_turbo)(void);
  113. int (*get_scaling)(void);
  114. void (*set)(struct cpudata*, int pstate);
  115. void (*get_vid)(struct cpudata *);
  116. };
  117. struct cpu_defaults {
  118. struct pstate_adjust_policy pid_policy;
  119. struct pstate_funcs funcs;
  120. };
  121. static struct pstate_adjust_policy pid_params;
  122. static struct pstate_funcs pstate_funcs;
  123. static int hwp_active;
  124. struct perf_limits {
  125. int no_turbo;
  126. int turbo_disabled;
  127. int max_perf_pct;
  128. int min_perf_pct;
  129. int32_t max_perf;
  130. int32_t min_perf;
  131. int max_policy_pct;
  132. int max_sysfs_pct;
  133. int min_policy_pct;
  134. int min_sysfs_pct;
  135. };
  136. static struct perf_limits limits = {
  137. .no_turbo = 0,
  138. .turbo_disabled = 0,
  139. .max_perf_pct = 100,
  140. .max_perf = int_tofp(1),
  141. .min_perf_pct = 0,
  142. .min_perf = 0,
  143. .max_policy_pct = 100,
  144. .max_sysfs_pct = 100,
  145. .min_policy_pct = 0,
  146. .min_sysfs_pct = 0,
  147. };
  148. static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
  149. int deadband, int integral) {
  150. pid->setpoint = setpoint;
  151. pid->deadband = deadband;
  152. pid->integral = int_tofp(integral);
  153. pid->last_err = int_tofp(setpoint) - int_tofp(busy);
  154. }
  155. static inline void pid_p_gain_set(struct _pid *pid, int percent)
  156. {
  157. pid->p_gain = div_fp(int_tofp(percent), int_tofp(100));
  158. }
  159. static inline void pid_i_gain_set(struct _pid *pid, int percent)
  160. {
  161. pid->i_gain = div_fp(int_tofp(percent), int_tofp(100));
  162. }
  163. static inline void pid_d_gain_set(struct _pid *pid, int percent)
  164. {
  165. pid->d_gain = div_fp(int_tofp(percent), int_tofp(100));
  166. }
  167. static signed int pid_calc(struct _pid *pid, int32_t busy)
  168. {
  169. signed int result;
  170. int32_t pterm, dterm, fp_error;
  171. int32_t integral_limit;
  172. fp_error = int_tofp(pid->setpoint) - busy;
  173. if (abs(fp_error) <= int_tofp(pid->deadband))
  174. return 0;
  175. pterm = mul_fp(pid->p_gain, fp_error);
  176. pid->integral += fp_error;
  177. /*
  178. * We limit the integral here so that it will never
  179. * get higher than 30. This prevents it from becoming
  180. * too large an input over long periods of time and allows
  181. * it to get factored out sooner.
  182. *
  183. * The value of 30 was chosen through experimentation.
  184. */
  185. integral_limit = int_tofp(30);
  186. if (pid->integral > integral_limit)
  187. pid->integral = integral_limit;
  188. if (pid->integral < -integral_limit)
  189. pid->integral = -integral_limit;
  190. dterm = mul_fp(pid->d_gain, fp_error - pid->last_err);
  191. pid->last_err = fp_error;
  192. result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm;
  193. result = result + (1 << (FRAC_BITS-1));
  194. return (signed int)fp_toint(result);
  195. }
  196. static inline void intel_pstate_busy_pid_reset(struct cpudata *cpu)
  197. {
  198. pid_p_gain_set(&cpu->pid, pid_params.p_gain_pct);
  199. pid_d_gain_set(&cpu->pid, pid_params.d_gain_pct);
  200. pid_i_gain_set(&cpu->pid, pid_params.i_gain_pct);
  201. pid_reset(&cpu->pid, pid_params.setpoint, 100, pid_params.deadband, 0);
  202. }
  203. static inline void intel_pstate_reset_all_pid(void)
  204. {
  205. unsigned int cpu;
  206. for_each_online_cpu(cpu) {
  207. if (all_cpu_data[cpu])
  208. intel_pstate_busy_pid_reset(all_cpu_data[cpu]);
  209. }
  210. }
  211. static inline void update_turbo_state(void)
  212. {
  213. u64 misc_en;
  214. struct cpudata *cpu;
  215. cpu = all_cpu_data[0];
  216. rdmsrl(MSR_IA32_MISC_ENABLE, misc_en);
  217. limits.turbo_disabled =
  218. (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE ||
  219. cpu->pstate.max_pstate == cpu->pstate.turbo_pstate);
  220. }
  221. static void intel_pstate_hwp_set(void)
  222. {
  223. int min, hw_min, max, hw_max, cpu, range, adj_range;
  224. u64 value, cap;
  225. rdmsrl(MSR_HWP_CAPABILITIES, cap);
  226. hw_min = HWP_LOWEST_PERF(cap);
  227. hw_max = HWP_HIGHEST_PERF(cap);
  228. range = hw_max - hw_min;
  229. get_online_cpus();
  230. for_each_online_cpu(cpu) {
  231. rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value);
  232. adj_range = limits.min_perf_pct * range / 100;
  233. min = hw_min + adj_range;
  234. value &= ~HWP_MIN_PERF(~0L);
  235. value |= HWP_MIN_PERF(min);
  236. adj_range = limits.max_perf_pct * range / 100;
  237. max = hw_min + adj_range;
  238. if (limits.no_turbo) {
  239. hw_max = HWP_GUARANTEED_PERF(cap);
  240. if (hw_max < max)
  241. max = hw_max;
  242. }
  243. value &= ~HWP_MAX_PERF(~0L);
  244. value |= HWP_MAX_PERF(max);
  245. wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
  246. }
  247. put_online_cpus();
  248. }
  249. /************************** debugfs begin ************************/
  250. static int pid_param_set(void *data, u64 val)
  251. {
  252. *(u32 *)data = val;
  253. intel_pstate_reset_all_pid();
  254. return 0;
  255. }
  256. static int pid_param_get(void *data, u64 *val)
  257. {
  258. *val = *(u32 *)data;
  259. return 0;
  260. }
  261. DEFINE_SIMPLE_ATTRIBUTE(fops_pid_param, pid_param_get, pid_param_set, "%llu\n");
  262. struct pid_param {
  263. char *name;
  264. void *value;
  265. };
  266. static struct pid_param pid_files[] = {
  267. {"sample_rate_ms", &pid_params.sample_rate_ms},
  268. {"d_gain_pct", &pid_params.d_gain_pct},
  269. {"i_gain_pct", &pid_params.i_gain_pct},
  270. {"deadband", &pid_params.deadband},
  271. {"setpoint", &pid_params.setpoint},
  272. {"p_gain_pct", &pid_params.p_gain_pct},
  273. {NULL, NULL}
  274. };
  275. static void __init intel_pstate_debug_expose_params(void)
  276. {
  277. struct dentry *debugfs_parent;
  278. int i = 0;
  279. if (hwp_active)
  280. return;
  281. debugfs_parent = debugfs_create_dir("pstate_snb", NULL);
  282. if (IS_ERR_OR_NULL(debugfs_parent))
  283. return;
  284. while (pid_files[i].name) {
  285. debugfs_create_file(pid_files[i].name, 0660,
  286. debugfs_parent, pid_files[i].value,
  287. &fops_pid_param);
  288. i++;
  289. }
  290. }
  291. /************************** debugfs end ************************/
  292. /************************** sysfs begin ************************/
  293. #define show_one(file_name, object) \
  294. static ssize_t show_##file_name \
  295. (struct kobject *kobj, struct attribute *attr, char *buf) \
  296. { \
  297. return sprintf(buf, "%u\n", limits.object); \
  298. }
  299. static ssize_t show_turbo_pct(struct kobject *kobj,
  300. struct attribute *attr, char *buf)
  301. {
  302. struct cpudata *cpu;
  303. int total, no_turbo, turbo_pct;
  304. uint32_t turbo_fp;
  305. cpu = all_cpu_data[0];
  306. total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
  307. no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1;
  308. turbo_fp = div_fp(int_tofp(no_turbo), int_tofp(total));
  309. turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100)));
  310. return sprintf(buf, "%u\n", turbo_pct);
  311. }
  312. static ssize_t show_num_pstates(struct kobject *kobj,
  313. struct attribute *attr, char *buf)
  314. {
  315. struct cpudata *cpu;
  316. int total;
  317. cpu = all_cpu_data[0];
  318. total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
  319. return sprintf(buf, "%u\n", total);
  320. }
  321. static ssize_t show_no_turbo(struct kobject *kobj,
  322. struct attribute *attr, char *buf)
  323. {
  324. ssize_t ret;
  325. update_turbo_state();
  326. if (limits.turbo_disabled)
  327. ret = sprintf(buf, "%u\n", limits.turbo_disabled);
  328. else
  329. ret = sprintf(buf, "%u\n", limits.no_turbo);
  330. return ret;
  331. }
  332. static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
  333. const char *buf, size_t count)
  334. {
  335. unsigned int input;
  336. int ret;
  337. ret = sscanf(buf, "%u", &input);
  338. if (ret != 1)
  339. return -EINVAL;
  340. update_turbo_state();
  341. if (limits.turbo_disabled) {
  342. pr_warn("intel_pstate: Turbo disabled by BIOS or unavailable on processor\n");
  343. return -EPERM;
  344. }
  345. limits.no_turbo = clamp_t(int, input, 0, 1);
  346. if (hwp_active)
  347. intel_pstate_hwp_set();
  348. return count;
  349. }
  350. static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
  351. const char *buf, size_t count)
  352. {
  353. unsigned int input;
  354. int ret;
  355. ret = sscanf(buf, "%u", &input);
  356. if (ret != 1)
  357. return -EINVAL;
  358. limits.max_sysfs_pct = clamp_t(int, input, 0 , 100);
  359. limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
  360. limits.max_perf_pct = max(limits.min_policy_pct, limits.max_perf_pct);
  361. limits.max_perf_pct = max(limits.min_perf_pct, limits.max_perf_pct);
  362. limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
  363. if (hwp_active)
  364. intel_pstate_hwp_set();
  365. return count;
  366. }
  367. static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
  368. const char *buf, size_t count)
  369. {
  370. unsigned int input;
  371. int ret;
  372. ret = sscanf(buf, "%u", &input);
  373. if (ret != 1)
  374. return -EINVAL;
  375. limits.min_sysfs_pct = clamp_t(int, input, 0 , 100);
  376. limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct);
  377. limits.min_perf_pct = min(limits.max_policy_pct, limits.min_perf_pct);
  378. limits.min_perf_pct = min(limits.max_perf_pct, limits.min_perf_pct);
  379. limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
  380. if (hwp_active)
  381. intel_pstate_hwp_set();
  382. return count;
  383. }
  384. show_one(max_perf_pct, max_perf_pct);
  385. show_one(min_perf_pct, min_perf_pct);
  386. define_one_global_rw(no_turbo);
  387. define_one_global_rw(max_perf_pct);
  388. define_one_global_rw(min_perf_pct);
  389. define_one_global_ro(turbo_pct);
  390. define_one_global_ro(num_pstates);
  391. static struct attribute *intel_pstate_attributes[] = {
  392. &no_turbo.attr,
  393. &max_perf_pct.attr,
  394. &min_perf_pct.attr,
  395. &turbo_pct.attr,
  396. &num_pstates.attr,
  397. NULL
  398. };
  399. static struct attribute_group intel_pstate_attr_group = {
  400. .attrs = intel_pstate_attributes,
  401. };
  402. static void __init intel_pstate_sysfs_expose_params(void)
  403. {
  404. struct kobject *intel_pstate_kobject;
  405. int rc;
  406. intel_pstate_kobject = kobject_create_and_add("intel_pstate",
  407. &cpu_subsys.dev_root->kobj);
  408. BUG_ON(!intel_pstate_kobject);
  409. rc = sysfs_create_group(intel_pstate_kobject, &intel_pstate_attr_group);
  410. BUG_ON(rc);
  411. }
  412. /************************** sysfs end ************************/
  413. static void intel_pstate_hwp_enable(struct cpudata *cpudata)
  414. {
  415. pr_info("intel_pstate: HWP enabled\n");
  416. wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
  417. }
  418. static int byt_get_min_pstate(void)
  419. {
  420. u64 value;
  421. rdmsrl(BYT_RATIOS, value);
  422. return (value >> 8) & 0x7F;
  423. }
  424. static int byt_get_max_pstate(void)
  425. {
  426. u64 value;
  427. rdmsrl(BYT_RATIOS, value);
  428. return (value >> 16) & 0x7F;
  429. }
  430. static int byt_get_turbo_pstate(void)
  431. {
  432. u64 value;
  433. rdmsrl(BYT_TURBO_RATIOS, value);
  434. return value & 0x7F;
  435. }
  436. static void byt_set_pstate(struct cpudata *cpudata, int pstate)
  437. {
  438. u64 val;
  439. int32_t vid_fp;
  440. u32 vid;
  441. val = (u64)pstate << 8;
  442. if (limits.no_turbo && !limits.turbo_disabled)
  443. val |= (u64)1 << 32;
  444. vid_fp = cpudata->vid.min + mul_fp(
  445. int_tofp(pstate - cpudata->pstate.min_pstate),
  446. cpudata->vid.ratio);
  447. vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max);
  448. vid = ceiling_fp(vid_fp);
  449. if (pstate > cpudata->pstate.max_pstate)
  450. vid = cpudata->vid.turbo;
  451. val |= vid;
  452. wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);
  453. }
  454. #define BYT_BCLK_FREQS 5
  455. static int byt_freq_table[BYT_BCLK_FREQS] = { 833, 1000, 1333, 1167, 800};
  456. static int byt_get_scaling(void)
  457. {
  458. u64 value;
  459. int i;
  460. rdmsrl(MSR_FSB_FREQ, value);
  461. i = value & 0x3;
  462. BUG_ON(i > BYT_BCLK_FREQS);
  463. return byt_freq_table[i] * 100;
  464. }
  465. static void byt_get_vid(struct cpudata *cpudata)
  466. {
  467. u64 value;
  468. rdmsrl(BYT_VIDS, value);
  469. cpudata->vid.min = int_tofp((value >> 8) & 0x7f);
  470. cpudata->vid.max = int_tofp((value >> 16) & 0x7f);
  471. cpudata->vid.ratio = div_fp(
  472. cpudata->vid.max - cpudata->vid.min,
  473. int_tofp(cpudata->pstate.max_pstate -
  474. cpudata->pstate.min_pstate));
  475. rdmsrl(BYT_TURBO_VIDS, value);
  476. cpudata->vid.turbo = value & 0x7f;
  477. }
  478. static int core_get_min_pstate(void)
  479. {
  480. u64 value;
  481. rdmsrl(MSR_PLATFORM_INFO, value);
  482. return (value >> 40) & 0xFF;
  483. }
  484. static int core_get_max_pstate(void)
  485. {
  486. u64 value;
  487. rdmsrl(MSR_PLATFORM_INFO, value);
  488. return (value >> 8) & 0xFF;
  489. }
  490. static int core_get_turbo_pstate(void)
  491. {
  492. u64 value;
  493. int nont, ret;
  494. rdmsrl(MSR_NHM_TURBO_RATIO_LIMIT, value);
  495. nont = core_get_max_pstate();
  496. ret = (value) & 255;
  497. if (ret <= nont)
  498. ret = nont;
  499. return ret;
  500. }
  501. static inline int core_get_scaling(void)
  502. {
  503. return 100000;
  504. }
  505. static void core_set_pstate(struct cpudata *cpudata, int pstate)
  506. {
  507. u64 val;
  508. val = (u64)pstate << 8;
  509. if (limits.no_turbo && !limits.turbo_disabled)
  510. val |= (u64)1 << 32;
  511. wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);
  512. }
  513. static int knl_get_turbo_pstate(void)
  514. {
  515. u64 value;
  516. int nont, ret;
  517. rdmsrl(MSR_NHM_TURBO_RATIO_LIMIT, value);
  518. nont = core_get_max_pstate();
  519. ret = (((value) >> 8) & 0xFF);
  520. if (ret <= nont)
  521. ret = nont;
  522. return ret;
  523. }
  524. static struct cpu_defaults core_params = {
  525. .pid_policy = {
  526. .sample_rate_ms = 10,
  527. .deadband = 0,
  528. .setpoint = 97,
  529. .p_gain_pct = 20,
  530. .d_gain_pct = 0,
  531. .i_gain_pct = 0,
  532. },
  533. .funcs = {
  534. .get_max = core_get_max_pstate,
  535. .get_min = core_get_min_pstate,
  536. .get_turbo = core_get_turbo_pstate,
  537. .get_scaling = core_get_scaling,
  538. .set = core_set_pstate,
  539. },
  540. };
  541. static struct cpu_defaults byt_params = {
  542. .pid_policy = {
  543. .sample_rate_ms = 10,
  544. .deadband = 0,
  545. .setpoint = 60,
  546. .p_gain_pct = 14,
  547. .d_gain_pct = 0,
  548. .i_gain_pct = 4,
  549. },
  550. .funcs = {
  551. .get_max = byt_get_max_pstate,
  552. .get_min = byt_get_min_pstate,
  553. .get_turbo = byt_get_turbo_pstate,
  554. .set = byt_set_pstate,
  555. .get_scaling = byt_get_scaling,
  556. .get_vid = byt_get_vid,
  557. },
  558. };
  559. static struct cpu_defaults knl_params = {
  560. .pid_policy = {
  561. .sample_rate_ms = 10,
  562. .deadband = 0,
  563. .setpoint = 97,
  564. .p_gain_pct = 20,
  565. .d_gain_pct = 0,
  566. .i_gain_pct = 0,
  567. },
  568. .funcs = {
  569. .get_max = core_get_max_pstate,
  570. .get_min = core_get_min_pstate,
  571. .get_turbo = knl_get_turbo_pstate,
  572. .get_scaling = core_get_scaling,
  573. .set = core_set_pstate,
  574. },
  575. };
  576. static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
  577. {
  578. int max_perf = cpu->pstate.turbo_pstate;
  579. int max_perf_adj;
  580. int min_perf;
  581. if (limits.no_turbo || limits.turbo_disabled)
  582. max_perf = cpu->pstate.max_pstate;
  583. /*
  584. * performance can be limited by user through sysfs, by cpufreq
  585. * policy, or by cpu specific default values determined through
  586. * experimentation.
  587. */
  588. max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits.max_perf));
  589. *max = clamp_t(int, max_perf_adj,
  590. cpu->pstate.min_pstate, cpu->pstate.turbo_pstate);
  591. min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits.min_perf));
  592. *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
  593. }
  594. static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate, bool force)
  595. {
  596. int max_perf, min_perf;
  597. if (force) {
  598. update_turbo_state();
  599. intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
  600. pstate = clamp_t(int, pstate, min_perf, max_perf);
  601. if (pstate == cpu->pstate.current_pstate)
  602. return;
  603. }
  604. trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
  605. cpu->pstate.current_pstate = pstate;
  606. pstate_funcs.set(cpu, pstate);
  607. }
  608. static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
  609. {
  610. cpu->pstate.min_pstate = pstate_funcs.get_min();
  611. cpu->pstate.max_pstate = pstate_funcs.get_max();
  612. cpu->pstate.turbo_pstate = pstate_funcs.get_turbo();
  613. cpu->pstate.scaling = pstate_funcs.get_scaling();
  614. if (pstate_funcs.get_vid)
  615. pstate_funcs.get_vid(cpu);
  616. intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false);
  617. }
  618. static inline void intel_pstate_calc_busy(struct cpudata *cpu)
  619. {
  620. struct sample *sample = &cpu->sample;
  621. int64_t core_pct;
  622. core_pct = int_tofp(sample->aperf) * int_tofp(100);
  623. core_pct = div64_u64(core_pct, int_tofp(sample->mperf));
  624. sample->freq = fp_toint(
  625. mul_fp(int_tofp(
  626. cpu->pstate.max_pstate * cpu->pstate.scaling / 100),
  627. core_pct));
  628. sample->core_pct_busy = (int32_t)core_pct;
  629. }
  630. static inline void intel_pstate_sample(struct cpudata *cpu)
  631. {
  632. u64 aperf, mperf;
  633. unsigned long flags;
  634. u64 tsc;
  635. local_irq_save(flags);
  636. rdmsrl(MSR_IA32_APERF, aperf);
  637. rdmsrl(MSR_IA32_MPERF, mperf);
  638. tsc = rdtsc();
  639. local_irq_restore(flags);
  640. cpu->last_sample_time = cpu->sample.time;
  641. cpu->sample.time = ktime_get();
  642. cpu->sample.aperf = aperf;
  643. cpu->sample.mperf = mperf;
  644. cpu->sample.tsc = tsc;
  645. cpu->sample.aperf -= cpu->prev_aperf;
  646. cpu->sample.mperf -= cpu->prev_mperf;
  647. cpu->sample.tsc -= cpu->prev_tsc;
  648. intel_pstate_calc_busy(cpu);
  649. cpu->prev_aperf = aperf;
  650. cpu->prev_mperf = mperf;
  651. cpu->prev_tsc = tsc;
  652. }
  653. static inline void intel_hwp_set_sample_time(struct cpudata *cpu)
  654. {
  655. int delay;
  656. delay = msecs_to_jiffies(50);
  657. mod_timer_pinned(&cpu->timer, jiffies + delay);
  658. }
  659. static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
  660. {
  661. int delay;
  662. delay = msecs_to_jiffies(pid_params.sample_rate_ms);
  663. mod_timer_pinned(&cpu->timer, jiffies + delay);
  664. }
  665. static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu)
  666. {
  667. int32_t core_busy, max_pstate, current_pstate, sample_ratio;
  668. s64 duration_us;
  669. u32 sample_time;
  670. /*
  671. * core_busy is the ratio of actual performance to max
  672. * max_pstate is the max non turbo pstate available
  673. * current_pstate was the pstate that was requested during
  674. * the last sample period.
  675. *
  676. * We normalize core_busy, which was our actual percent
  677. * performance to what we requested during the last sample
  678. * period. The result will be a percentage of busy at a
  679. * specified pstate.
  680. */
  681. core_busy = cpu->sample.core_pct_busy;
  682. max_pstate = int_tofp(cpu->pstate.max_pstate);
  683. current_pstate = int_tofp(cpu->pstate.current_pstate);
  684. core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate));
  685. /*
  686. * Since we have a deferred timer, it will not fire unless
  687. * we are in C0. So, determine if the actual elapsed time
  688. * is significantly greater (3x) than our sample interval. If it
  689. * is, then we were idle for a long enough period of time
  690. * to adjust our busyness.
  691. */
  692. sample_time = pid_params.sample_rate_ms * USEC_PER_MSEC;
  693. duration_us = ktime_us_delta(cpu->sample.time,
  694. cpu->last_sample_time);
  695. if (duration_us > sample_time * 3) {
  696. sample_ratio = div_fp(int_tofp(sample_time),
  697. int_tofp(duration_us));
  698. core_busy = mul_fp(core_busy, sample_ratio);
  699. }
  700. return core_busy;
  701. }
  702. static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
  703. {
  704. int32_t busy_scaled;
  705. struct _pid *pid;
  706. signed int ctl;
  707. int from;
  708. struct sample *sample;
  709. from = cpu->pstate.current_pstate;
  710. pid = &cpu->pid;
  711. busy_scaled = intel_pstate_get_scaled_busy(cpu);
  712. ctl = pid_calc(pid, busy_scaled);
  713. /* Negative values of ctl increase the pstate and vice versa */
  714. intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl, true);
  715. sample = &cpu->sample;
  716. trace_pstate_sample(fp_toint(sample->core_pct_busy),
  717. fp_toint(busy_scaled),
  718. from,
  719. cpu->pstate.current_pstate,
  720. sample->mperf,
  721. sample->aperf,
  722. sample->tsc,
  723. sample->freq);
  724. }
  725. static void intel_hwp_timer_func(unsigned long __data)
  726. {
  727. struct cpudata *cpu = (struct cpudata *) __data;
  728. intel_pstate_sample(cpu);
  729. intel_hwp_set_sample_time(cpu);
  730. }
  731. static void intel_pstate_timer_func(unsigned long __data)
  732. {
  733. struct cpudata *cpu = (struct cpudata *) __data;
  734. intel_pstate_sample(cpu);
  735. intel_pstate_adjust_busy_pstate(cpu);
  736. intel_pstate_set_sample_time(cpu);
  737. }
  738. #define ICPU(model, policy) \
  739. { X86_VENDOR_INTEL, 6, model, X86_FEATURE_APERFMPERF,\
  740. (unsigned long)&policy }
  741. static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
  742. ICPU(0x2a, core_params),
  743. ICPU(0x2d, core_params),
  744. ICPU(0x37, byt_params),
  745. ICPU(0x3a, core_params),
  746. ICPU(0x3c, core_params),
  747. ICPU(0x3d, core_params),
  748. ICPU(0x3e, core_params),
  749. ICPU(0x3f, core_params),
  750. ICPU(0x45, core_params),
  751. ICPU(0x46, core_params),
  752. ICPU(0x47, core_params),
  753. ICPU(0x4c, byt_params),
  754. ICPU(0x4e, core_params),
  755. ICPU(0x4f, core_params),
  756. ICPU(0x5e, core_params),
  757. ICPU(0x56, core_params),
  758. ICPU(0x57, knl_params),
  759. {}
  760. };
  761. MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
  762. static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] = {
  763. ICPU(0x56, core_params),
  764. {}
  765. };
  766. static int intel_pstate_init_cpu(unsigned int cpunum)
  767. {
  768. struct cpudata *cpu;
  769. if (!all_cpu_data[cpunum])
  770. all_cpu_data[cpunum] = kzalloc(sizeof(struct cpudata),
  771. GFP_KERNEL);
  772. if (!all_cpu_data[cpunum])
  773. return -ENOMEM;
  774. cpu = all_cpu_data[cpunum];
  775. cpu->cpu = cpunum;
  776. if (hwp_active)
  777. intel_pstate_hwp_enable(cpu);
  778. intel_pstate_get_cpu_pstates(cpu);
  779. init_timer_deferrable(&cpu->timer);
  780. cpu->timer.data = (unsigned long)cpu;
  781. cpu->timer.expires = jiffies + HZ/100;
  782. if (!hwp_active)
  783. cpu->timer.function = intel_pstate_timer_func;
  784. else
  785. cpu->timer.function = intel_hwp_timer_func;
  786. intel_pstate_busy_pid_reset(cpu);
  787. intel_pstate_sample(cpu);
  788. add_timer_on(&cpu->timer, cpunum);
  789. pr_debug("intel_pstate: controlling: cpu %d\n", cpunum);
  790. return 0;
  791. }
  792. static unsigned int intel_pstate_get(unsigned int cpu_num)
  793. {
  794. struct sample *sample;
  795. struct cpudata *cpu;
  796. cpu = all_cpu_data[cpu_num];
  797. if (!cpu)
  798. return 0;
  799. sample = &cpu->sample;
  800. return sample->freq;
  801. }
  802. static int intel_pstate_set_policy(struct cpufreq_policy *policy)
  803. {
  804. if (!policy->cpuinfo.max_freq)
  805. return -ENODEV;
  806. if (policy->policy == CPUFREQ_POLICY_PERFORMANCE &&
  807. policy->max >= policy->cpuinfo.max_freq) {
  808. limits.min_policy_pct = 100;
  809. limits.min_perf_pct = 100;
  810. limits.min_perf = int_tofp(1);
  811. limits.max_policy_pct = 100;
  812. limits.max_perf_pct = 100;
  813. limits.max_perf = int_tofp(1);
  814. limits.no_turbo = 0;
  815. return 0;
  816. }
  817. limits.min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
  818. limits.min_policy_pct = clamp_t(int, limits.min_policy_pct, 0 , 100);
  819. limits.max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq;
  820. limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100);
  821. /* Normalize user input to [min_policy_pct, max_policy_pct] */
  822. limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct);
  823. limits.min_perf_pct = min(limits.max_policy_pct, limits.min_perf_pct);
  824. limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
  825. limits.max_perf_pct = max(limits.min_policy_pct, limits.max_perf_pct);
  826. /* Make sure min_perf_pct <= max_perf_pct */
  827. limits.min_perf_pct = min(limits.max_perf_pct, limits.min_perf_pct);
  828. limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
  829. limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
  830. if (hwp_active)
  831. intel_pstate_hwp_set();
  832. return 0;
  833. }
  834. static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
  835. {
  836. cpufreq_verify_within_cpu_limits(policy);
  837. if (policy->policy != CPUFREQ_POLICY_POWERSAVE &&
  838. policy->policy != CPUFREQ_POLICY_PERFORMANCE)
  839. return -EINVAL;
  840. return 0;
  841. }
  842. static void intel_pstate_stop_cpu(struct cpufreq_policy *policy)
  843. {
  844. int cpu_num = policy->cpu;
  845. struct cpudata *cpu = all_cpu_data[cpu_num];
  846. pr_debug("intel_pstate: CPU %d exiting\n", cpu_num);
  847. del_timer_sync(&all_cpu_data[cpu_num]->timer);
  848. if (hwp_active)
  849. return;
  850. intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false);
  851. }
  852. static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
  853. {
  854. struct cpudata *cpu;
  855. int rc;
  856. rc = intel_pstate_init_cpu(policy->cpu);
  857. if (rc)
  858. return rc;
  859. cpu = all_cpu_data[policy->cpu];
  860. if (limits.min_perf_pct == 100 && limits.max_perf_pct == 100)
  861. policy->policy = CPUFREQ_POLICY_PERFORMANCE;
  862. else
  863. policy->policy = CPUFREQ_POLICY_POWERSAVE;
  864. policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling;
  865. policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
  866. /* cpuinfo and default policy values */
  867. policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
  868. policy->cpuinfo.max_freq =
  869. cpu->pstate.turbo_pstate * cpu->pstate.scaling;
  870. policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
  871. cpumask_set_cpu(policy->cpu, policy->cpus);
  872. return 0;
  873. }
  874. static struct cpufreq_driver intel_pstate_driver = {
  875. .flags = CPUFREQ_CONST_LOOPS,
  876. .verify = intel_pstate_verify_policy,
  877. .setpolicy = intel_pstate_set_policy,
  878. .get = intel_pstate_get,
  879. .init = intel_pstate_cpu_init,
  880. .stop_cpu = intel_pstate_stop_cpu,
  881. .name = "intel_pstate",
  882. };
  883. static int __initdata no_load;
  884. static int __initdata no_hwp;
  885. static int __initdata hwp_only;
  886. static unsigned int force_load;
  887. static int intel_pstate_msrs_not_valid(void)
  888. {
  889. if (!pstate_funcs.get_max() ||
  890. !pstate_funcs.get_min() ||
  891. !pstate_funcs.get_turbo())
  892. return -ENODEV;
  893. return 0;
  894. }
  895. static void copy_pid_params(struct pstate_adjust_policy *policy)
  896. {
  897. pid_params.sample_rate_ms = policy->sample_rate_ms;
  898. pid_params.p_gain_pct = policy->p_gain_pct;
  899. pid_params.i_gain_pct = policy->i_gain_pct;
  900. pid_params.d_gain_pct = policy->d_gain_pct;
  901. pid_params.deadband = policy->deadband;
  902. pid_params.setpoint = policy->setpoint;
  903. }
  904. static void copy_cpu_funcs(struct pstate_funcs *funcs)
  905. {
  906. pstate_funcs.get_max = funcs->get_max;
  907. pstate_funcs.get_min = funcs->get_min;
  908. pstate_funcs.get_turbo = funcs->get_turbo;
  909. pstate_funcs.get_scaling = funcs->get_scaling;
  910. pstate_funcs.set = funcs->set;
  911. pstate_funcs.get_vid = funcs->get_vid;
  912. }
  913. #if IS_ENABLED(CONFIG_ACPI)
  914. #include <acpi/processor.h>
  915. static bool intel_pstate_no_acpi_pss(void)
  916. {
  917. int i;
  918. for_each_possible_cpu(i) {
  919. acpi_status status;
  920. union acpi_object *pss;
  921. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  922. struct acpi_processor *pr = per_cpu(processors, i);
  923. if (!pr)
  924. continue;
  925. status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
  926. if (ACPI_FAILURE(status))
  927. continue;
  928. pss = buffer.pointer;
  929. if (pss && pss->type == ACPI_TYPE_PACKAGE) {
  930. kfree(pss);
  931. return false;
  932. }
  933. kfree(pss);
  934. }
  935. return true;
  936. }
  937. static bool intel_pstate_has_acpi_ppc(void)
  938. {
  939. int i;
  940. for_each_possible_cpu(i) {
  941. struct acpi_processor *pr = per_cpu(processors, i);
  942. if (!pr)
  943. continue;
  944. if (acpi_has_method(pr->handle, "_PPC"))
  945. return true;
  946. }
  947. return false;
  948. }
  949. enum {
  950. PSS,
  951. PPC,
  952. };
  953. struct hw_vendor_info {
  954. u16 valid;
  955. char oem_id[ACPI_OEM_ID_SIZE];
  956. char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];
  957. int oem_pwr_table;
  958. };
  959. /* Hardware vendor-specific info that has its own power management modes */
  960. static struct hw_vendor_info vendor_info[] = {
  961. {1, "HP ", "ProLiant", PSS},
  962. {1, "ORACLE", "X4-2 ", PPC},
  963. {1, "ORACLE", "X4-2L ", PPC},
  964. {1, "ORACLE", "X4-2B ", PPC},
  965. {1, "ORACLE", "X3-2 ", PPC},
  966. {1, "ORACLE", "X3-2L ", PPC},
  967. {1, "ORACLE", "X3-2B ", PPC},
  968. {1, "ORACLE", "X4470M2 ", PPC},
  969. {1, "ORACLE", "X4270M3 ", PPC},
  970. {1, "ORACLE", "X4270M2 ", PPC},
  971. {1, "ORACLE", "X4170M2 ", PPC},
  972. {1, "ORACLE", "X4170 M3", PPC},
  973. {1, "ORACLE", "X4275 M3", PPC},
  974. {1, "ORACLE", "X6-2 ", PPC},
  975. {1, "ORACLE", "Sudbury ", PPC},
  976. {0, "", ""},
  977. };
  978. static bool intel_pstate_platform_pwr_mgmt_exists(void)
  979. {
  980. struct acpi_table_header hdr;
  981. struct hw_vendor_info *v_info;
  982. const struct x86_cpu_id *id;
  983. u64 misc_pwr;
  984. id = x86_match_cpu(intel_pstate_cpu_oob_ids);
  985. if (id) {
  986. rdmsrl(MSR_MISC_PWR_MGMT, misc_pwr);
  987. if ( misc_pwr & (1 << 8))
  988. return true;
  989. }
  990. if (acpi_disabled ||
  991. ACPI_FAILURE(acpi_get_table_header(ACPI_SIG_FADT, 0, &hdr)))
  992. return false;
  993. for (v_info = vendor_info; v_info->valid; v_info++) {
  994. if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE) &&
  995. !strncmp(hdr.oem_table_id, v_info->oem_table_id,
  996. ACPI_OEM_TABLE_ID_SIZE))
  997. switch (v_info->oem_pwr_table) {
  998. case PSS:
  999. return intel_pstate_no_acpi_pss();
  1000. case PPC:
  1001. return intel_pstate_has_acpi_ppc() &&
  1002. (!force_load);
  1003. }
  1004. }
  1005. return false;
  1006. }
  1007. #else /* CONFIG_ACPI not enabled */
  1008. static inline bool intel_pstate_platform_pwr_mgmt_exists(void) { return false; }
  1009. static inline bool intel_pstate_has_acpi_ppc(void) { return false; }
  1010. #endif /* CONFIG_ACPI */
  1011. static int __init intel_pstate_init(void)
  1012. {
  1013. int cpu, rc = 0;
  1014. const struct x86_cpu_id *id;
  1015. struct cpu_defaults *cpu_def;
  1016. if (no_load)
  1017. return -ENODEV;
  1018. id = x86_match_cpu(intel_pstate_cpu_ids);
  1019. if (!id)
  1020. return -ENODEV;
  1021. /*
  1022. * The Intel pstate driver will be ignored if the platform
  1023. * firmware has its own power management modes.
  1024. */
  1025. if (intel_pstate_platform_pwr_mgmt_exists())
  1026. return -ENODEV;
  1027. cpu_def = (struct cpu_defaults *)id->driver_data;
  1028. copy_pid_params(&cpu_def->pid_policy);
  1029. copy_cpu_funcs(&cpu_def->funcs);
  1030. if (intel_pstate_msrs_not_valid())
  1031. return -ENODEV;
  1032. pr_info("Intel P-state driver initializing.\n");
  1033. all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
  1034. if (!all_cpu_data)
  1035. return -ENOMEM;
  1036. if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp)
  1037. hwp_active++;
  1038. if (!hwp_active && hwp_only)
  1039. goto out;
  1040. rc = cpufreq_register_driver(&intel_pstate_driver);
  1041. if (rc)
  1042. goto out;
  1043. intel_pstate_debug_expose_params();
  1044. intel_pstate_sysfs_expose_params();
  1045. return rc;
  1046. out:
  1047. get_online_cpus();
  1048. for_each_online_cpu(cpu) {
  1049. if (all_cpu_data[cpu]) {
  1050. del_timer_sync(&all_cpu_data[cpu]->timer);
  1051. kfree(all_cpu_data[cpu]);
  1052. }
  1053. }
  1054. put_online_cpus();
  1055. vfree(all_cpu_data);
  1056. return -ENODEV;
  1057. }
  1058. device_initcall(intel_pstate_init);
  1059. static int __init intel_pstate_setup(char *str)
  1060. {
  1061. if (!str)
  1062. return -EINVAL;
  1063. if (!strcmp(str, "disable"))
  1064. no_load = 1;
  1065. if (!strcmp(str, "no_hwp"))
  1066. no_hwp = 1;
  1067. if (!strcmp(str, "force"))
  1068. force_load = 1;
  1069. if (!strcmp(str, "hwp_only"))
  1070. hwp_only = 1;
  1071. return 0;
  1072. }
  1073. early_param("intel_pstate", intel_pstate_setup);
  1074. MODULE_AUTHOR("Dirk Brandewie <dirk.j.brandewie@intel.com>");
  1075. MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");
  1076. MODULE_LICENSE("GPL");