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/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 PREFIX "ACPI: "
  41. #define ACPI_PROCESSOR_CLASS "processor"
  42. #define _COMPONENT ACPI_PROCESSOR_COMPONENT
  43. ACPI_MODULE_NAME("processor_throttling");
  44. /* ignore_tpc:
  45. * 0 -> acpi processor driver doesn't ignore _TPC values
  46. * 1 -> acpi processor driver ignores _TPC values
  47. */
  48. static int ignore_tpc;
  49. module_param(ignore_tpc, int, 0644);
  50. MODULE_PARM_DESC(ignore_tpc, "Disable broken BIOS _TPC throttling support");
  51. struct throttling_tstate {
  52. unsigned int cpu; /* cpu nr */
  53. int target_state; /* target T-state */
  54. };
  55. #define THROTTLING_PRECHANGE (1)
  56. #define THROTTLING_POSTCHANGE (2)
  57. static int acpi_processor_get_throttling(struct acpi_processor *pr);
  58. int acpi_processor_set_throttling(struct acpi_processor *pr,
  59. int state, bool force);
  60. static int acpi_processor_update_tsd_coord(void)
  61. {
  62. int count, count_target;
  63. int retval = 0;
  64. unsigned int i, j;
  65. cpumask_var_t covered_cpus;
  66. struct acpi_processor *pr, *match_pr;
  67. struct acpi_tsd_package *pdomain, *match_pdomain;
  68. struct acpi_processor_throttling *pthrottling, *match_pthrottling;
  69. if (!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))
  70. return -ENOMEM;
  71. /*
  72. * Now that we have _TSD data from all CPUs, lets setup T-state
  73. * coordination between all CPUs.
  74. */
  75. for_each_possible_cpu(i) {
  76. pr = per_cpu(processors, i);
  77. if (!pr)
  78. continue;
  79. /* Basic validity check for domain info */
  80. pthrottling = &(pr->throttling);
  81. /*
  82. * If tsd package for one cpu is invalid, the coordination
  83. * among all CPUs is thought as invalid.
  84. * Maybe it is ugly.
  85. */
  86. if (!pthrottling->tsd_valid_flag) {
  87. retval = -EINVAL;
  88. break;
  89. }
  90. }
  91. if (retval)
  92. goto err_ret;
  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. if (!pr)
  968. return -EINVAL;
  969. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  970. "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
  971. pr->throttling.address,
  972. pr->throttling.duty_offset,
  973. pr->throttling.duty_width));
  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. #ifdef CONFIG_ACPI_PROCFS
  1040. static int acpi_processor_throttling_seq_show(struct seq_file *seq,
  1041. void *offset)
  1042. {
  1043. struct acpi_processor *pr = seq->private;
  1044. int i = 0;
  1045. int result = 0;
  1046. if (!pr)
  1047. goto end;
  1048. if (!(pr->throttling.state_count > 0)) {
  1049. seq_puts(seq, "<not supported>\n");
  1050. goto end;
  1051. }
  1052. result = acpi_processor_get_throttling(pr);
  1053. if (result) {
  1054. seq_puts(seq,
  1055. "Could not determine current throttling state.\n");
  1056. goto end;
  1057. }
  1058. seq_printf(seq, "state count: %d\n"
  1059. "active state: T%d\n"
  1060. "state available: T%d to T%d\n",
  1061. pr->throttling.state_count, pr->throttling.state,
  1062. pr->throttling_platform_limit,
  1063. pr->throttling.state_count - 1);
  1064. seq_puts(seq, "states:\n");
  1065. if (pr->throttling.acpi_processor_get_throttling ==
  1066. acpi_processor_get_throttling_fadt) {
  1067. for (i = 0; i < pr->throttling.state_count; i++)
  1068. seq_printf(seq, " %cT%d: %02d%%\n",
  1069. (i == pr->throttling.state ? '*' : ' '), i,
  1070. (pr->throttling.states[i].performance ? pr->
  1071. throttling.states[i].performance / 10 : 0));
  1072. } else {
  1073. for (i = 0; i < pr->throttling.state_count; i++)
  1074. seq_printf(seq, " %cT%d: %02d%%\n",
  1075. (i == pr->throttling.state ? '*' : ' '), i,
  1076. (int)pr->throttling.states_tss[i].
  1077. freqpercentage);
  1078. }
  1079. end:
  1080. return 0;
  1081. }
  1082. static int acpi_processor_throttling_open_fs(struct inode *inode,
  1083. struct file *file)
  1084. {
  1085. return single_open(file, acpi_processor_throttling_seq_show,
  1086. PDE(inode)->data);
  1087. }
  1088. static ssize_t acpi_processor_write_throttling(struct file *file,
  1089. const char __user * buffer,
  1090. size_t count, loff_t * data)
  1091. {
  1092. int result = 0;
  1093. struct seq_file *m = file->private_data;
  1094. struct acpi_processor *pr = m->private;
  1095. char state_string[5] = "";
  1096. char *charp = NULL;
  1097. size_t state_val = 0;
  1098. char tmpbuf[5] = "";
  1099. if (!pr || (count > sizeof(state_string) - 1))
  1100. return -EINVAL;
  1101. if (copy_from_user(state_string, buffer, count))
  1102. return -EFAULT;
  1103. state_string[count] = '\0';
  1104. if ((count > 0) && (state_string[count-1] == '\n'))
  1105. state_string[count-1] = '\0';
  1106. charp = state_string;
  1107. if ((state_string[0] == 't') || (state_string[0] == 'T'))
  1108. charp++;
  1109. state_val = simple_strtoul(charp, NULL, 0);
  1110. if (state_val >= pr->throttling.state_count)
  1111. return -EINVAL;
  1112. snprintf(tmpbuf, 5, "%zu", state_val);
  1113. if (strcmp(tmpbuf, charp) != 0)
  1114. return -EINVAL;
  1115. result = acpi_processor_set_throttling(pr, state_val, false);
  1116. if (result)
  1117. return result;
  1118. return count;
  1119. }
  1120. const struct file_operations acpi_processor_throttling_fops = {
  1121. .owner = THIS_MODULE,
  1122. .open = acpi_processor_throttling_open_fs,
  1123. .read = seq_read,
  1124. .write = acpi_processor_write_throttling,
  1125. .llseek = seq_lseek,
  1126. .release = single_release,
  1127. };
  1128. #endif