processor_throttling.c 33 KB

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