processor_throttling.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. /*
  2. * processor_throttling.c - Throttling submodule of the ACPI processor driver
  3. *
  4. * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  5. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  6. * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
  7. * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
  8. * - Added processor hotplug support
  9. *
  10. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or (at
  15. * your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License along
  23. * with this program; if not, write to the Free Software Foundation, Inc.,
  24. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  25. *
  26. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. */
  28. #include <linux/kernel.h>
  29. #include <linux/module.h>
  30. #include <linux/init.h>
  31. #include <linux/sched.h>
  32. #include <linux/cpufreq.h>
  33. #include <linux/proc_fs.h>
  34. #include <linux/seq_file.h>
  35. #include <asm/io.h>
  36. #include <asm/uaccess.h>
  37. #include <acpi/acpi_bus.h>
  38. #include <acpi/acpi_drivers.h>
  39. #include <acpi/processor.h>
  40. #define ACPI_PROCESSOR_CLASS "processor"
  41. #define _COMPONENT ACPI_PROCESSOR_COMPONENT
  42. ACPI_MODULE_NAME("processor_throttling");
  43. /* ignore_tpc:
  44. * 0 -> acpi processor driver doesn't ignore _TPC values
  45. * 1 -> acpi processor driver ignores _TPC values
  46. */
  47. static int ignore_tpc;
  48. module_param(ignore_tpc, int, 0644);
  49. MODULE_PARM_DESC(ignore_tpc, "Disable broken BIOS _TPC throttling support");
  50. struct throttling_tstate {
  51. unsigned int cpu; /* cpu nr */
  52. int target_state; /* target T-state */
  53. };
  54. #define THROTTLING_PRECHANGE (1)
  55. #define THROTTLING_POSTCHANGE (2)
  56. static int acpi_processor_get_throttling(struct acpi_processor *pr);
  57. int acpi_processor_set_throttling(struct acpi_processor *pr,
  58. int state, bool force);
  59. static int acpi_processor_update_tsd_coord(void)
  60. {
  61. int count, count_target;
  62. int retval = 0;
  63. unsigned int i, j;
  64. cpumask_var_t covered_cpus;
  65. struct acpi_processor *pr, *match_pr;
  66. struct acpi_tsd_package *pdomain, *match_pdomain;
  67. struct acpi_processor_throttling *pthrottling, *match_pthrottling;
  68. if (!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))
  69. return -ENOMEM;
  70. /*
  71. * Now that we have _TSD data from all CPUs, lets setup T-state
  72. * coordination between all CPUs.
  73. */
  74. for_each_possible_cpu(i) {
  75. pr = per_cpu(processors, i);
  76. if (!pr)
  77. continue;
  78. /* Basic validity check for domain info */
  79. pthrottling = &(pr->throttling);
  80. /*
  81. * If tsd package for one cpu is invalid, the coordination
  82. * among all CPUs is thought as invalid.
  83. * Maybe it is ugly.
  84. */
  85. if (!pthrottling->tsd_valid_flag) {
  86. retval = -EINVAL;
  87. break;
  88. }
  89. }
  90. if (retval)
  91. goto err_ret;
  92. cpumask_clear(covered_cpus);
  93. for_each_possible_cpu(i) {
  94. pr = per_cpu(processors, i);
  95. if (!pr)
  96. continue;
  97. if (cpumask_test_cpu(i, covered_cpus))
  98. continue;
  99. pthrottling = &pr->throttling;
  100. pdomain = &(pthrottling->domain_info);
  101. cpumask_set_cpu(i, pthrottling->shared_cpu_map);
  102. cpumask_set_cpu(i, covered_cpus);
  103. /*
  104. * If the number of processor in the TSD domain is 1, it is
  105. * unnecessary to parse the coordination for this CPU.
  106. */
  107. if (pdomain->num_processors <= 1)
  108. continue;
  109. /* Validate the Domain info */
  110. count_target = pdomain->num_processors;
  111. count = 1;
  112. for_each_possible_cpu(j) {
  113. if (i == j)
  114. continue;
  115. match_pr = per_cpu(processors, j);
  116. if (!match_pr)
  117. continue;
  118. match_pthrottling = &(match_pr->throttling);
  119. match_pdomain = &(match_pthrottling->domain_info);
  120. if (match_pdomain->domain != pdomain->domain)
  121. continue;
  122. /* Here i and j are in the same domain.
  123. * If two TSD packages have the same domain, they
  124. * should have the same num_porcessors and
  125. * coordination type. Otherwise it will be regarded
  126. * as illegal.
  127. */
  128. if (match_pdomain->num_processors != count_target) {
  129. retval = -EINVAL;
  130. goto err_ret;
  131. }
  132. if (pdomain->coord_type != match_pdomain->coord_type) {
  133. retval = -EINVAL;
  134. goto err_ret;
  135. }
  136. cpumask_set_cpu(j, covered_cpus);
  137. cpumask_set_cpu(j, pthrottling->shared_cpu_map);
  138. count++;
  139. }
  140. for_each_possible_cpu(j) {
  141. if (i == j)
  142. continue;
  143. match_pr = per_cpu(processors, j);
  144. if (!match_pr)
  145. continue;
  146. match_pthrottling = &(match_pr->throttling);
  147. match_pdomain = &(match_pthrottling->domain_info);
  148. if (match_pdomain->domain != pdomain->domain)
  149. continue;
  150. /*
  151. * If some CPUS have the same domain, they
  152. * will have the same shared_cpu_map.
  153. */
  154. cpumask_copy(match_pthrottling->shared_cpu_map,
  155. pthrottling->shared_cpu_map);
  156. }
  157. }
  158. err_ret:
  159. free_cpumask_var(covered_cpus);
  160. for_each_possible_cpu(i) {
  161. pr = per_cpu(processors, i);
  162. if (!pr)
  163. continue;
  164. /*
  165. * Assume no coordination on any error parsing domain info.
  166. * The coordination type will be forced as SW_ALL.
  167. */
  168. if (retval) {
  169. pthrottling = &(pr->throttling);
  170. cpumask_clear(pthrottling->shared_cpu_map);
  171. cpumask_set_cpu(i, pthrottling->shared_cpu_map);
  172. pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
  173. }
  174. }
  175. return retval;
  176. }
  177. /*
  178. * Update the T-state coordination after the _TSD
  179. * data for all cpus is obtained.
  180. */
  181. void acpi_processor_throttling_init(void)
  182. {
  183. if (acpi_processor_update_tsd_coord())
  184. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  185. "Assume no T-state coordination\n"));
  186. return;
  187. }
  188. static int acpi_processor_throttling_notifier(unsigned long event, void *data)
  189. {
  190. struct throttling_tstate *p_tstate = data;
  191. struct acpi_processor *pr;
  192. unsigned int cpu ;
  193. int target_state;
  194. struct acpi_processor_limit *p_limit;
  195. struct acpi_processor_throttling *p_throttling;
  196. cpu = p_tstate->cpu;
  197. pr = per_cpu(processors, cpu);
  198. if (!pr) {
  199. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid pr pointer\n"));
  200. return 0;
  201. }
  202. if (!pr->flags.throttling) {
  203. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Throttling control is "
  204. "unsupported on CPU %d\n", cpu));
  205. return 0;
  206. }
  207. target_state = p_tstate->target_state;
  208. p_throttling = &(pr->throttling);
  209. switch (event) {
  210. case THROTTLING_PRECHANGE:
  211. /*
  212. * Prechange event is used to choose one proper t-state,
  213. * which meets the limits of thermal, user and _TPC.
  214. */
  215. p_limit = &pr->limit;
  216. if (p_limit->thermal.tx > target_state)
  217. target_state = p_limit->thermal.tx;
  218. if (p_limit->user.tx > target_state)
  219. target_state = p_limit->user.tx;
  220. if (pr->throttling_platform_limit > target_state)
  221. target_state = pr->throttling_platform_limit;
  222. if (target_state >= p_throttling->state_count) {
  223. printk(KERN_WARNING
  224. "Exceed the limit of T-state \n");
  225. target_state = p_throttling->state_count - 1;
  226. }
  227. p_tstate->target_state = target_state;
  228. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PreChange Event:"
  229. "target T-state of CPU %d is T%d\n",
  230. cpu, target_state));
  231. break;
  232. case THROTTLING_POSTCHANGE:
  233. /*
  234. * Postchange event is only used to update the
  235. * T-state flag of acpi_processor_throttling.
  236. */
  237. p_throttling->state = target_state;
  238. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PostChange Event:"
  239. "CPU %d is switched to T%d\n",
  240. cpu, target_state));
  241. break;
  242. default:
  243. printk(KERN_WARNING
  244. "Unsupported Throttling notifier event\n");
  245. break;
  246. }
  247. return 0;
  248. }
  249. /*
  250. * _TPC - Throttling Present Capabilities
  251. */
  252. static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
  253. {
  254. acpi_status status = 0;
  255. unsigned long long tpc = 0;
  256. if (!pr)
  257. return -EINVAL;
  258. if (ignore_tpc)
  259. goto end;
  260. status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
  261. if (ACPI_FAILURE(status)) {
  262. if (status != AE_NOT_FOUND) {
  263. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
  264. }
  265. return -ENODEV;
  266. }
  267. end:
  268. pr->throttling_platform_limit = (int)tpc;
  269. return 0;
  270. }
  271. int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
  272. {
  273. int result = 0;
  274. int throttling_limit;
  275. int current_state;
  276. struct acpi_processor_limit *limit;
  277. int target_state;
  278. if (ignore_tpc)
  279. return 0;
  280. result = acpi_processor_get_platform_limit(pr);
  281. if (result) {
  282. /* Throttling Limit is unsupported */
  283. return result;
  284. }
  285. throttling_limit = pr->throttling_platform_limit;
  286. if (throttling_limit >= pr->throttling.state_count) {
  287. /* Uncorrect Throttling Limit */
  288. return -EINVAL;
  289. }
  290. current_state = pr->throttling.state;
  291. if (current_state > throttling_limit) {
  292. /*
  293. * The current state can meet the requirement of
  294. * _TPC limit. But it is reasonable that OSPM changes
  295. * t-states from high to low for better performance.
  296. * Of course the limit condition of thermal
  297. * and user should be considered.
  298. */
  299. limit = &pr->limit;
  300. target_state = throttling_limit;
  301. if (limit->thermal.tx > target_state)
  302. target_state = limit->thermal.tx;
  303. if (limit->user.tx > target_state)
  304. target_state = limit->user.tx;
  305. } else if (current_state == throttling_limit) {
  306. /*
  307. * Unnecessary to change the throttling state
  308. */
  309. return 0;
  310. } else {
  311. /*
  312. * If the current state is lower than the limit of _TPC, it
  313. * will be forced to switch to the throttling state defined
  314. * by throttling_platfor_limit.
  315. * Because the previous state meets with the limit condition
  316. * of thermal and user, it is unnecessary to check it again.
  317. */
  318. target_state = throttling_limit;
  319. }
  320. return acpi_processor_set_throttling(pr, target_state, false);
  321. }
  322. /*
  323. * _PTC - Processor Throttling Control (and status) register location
  324. */
  325. static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
  326. {
  327. int result = 0;
  328. acpi_status status = 0;
  329. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  330. union acpi_object *ptc = NULL;
  331. union acpi_object obj = { 0 };
  332. struct acpi_processor_throttling *throttling;
  333. status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
  334. if (ACPI_FAILURE(status)) {
  335. if (status != AE_NOT_FOUND) {
  336. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC"));
  337. }
  338. return -ENODEV;
  339. }
  340. ptc = (union acpi_object *)buffer.pointer;
  341. if (!ptc || (ptc->type != ACPI_TYPE_PACKAGE)
  342. || (ptc->package.count != 2)) {
  343. printk(KERN_ERR PREFIX "Invalid _PTC data\n");
  344. result = -EFAULT;
  345. goto end;
  346. }
  347. /*
  348. * control_register
  349. */
  350. obj = ptc->package.elements[0];
  351. if ((obj.type != ACPI_TYPE_BUFFER)
  352. || (obj.buffer.length < sizeof(struct acpi_ptc_register))
  353. || (obj.buffer.pointer == NULL)) {
  354. printk(KERN_ERR PREFIX
  355. "Invalid _PTC data (control_register)\n");
  356. result = -EFAULT;
  357. goto end;
  358. }
  359. memcpy(&pr->throttling.control_register, obj.buffer.pointer,
  360. sizeof(struct acpi_ptc_register));
  361. /*
  362. * status_register
  363. */
  364. obj = ptc->package.elements[1];
  365. if ((obj.type != ACPI_TYPE_BUFFER)
  366. || (obj.buffer.length < sizeof(struct acpi_ptc_register))
  367. || (obj.buffer.pointer == NULL)) {
  368. printk(KERN_ERR PREFIX "Invalid _PTC data (status_register)\n");
  369. result = -EFAULT;
  370. goto end;
  371. }
  372. memcpy(&pr->throttling.status_register, obj.buffer.pointer,
  373. sizeof(struct acpi_ptc_register));
  374. throttling = &pr->throttling;
  375. if ((throttling->control_register.bit_width +
  376. throttling->control_register.bit_offset) > 32) {
  377. printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
  378. result = -EFAULT;
  379. goto end;
  380. }
  381. if ((throttling->status_register.bit_width +
  382. throttling->status_register.bit_offset) > 32) {
  383. printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
  384. result = -EFAULT;
  385. goto end;
  386. }
  387. end:
  388. kfree(buffer.pointer);
  389. return result;
  390. }
  391. /*
  392. * _TSS - Throttling Supported States
  393. */
  394. static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
  395. {
  396. int result = 0;
  397. acpi_status status = AE_OK;
  398. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  399. struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
  400. struct acpi_buffer state = { 0, NULL };
  401. union acpi_object *tss = NULL;
  402. int i;
  403. status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
  404. if (ACPI_FAILURE(status)) {
  405. if (status != AE_NOT_FOUND) {
  406. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS"));
  407. }
  408. return -ENODEV;
  409. }
  410. tss = buffer.pointer;
  411. if (!tss || (tss->type != ACPI_TYPE_PACKAGE)) {
  412. printk(KERN_ERR PREFIX "Invalid _TSS data\n");
  413. result = -EFAULT;
  414. goto end;
  415. }
  416. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
  417. tss->package.count));
  418. pr->throttling.state_count = tss->package.count;
  419. pr->throttling.states_tss =
  420. kmalloc(sizeof(struct acpi_processor_tx_tss) * tss->package.count,
  421. GFP_KERNEL);
  422. if (!pr->throttling.states_tss) {
  423. result = -ENOMEM;
  424. goto end;
  425. }
  426. for (i = 0; i < pr->throttling.state_count; i++) {
  427. struct acpi_processor_tx_tss *tx =
  428. (struct acpi_processor_tx_tss *)&(pr->throttling.
  429. states_tss[i]);
  430. state.length = sizeof(struct acpi_processor_tx_tss);
  431. state.pointer = tx;
  432. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
  433. status = acpi_extract_package(&(tss->package.elements[i]),
  434. &format, &state);
  435. if (ACPI_FAILURE(status)) {
  436. ACPI_EXCEPTION((AE_INFO, status, "Invalid _TSS data"));
  437. result = -EFAULT;
  438. kfree(pr->throttling.states_tss);
  439. goto end;
  440. }
  441. if (!tx->freqpercentage) {
  442. printk(KERN_ERR PREFIX
  443. "Invalid _TSS data: freq is zero\n");
  444. result = -EFAULT;
  445. kfree(pr->throttling.states_tss);
  446. goto end;
  447. }
  448. }
  449. end:
  450. kfree(buffer.pointer);
  451. return result;
  452. }
  453. /*
  454. * _TSD - T-State Dependencies
  455. */
  456. static int acpi_processor_get_tsd(struct acpi_processor *pr)
  457. {
  458. int result = 0;
  459. acpi_status status = AE_OK;
  460. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  461. struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
  462. struct acpi_buffer state = { 0, NULL };
  463. union acpi_object *tsd = NULL;
  464. struct acpi_tsd_package *pdomain;
  465. struct acpi_processor_throttling *pthrottling;
  466. pthrottling = &pr->throttling;
  467. pthrottling->tsd_valid_flag = 0;
  468. status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
  469. if (ACPI_FAILURE(status)) {
  470. if (status != AE_NOT_FOUND) {
  471. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSD"));
  472. }
  473. return -ENODEV;
  474. }
  475. tsd = buffer.pointer;
  476. if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) {
  477. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  478. result = -EFAULT;
  479. goto end;
  480. }
  481. if (tsd->package.count != 1) {
  482. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  483. result = -EFAULT;
  484. goto end;
  485. }
  486. pdomain = &(pr->throttling.domain_info);
  487. state.length = sizeof(struct acpi_tsd_package);
  488. state.pointer = pdomain;
  489. status = acpi_extract_package(&(tsd->package.elements[0]),
  490. &format, &state);
  491. if (ACPI_FAILURE(status)) {
  492. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  493. result = -EFAULT;
  494. goto end;
  495. }
  496. if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) {
  497. printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n");
  498. result = -EFAULT;
  499. goto end;
  500. }
  501. if (pdomain->revision != ACPI_TSD_REV0_REVISION) {
  502. printk(KERN_ERR PREFIX "Unknown _TSD:revision\n");
  503. result = -EFAULT;
  504. goto end;
  505. }
  506. pthrottling = &pr->throttling;
  507. pthrottling->tsd_valid_flag = 1;
  508. pthrottling->shared_type = pdomain->coord_type;
  509. cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map);
  510. /*
  511. * If the coordination type is not defined in ACPI spec,
  512. * the tsd_valid_flag will be clear and coordination type
  513. * will be forecd as DOMAIN_COORD_TYPE_SW_ALL.
  514. */
  515. if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL &&
  516. pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY &&
  517. pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) {
  518. pthrottling->tsd_valid_flag = 0;
  519. pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
  520. }
  521. end:
  522. kfree(buffer.pointer);
  523. return result;
  524. }
  525. /* --------------------------------------------------------------------------
  526. Throttling Control
  527. -------------------------------------------------------------------------- */
  528. static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
  529. {
  530. int state = 0;
  531. u32 value = 0;
  532. u32 duty_mask = 0;
  533. u32 duty_value = 0;
  534. if (!pr)
  535. return -EINVAL;
  536. if (!pr->flags.throttling)
  537. return -ENODEV;
  538. pr->throttling.state = 0;
  539. duty_mask = pr->throttling.state_count - 1;
  540. duty_mask <<= pr->throttling.duty_offset;
  541. local_irq_disable();
  542. value = inl(pr->throttling.address);
  543. /*
  544. * Compute the current throttling state when throttling is enabled
  545. * (bit 4 is on).
  546. */
  547. if (value & 0x10) {
  548. duty_value = value & duty_mask;
  549. duty_value >>= pr->throttling.duty_offset;
  550. if (duty_value)
  551. state = pr->throttling.state_count - duty_value;
  552. }
  553. pr->throttling.state = state;
  554. local_irq_enable();
  555. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  556. "Throttling state is T%d (%d%% throttling applied)\n",
  557. state, pr->throttling.states[state].performance));
  558. return 0;
  559. }
  560. #ifdef CONFIG_X86
  561. static int acpi_throttling_rdmsr(struct acpi_processor *pr,
  562. acpi_integer * value)
  563. {
  564. struct cpuinfo_x86 *c;
  565. u64 msr_high, msr_low;
  566. unsigned int cpu;
  567. u64 msr = 0;
  568. int ret = -1;
  569. cpu = pr->id;
  570. c = &cpu_data(cpu);
  571. if ((c->x86_vendor != X86_VENDOR_INTEL) ||
  572. !cpu_has(c, X86_FEATURE_ACPI)) {
  573. printk(KERN_ERR PREFIX
  574. "HARDWARE addr space,NOT supported yet\n");
  575. } else {
  576. msr_low = 0;
  577. msr_high = 0;
  578. rdmsr_safe(MSR_IA32_THERM_CONTROL,
  579. (u32 *)&msr_low , (u32 *) &msr_high);
  580. msr = (msr_high << 32) | msr_low;
  581. *value = (acpi_integer) msr;
  582. ret = 0;
  583. }
  584. return ret;
  585. }
  586. static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
  587. {
  588. struct cpuinfo_x86 *c;
  589. unsigned int cpu;
  590. int ret = -1;
  591. u64 msr;
  592. cpu = pr->id;
  593. c = &cpu_data(cpu);
  594. if ((c->x86_vendor != X86_VENDOR_INTEL) ||
  595. !cpu_has(c, X86_FEATURE_ACPI)) {
  596. printk(KERN_ERR PREFIX
  597. "HARDWARE addr space,NOT supported yet\n");
  598. } else {
  599. msr = value;
  600. wrmsr_safe(MSR_IA32_THERM_CONTROL,
  601. msr & 0xffffffff, msr >> 32);
  602. ret = 0;
  603. }
  604. return ret;
  605. }
  606. #else
  607. static int acpi_throttling_rdmsr(struct acpi_processor *pr,
  608. acpi_integer * value)
  609. {
  610. printk(KERN_ERR PREFIX
  611. "HARDWARE addr space,NOT supported yet\n");
  612. return -1;
  613. }
  614. static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
  615. {
  616. printk(KERN_ERR PREFIX
  617. "HARDWARE addr space,NOT supported yet\n");
  618. return -1;
  619. }
  620. #endif
  621. static int acpi_read_throttling_status(struct acpi_processor *pr,
  622. acpi_integer *value)
  623. {
  624. u32 bit_width, bit_offset;
  625. u64 ptc_value;
  626. u64 ptc_mask;
  627. struct acpi_processor_throttling *throttling;
  628. int ret = -1;
  629. throttling = &pr->throttling;
  630. switch (throttling->status_register.space_id) {
  631. case ACPI_ADR_SPACE_SYSTEM_IO:
  632. ptc_value = 0;
  633. bit_width = throttling->status_register.bit_width;
  634. bit_offset = throttling->status_register.bit_offset;
  635. acpi_os_read_port((acpi_io_address) throttling->status_register.
  636. address, (u32 *) &ptc_value,
  637. (u32) (bit_width + bit_offset));
  638. ptc_mask = (1 << bit_width) - 1;
  639. *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask);
  640. ret = 0;
  641. break;
  642. case ACPI_ADR_SPACE_FIXED_HARDWARE:
  643. ret = acpi_throttling_rdmsr(pr, value);
  644. break;
  645. default:
  646. printk(KERN_ERR PREFIX "Unknown addr space %d\n",
  647. (u32) (throttling->status_register.space_id));
  648. }
  649. return ret;
  650. }
  651. static int acpi_write_throttling_state(struct acpi_processor *pr,
  652. acpi_integer value)
  653. {
  654. u32 bit_width, bit_offset;
  655. u64 ptc_value;
  656. u64 ptc_mask;
  657. struct acpi_processor_throttling *throttling;
  658. int ret = -1;
  659. throttling = &pr->throttling;
  660. switch (throttling->control_register.space_id) {
  661. case ACPI_ADR_SPACE_SYSTEM_IO:
  662. bit_width = throttling->control_register.bit_width;
  663. bit_offset = throttling->control_register.bit_offset;
  664. ptc_mask = (1 << bit_width) - 1;
  665. ptc_value = value & ptc_mask;
  666. acpi_os_write_port((acpi_io_address) throttling->
  667. control_register.address,
  668. (u32) (ptc_value << bit_offset),
  669. (u32) (bit_width + bit_offset));
  670. ret = 0;
  671. break;
  672. case ACPI_ADR_SPACE_FIXED_HARDWARE:
  673. ret = acpi_throttling_wrmsr(pr, value);
  674. break;
  675. default:
  676. printk(KERN_ERR PREFIX "Unknown addr space %d\n",
  677. (u32) (throttling->control_register.space_id));
  678. }
  679. return ret;
  680. }
  681. static int acpi_get_throttling_state(struct acpi_processor *pr,
  682. acpi_integer value)
  683. {
  684. int i;
  685. for (i = 0; i < pr->throttling.state_count; i++) {
  686. struct acpi_processor_tx_tss *tx =
  687. (struct acpi_processor_tx_tss *)&(pr->throttling.
  688. states_tss[i]);
  689. if (tx->control == value)
  690. return i;
  691. }
  692. return -1;
  693. }
  694. static int acpi_get_throttling_value(struct acpi_processor *pr,
  695. int state, acpi_integer *value)
  696. {
  697. int ret = -1;
  698. if (state >= 0 && state <= pr->throttling.state_count) {
  699. struct acpi_processor_tx_tss *tx =
  700. (struct acpi_processor_tx_tss *)&(pr->throttling.
  701. states_tss[state]);
  702. *value = tx->control;
  703. ret = 0;
  704. }
  705. return ret;
  706. }
  707. static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
  708. {
  709. int state = 0;
  710. int ret;
  711. acpi_integer value;
  712. if (!pr)
  713. return -EINVAL;
  714. if (!pr->flags.throttling)
  715. return -ENODEV;
  716. pr->throttling.state = 0;
  717. value = 0;
  718. ret = acpi_read_throttling_status(pr, &value);
  719. if (ret >= 0) {
  720. state = acpi_get_throttling_state(pr, value);
  721. if (state == -1) {
  722. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  723. "Invalid throttling state, reset\n"));
  724. state = 0;
  725. ret = acpi_processor_set_throttling(pr, state, true);
  726. if (ret)
  727. return ret;
  728. }
  729. pr->throttling.state = state;
  730. }
  731. return 0;
  732. }
  733. static int acpi_processor_get_throttling(struct acpi_processor *pr)
  734. {
  735. cpumask_var_t saved_mask;
  736. int ret;
  737. if (!pr)
  738. return -EINVAL;
  739. if (!pr->flags.throttling)
  740. return -ENODEV;
  741. if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
  742. return -ENOMEM;
  743. /*
  744. * Migrate task to the cpu pointed by pr.
  745. */
  746. cpumask_copy(saved_mask, &current->cpus_allowed);
  747. /* FIXME: use work_on_cpu() */
  748. set_cpus_allowed_ptr(current, cpumask_of(pr->id));
  749. ret = pr->throttling.acpi_processor_get_throttling(pr);
  750. /* restore the previous state */
  751. set_cpus_allowed_ptr(current, saved_mask);
  752. free_cpumask_var(saved_mask);
  753. return ret;
  754. }
  755. static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
  756. {
  757. int i, step;
  758. if (!pr->throttling.address) {
  759. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
  760. return -EINVAL;
  761. } else if (!pr->throttling.duty_width) {
  762. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
  763. return -EINVAL;
  764. }
  765. /* TBD: Support duty_cycle values that span bit 4. */
  766. else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
  767. printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
  768. return -EINVAL;
  769. }
  770. pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
  771. /*
  772. * Compute state values. Note that throttling displays a linear power
  773. * performance relationship (at 50% performance the CPU will consume
  774. * 50% power). Values are in 1/10th of a percent to preserve accuracy.
  775. */
  776. step = (1000 / pr->throttling.state_count);
  777. for (i = 0; i < pr->throttling.state_count; i++) {
  778. pr->throttling.states[i].performance = 1000 - step * i;
  779. pr->throttling.states[i].power = 1000 - step * i;
  780. }
  781. return 0;
  782. }
  783. static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
  784. int state, bool force)
  785. {
  786. u32 value = 0;
  787. u32 duty_mask = 0;
  788. u32 duty_value = 0;
  789. if (!pr)
  790. return -EINVAL;
  791. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  792. return -EINVAL;
  793. if (!pr->flags.throttling)
  794. return -ENODEV;
  795. if (!force && (state == pr->throttling.state))
  796. return 0;
  797. if (state < pr->throttling_platform_limit)
  798. return -EPERM;
  799. /*
  800. * Calculate the duty_value and duty_mask.
  801. */
  802. if (state) {
  803. duty_value = pr->throttling.state_count - state;
  804. duty_value <<= pr->throttling.duty_offset;
  805. /* Used to clear all duty_value bits */
  806. duty_mask = pr->throttling.state_count - 1;
  807. duty_mask <<= acpi_gbl_FADT.duty_offset;
  808. duty_mask = ~duty_mask;
  809. }
  810. local_irq_disable();
  811. /*
  812. * Disable throttling by writing a 0 to bit 4. Note that we must
  813. * turn it off before you can change the duty_value.
  814. */
  815. value = inl(pr->throttling.address);
  816. if (value & 0x10) {
  817. value &= 0xFFFFFFEF;
  818. outl(value, pr->throttling.address);
  819. }
  820. /*
  821. * Write the new duty_value and then enable throttling. Note
  822. * that a state value of 0 leaves throttling disabled.
  823. */
  824. if (state) {
  825. value &= duty_mask;
  826. value |= duty_value;
  827. outl(value, pr->throttling.address);
  828. value |= 0x00000010;
  829. outl(value, pr->throttling.address);
  830. }
  831. pr->throttling.state = state;
  832. local_irq_enable();
  833. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  834. "Throttling state set to T%d (%d%%)\n", state,
  835. (pr->throttling.states[state].performance ? pr->
  836. throttling.states[state].performance / 10 : 0)));
  837. return 0;
  838. }
  839. static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
  840. int state, bool force)
  841. {
  842. int ret;
  843. acpi_integer value;
  844. if (!pr)
  845. return -EINVAL;
  846. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  847. return -EINVAL;
  848. if (!pr->flags.throttling)
  849. return -ENODEV;
  850. if (!force && (state == pr->throttling.state))
  851. return 0;
  852. if (state < pr->throttling_platform_limit)
  853. return -EPERM;
  854. value = 0;
  855. ret = acpi_get_throttling_value(pr, state, &value);
  856. if (ret >= 0) {
  857. acpi_write_throttling_state(pr, value);
  858. pr->throttling.state = state;
  859. }
  860. return 0;
  861. }
  862. int acpi_processor_set_throttling(struct acpi_processor *pr,
  863. int state, bool force)
  864. {
  865. cpumask_var_t saved_mask;
  866. int ret = 0;
  867. unsigned int i;
  868. struct acpi_processor *match_pr;
  869. struct acpi_processor_throttling *p_throttling;
  870. struct throttling_tstate t_state;
  871. cpumask_var_t online_throttling_cpus;
  872. if (!pr)
  873. return -EINVAL;
  874. if (!pr->flags.throttling)
  875. return -ENODEV;
  876. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  877. return -EINVAL;
  878. if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
  879. return -ENOMEM;
  880. if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {
  881. free_cpumask_var(saved_mask);
  882. return -ENOMEM;
  883. }
  884. cpumask_copy(saved_mask, &current->cpus_allowed);
  885. t_state.target_state = state;
  886. p_throttling = &(pr->throttling);
  887. cpumask_and(online_throttling_cpus, cpu_online_mask,
  888. p_throttling->shared_cpu_map);
  889. /*
  890. * The throttling notifier will be called for every
  891. * affected cpu in order to get one proper T-state.
  892. * The notifier event is THROTTLING_PRECHANGE.
  893. */
  894. for_each_cpu(i, online_throttling_cpus) {
  895. t_state.cpu = i;
  896. acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
  897. &t_state);
  898. }
  899. /*
  900. * The function of acpi_processor_set_throttling will be called
  901. * to switch T-state. If the coordination type is SW_ALL or HW_ALL,
  902. * it is necessary to call it for every affected cpu. Otherwise
  903. * it can be called only for the cpu pointed by pr.
  904. */
  905. if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
  906. /* FIXME: use work_on_cpu() */
  907. set_cpus_allowed_ptr(current, cpumask_of(pr->id));
  908. ret = p_throttling->acpi_processor_set_throttling(pr,
  909. t_state.target_state, force);
  910. } else {
  911. /*
  912. * When the T-state coordination is SW_ALL or HW_ALL,
  913. * it is necessary to set T-state for every affected
  914. * cpus.
  915. */
  916. for_each_cpu(i, online_throttling_cpus) {
  917. match_pr = per_cpu(processors, i);
  918. /*
  919. * If the pointer is invalid, we will report the
  920. * error message and continue.
  921. */
  922. if (!match_pr) {
  923. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  924. "Invalid Pointer for CPU %d\n", i));
  925. continue;
  926. }
  927. /*
  928. * If the throttling control is unsupported on CPU i,
  929. * we will report the error message and continue.
  930. */
  931. if (!match_pr->flags.throttling) {
  932. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  933. "Throttling Controll is unsupported "
  934. "on CPU %d\n", i));
  935. continue;
  936. }
  937. t_state.cpu = i;
  938. /* FIXME: use work_on_cpu() */
  939. set_cpus_allowed_ptr(current, cpumask_of(i));
  940. ret = match_pr->throttling.
  941. acpi_processor_set_throttling(
  942. match_pr, t_state.target_state, force);
  943. }
  944. }
  945. /*
  946. * After the set_throttling is called, the
  947. * throttling notifier is called for every
  948. * affected cpu to update the T-states.
  949. * The notifier event is THROTTLING_POSTCHANGE
  950. */
  951. for_each_cpu(i, online_throttling_cpus) {
  952. t_state.cpu = i;
  953. acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE,
  954. &t_state);
  955. }
  956. /* restore the previous state */
  957. /* FIXME: use work_on_cpu() */
  958. set_cpus_allowed_ptr(current, saved_mask);
  959. free_cpumask_var(online_throttling_cpus);
  960. free_cpumask_var(saved_mask);
  961. return ret;
  962. }
  963. int acpi_processor_get_throttling_info(struct acpi_processor *pr)
  964. {
  965. int result = 0;
  966. struct acpi_processor_throttling *pthrottling;
  967. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  968. "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
  969. pr->throttling.address,
  970. pr->throttling.duty_offset,
  971. pr->throttling.duty_width));
  972. if (!pr)
  973. return -EINVAL;
  974. /*
  975. * Evaluate _PTC, _TSS and _TPC
  976. * They must all be present or none of them can be used.
  977. */
  978. if (acpi_processor_get_throttling_control(pr) ||
  979. acpi_processor_get_throttling_states(pr) ||
  980. acpi_processor_get_platform_limit(pr))
  981. {
  982. pr->throttling.acpi_processor_get_throttling =
  983. &acpi_processor_get_throttling_fadt;
  984. pr->throttling.acpi_processor_set_throttling =
  985. &acpi_processor_set_throttling_fadt;
  986. if (acpi_processor_get_fadt_info(pr))
  987. return 0;
  988. } else {
  989. pr->throttling.acpi_processor_get_throttling =
  990. &acpi_processor_get_throttling_ptc;
  991. pr->throttling.acpi_processor_set_throttling =
  992. &acpi_processor_set_throttling_ptc;
  993. }
  994. /*
  995. * If TSD package for one CPU can't be parsed successfully, it means
  996. * that this CPU will have no coordination with other CPUs.
  997. */
  998. if (acpi_processor_get_tsd(pr)) {
  999. pthrottling = &pr->throttling;
  1000. pthrottling->tsd_valid_flag = 0;
  1001. cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map);
  1002. pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
  1003. }
  1004. /*
  1005. * PIIX4 Errata: We don't support throttling on the original PIIX4.
  1006. * This shouldn't be an issue as few (if any) mobile systems ever
  1007. * used this part.
  1008. */
  1009. if (errata.piix4.throttle) {
  1010. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  1011. "Throttling not supported on PIIX4 A- or B-step\n"));
  1012. return 0;
  1013. }
  1014. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
  1015. pr->throttling.state_count));
  1016. pr->flags.throttling = 1;
  1017. /*
  1018. * Disable throttling (if enabled). We'll let subsequent policy (e.g.
  1019. * thermal) decide to lower performance if it so chooses, but for now
  1020. * we'll crank up the speed.
  1021. */
  1022. result = acpi_processor_get_throttling(pr);
  1023. if (result)
  1024. goto end;
  1025. if (pr->throttling.state) {
  1026. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  1027. "Disabling throttling (was T%d)\n",
  1028. pr->throttling.state));
  1029. result = acpi_processor_set_throttling(pr, 0, false);
  1030. if (result)
  1031. goto end;
  1032. }
  1033. end:
  1034. if (result)
  1035. pr->flags.throttling = 0;
  1036. return result;
  1037. }
  1038. /* proc interface */
  1039. static int acpi_processor_throttling_seq_show(struct seq_file *seq,
  1040. void *offset)
  1041. {
  1042. struct acpi_processor *pr = seq->private;
  1043. int i = 0;
  1044. int result = 0;
  1045. if (!pr)
  1046. goto end;
  1047. if (!(pr->throttling.state_count > 0)) {
  1048. seq_puts(seq, "<not supported>\n");
  1049. goto end;
  1050. }
  1051. result = acpi_processor_get_throttling(pr);
  1052. if (result) {
  1053. seq_puts(seq,
  1054. "Could not determine current throttling state.\n");
  1055. goto end;
  1056. }
  1057. seq_printf(seq, "state count: %d\n"
  1058. "active state: T%d\n"
  1059. "state available: T%d to T%d\n",
  1060. pr->throttling.state_count, pr->throttling.state,
  1061. pr->throttling_platform_limit,
  1062. pr->throttling.state_count - 1);
  1063. seq_puts(seq, "states:\n");
  1064. if (pr->throttling.acpi_processor_get_throttling ==
  1065. acpi_processor_get_throttling_fadt) {
  1066. for (i = 0; i < pr->throttling.state_count; i++)
  1067. seq_printf(seq, " %cT%d: %02d%%\n",
  1068. (i == pr->throttling.state ? '*' : ' '), i,
  1069. (pr->throttling.states[i].performance ? pr->
  1070. throttling.states[i].performance / 10 : 0));
  1071. } else {
  1072. for (i = 0; i < pr->throttling.state_count; i++)
  1073. seq_printf(seq, " %cT%d: %02d%%\n",
  1074. (i == pr->throttling.state ? '*' : ' '), i,
  1075. (int)pr->throttling.states_tss[i].
  1076. freqpercentage);
  1077. }
  1078. end:
  1079. return 0;
  1080. }
  1081. static int acpi_processor_throttling_open_fs(struct inode *inode,
  1082. struct file *file)
  1083. {
  1084. return single_open(file, acpi_processor_throttling_seq_show,
  1085. PDE(inode)->data);
  1086. }
  1087. static ssize_t acpi_processor_write_throttling(struct file *file,
  1088. const char __user * buffer,
  1089. size_t count, loff_t * data)
  1090. {
  1091. int result = 0;
  1092. struct seq_file *m = file->private_data;
  1093. struct acpi_processor *pr = m->private;
  1094. char state_string[5] = "";
  1095. char *charp = NULL;
  1096. size_t state_val = 0;
  1097. char tmpbuf[5] = "";
  1098. if (!pr || (count > sizeof(state_string) - 1))
  1099. return -EINVAL;
  1100. if (copy_from_user(state_string, buffer, count))
  1101. return -EFAULT;
  1102. state_string[count] = '\0';
  1103. if ((count > 0) && (state_string[count-1] == '\n'))
  1104. state_string[count-1] = '\0';
  1105. charp = state_string;
  1106. if ((state_string[0] == 't') || (state_string[0] == 'T'))
  1107. charp++;
  1108. state_val = simple_strtoul(charp, NULL, 0);
  1109. if (state_val >= pr->throttling.state_count)
  1110. return -EINVAL;
  1111. snprintf(tmpbuf, 5, "%zu", state_val);
  1112. if (strcmp(tmpbuf, charp) != 0)
  1113. return -EINVAL;
  1114. result = acpi_processor_set_throttling(pr, state_val, false);
  1115. if (result)
  1116. return result;
  1117. return count;
  1118. }
  1119. const struct file_operations acpi_processor_throttling_fops = {
  1120. .owner = THIS_MODULE,
  1121. .open = acpi_processor_throttling_open_fs,
  1122. .read = seq_read,
  1123. .write = acpi_processor_write_throttling,
  1124. .llseek = seq_lseek,
  1125. .release = single_release,
  1126. };