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 (!alloc_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. cpumask_clear(covered_cpus);
  94. for_each_possible_cpu(i) {
  95. pr = per_cpu(processors, i);
  96. if (!pr)
  97. continue;
  98. if (cpumask_test_cpu(i, covered_cpus))
  99. continue;
  100. pthrottling = &pr->throttling;
  101. pdomain = &(pthrottling->domain_info);
  102. cpumask_set_cpu(i, pthrottling->shared_cpu_map);
  103. cpumask_set_cpu(i, covered_cpus);
  104. /*
  105. * If the number of processor in the TSD domain is 1, it is
  106. * unnecessary to parse the coordination for this CPU.
  107. */
  108. if (pdomain->num_processors <= 1)
  109. continue;
  110. /* Validate the Domain info */
  111. count_target = pdomain->num_processors;
  112. count = 1;
  113. for_each_possible_cpu(j) {
  114. if (i == j)
  115. continue;
  116. match_pr = per_cpu(processors, j);
  117. if (!match_pr)
  118. continue;
  119. match_pthrottling = &(match_pr->throttling);
  120. match_pdomain = &(match_pthrottling->domain_info);
  121. if (match_pdomain->domain != pdomain->domain)
  122. continue;
  123. /* Here i and j are in the same domain.
  124. * If two TSD packages have the same domain, they
  125. * should have the same num_porcessors and
  126. * coordination type. Otherwise it will be regarded
  127. * as illegal.
  128. */
  129. if (match_pdomain->num_processors != count_target) {
  130. retval = -EINVAL;
  131. goto err_ret;
  132. }
  133. if (pdomain->coord_type != match_pdomain->coord_type) {
  134. retval = -EINVAL;
  135. goto err_ret;
  136. }
  137. cpumask_set_cpu(j, covered_cpus);
  138. cpumask_set_cpu(j, pthrottling->shared_cpu_map);
  139. count++;
  140. }
  141. for_each_possible_cpu(j) {
  142. if (i == j)
  143. continue;
  144. match_pr = per_cpu(processors, j);
  145. if (!match_pr)
  146. continue;
  147. match_pthrottling = &(match_pr->throttling);
  148. match_pdomain = &(match_pthrottling->domain_info);
  149. if (match_pdomain->domain != pdomain->domain)
  150. continue;
  151. /*
  152. * If some CPUS have the same domain, they
  153. * will have the same shared_cpu_map.
  154. */
  155. cpumask_copy(match_pthrottling->shared_cpu_map,
  156. pthrottling->shared_cpu_map);
  157. }
  158. }
  159. err_ret:
  160. free_cpumask_var(covered_cpus);
  161. for_each_possible_cpu(i) {
  162. pr = per_cpu(processors, i);
  163. if (!pr)
  164. continue;
  165. /*
  166. * Assume no coordination on any error parsing domain info.
  167. * The coordination type will be forced as SW_ALL.
  168. */
  169. if (retval) {
  170. pthrottling = &(pr->throttling);
  171. cpumask_clear(pthrottling->shared_cpu_map);
  172. cpumask_set_cpu(i, pthrottling->shared_cpu_map);
  173. pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
  174. }
  175. }
  176. return retval;
  177. }
  178. /*
  179. * Update the T-state coordination after the _TSD
  180. * data for all cpus is obtained.
  181. */
  182. void acpi_processor_throttling_init(void)
  183. {
  184. if (acpi_processor_update_tsd_coord())
  185. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  186. "Assume no T-state coordination\n"));
  187. return;
  188. }
  189. static int acpi_processor_throttling_notifier(unsigned long event, void *data)
  190. {
  191. struct throttling_tstate *p_tstate = data;
  192. struct acpi_processor *pr;
  193. unsigned int cpu ;
  194. int target_state;
  195. struct acpi_processor_limit *p_limit;
  196. struct acpi_processor_throttling *p_throttling;
  197. cpu = p_tstate->cpu;
  198. pr = per_cpu(processors, cpu);
  199. if (!pr) {
  200. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid pr pointer\n"));
  201. return 0;
  202. }
  203. if (!pr->flags.throttling) {
  204. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Throttling control is "
  205. "unsupported on CPU %d\n", cpu));
  206. return 0;
  207. }
  208. target_state = p_tstate->target_state;
  209. p_throttling = &(pr->throttling);
  210. switch (event) {
  211. case THROTTLING_PRECHANGE:
  212. /*
  213. * Prechange event is used to choose one proper t-state,
  214. * which meets the limits of thermal, user and _TPC.
  215. */
  216. p_limit = &pr->limit;
  217. if (p_limit->thermal.tx > target_state)
  218. target_state = p_limit->thermal.tx;
  219. if (p_limit->user.tx > target_state)
  220. target_state = p_limit->user.tx;
  221. if (pr->throttling_platform_limit > target_state)
  222. target_state = pr->throttling_platform_limit;
  223. if (target_state >= p_throttling->state_count) {
  224. printk(KERN_WARNING
  225. "Exceed the limit of T-state \n");
  226. target_state = p_throttling->state_count - 1;
  227. }
  228. p_tstate->target_state = target_state;
  229. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PreChange Event:"
  230. "target T-state of CPU %d is T%d\n",
  231. cpu, target_state));
  232. break;
  233. case THROTTLING_POSTCHANGE:
  234. /*
  235. * Postchange event is only used to update the
  236. * T-state flag of acpi_processor_throttling.
  237. */
  238. p_throttling->state = target_state;
  239. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PostChange Event:"
  240. "CPU %d is switched to T%d\n",
  241. cpu, target_state));
  242. break;
  243. default:
  244. printk(KERN_WARNING
  245. "Unsupported Throttling notifier event\n");
  246. break;
  247. }
  248. return 0;
  249. }
  250. /*
  251. * _TPC - Throttling Present Capabilities
  252. */
  253. static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
  254. {
  255. acpi_status status = 0;
  256. unsigned long long tpc = 0;
  257. if (!pr)
  258. return -EINVAL;
  259. if (ignore_tpc)
  260. goto end;
  261. status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
  262. if (ACPI_FAILURE(status)) {
  263. if (status != AE_NOT_FOUND) {
  264. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
  265. }
  266. return -ENODEV;
  267. }
  268. end:
  269. pr->throttling_platform_limit = (int)tpc;
  270. return 0;
  271. }
  272. int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
  273. {
  274. int result = 0;
  275. int throttling_limit;
  276. int current_state;
  277. struct acpi_processor_limit *limit;
  278. int target_state;
  279. if (ignore_tpc)
  280. return 0;
  281. result = acpi_processor_get_platform_limit(pr);
  282. if (result) {
  283. /* Throttling Limit is unsupported */
  284. return result;
  285. }
  286. throttling_limit = pr->throttling_platform_limit;
  287. if (throttling_limit >= pr->throttling.state_count) {
  288. /* Uncorrect Throttling Limit */
  289. return -EINVAL;
  290. }
  291. current_state = pr->throttling.state;
  292. if (current_state > throttling_limit) {
  293. /*
  294. * The current state can meet the requirement of
  295. * _TPC limit. But it is reasonable that OSPM changes
  296. * t-states from high to low for better performance.
  297. * Of course the limit condition of thermal
  298. * and user should be considered.
  299. */
  300. limit = &pr->limit;
  301. target_state = throttling_limit;
  302. if (limit->thermal.tx > target_state)
  303. target_state = limit->thermal.tx;
  304. if (limit->user.tx > target_state)
  305. target_state = limit->user.tx;
  306. } else if (current_state == throttling_limit) {
  307. /*
  308. * Unnecessary to change the throttling state
  309. */
  310. return 0;
  311. } else {
  312. /*
  313. * If the current state is lower than the limit of _TPC, it
  314. * will be forced to switch to the throttling state defined
  315. * by throttling_platfor_limit.
  316. * Because the previous state meets with the limit condition
  317. * of thermal and user, it is unnecessary to check it again.
  318. */
  319. target_state = throttling_limit;
  320. }
  321. return acpi_processor_set_throttling(pr, target_state, false);
  322. }
  323. /*
  324. * _PTC - Processor Throttling Control (and status) register location
  325. */
  326. static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
  327. {
  328. int result = 0;
  329. acpi_status status = 0;
  330. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  331. union acpi_object *ptc = NULL;
  332. union acpi_object obj = { 0 };
  333. struct acpi_processor_throttling *throttling;
  334. status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
  335. if (ACPI_FAILURE(status)) {
  336. if (status != AE_NOT_FOUND) {
  337. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC"));
  338. }
  339. return -ENODEV;
  340. }
  341. ptc = (union acpi_object *)buffer.pointer;
  342. if (!ptc || (ptc->type != ACPI_TYPE_PACKAGE)
  343. || (ptc->package.count != 2)) {
  344. printk(KERN_ERR PREFIX "Invalid _PTC data\n");
  345. result = -EFAULT;
  346. goto end;
  347. }
  348. /*
  349. * control_register
  350. */
  351. obj = ptc->package.elements[0];
  352. if ((obj.type != ACPI_TYPE_BUFFER)
  353. || (obj.buffer.length < sizeof(struct acpi_ptc_register))
  354. || (obj.buffer.pointer == NULL)) {
  355. printk(KERN_ERR PREFIX
  356. "Invalid _PTC data (control_register)\n");
  357. result = -EFAULT;
  358. goto end;
  359. }
  360. memcpy(&pr->throttling.control_register, obj.buffer.pointer,
  361. sizeof(struct acpi_ptc_register));
  362. /*
  363. * status_register
  364. */
  365. obj = ptc->package.elements[1];
  366. if ((obj.type != ACPI_TYPE_BUFFER)
  367. || (obj.buffer.length < sizeof(struct acpi_ptc_register))
  368. || (obj.buffer.pointer == NULL)) {
  369. printk(KERN_ERR PREFIX "Invalid _PTC data (status_register)\n");
  370. result = -EFAULT;
  371. goto end;
  372. }
  373. memcpy(&pr->throttling.status_register, obj.buffer.pointer,
  374. sizeof(struct acpi_ptc_register));
  375. throttling = &pr->throttling;
  376. if ((throttling->control_register.bit_width +
  377. throttling->control_register.bit_offset) > 32) {
  378. printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
  379. result = -EFAULT;
  380. goto end;
  381. }
  382. if ((throttling->status_register.bit_width +
  383. throttling->status_register.bit_offset) > 32) {
  384. printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
  385. result = -EFAULT;
  386. goto end;
  387. }
  388. end:
  389. kfree(buffer.pointer);
  390. return result;
  391. }
  392. /*
  393. * _TSS - Throttling Supported States
  394. */
  395. static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
  396. {
  397. int result = 0;
  398. acpi_status status = AE_OK;
  399. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  400. struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
  401. struct acpi_buffer state = { 0, NULL };
  402. union acpi_object *tss = NULL;
  403. int i;
  404. status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
  405. if (ACPI_FAILURE(status)) {
  406. if (status != AE_NOT_FOUND) {
  407. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS"));
  408. }
  409. return -ENODEV;
  410. }
  411. tss = buffer.pointer;
  412. if (!tss || (tss->type != ACPI_TYPE_PACKAGE)) {
  413. printk(KERN_ERR PREFIX "Invalid _TSS data\n");
  414. result = -EFAULT;
  415. goto end;
  416. }
  417. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
  418. tss->package.count));
  419. pr->throttling.state_count = tss->package.count;
  420. pr->throttling.states_tss =
  421. kmalloc(sizeof(struct acpi_processor_tx_tss) * tss->package.count,
  422. GFP_KERNEL);
  423. if (!pr->throttling.states_tss) {
  424. result = -ENOMEM;
  425. goto end;
  426. }
  427. for (i = 0; i < pr->throttling.state_count; i++) {
  428. struct acpi_processor_tx_tss *tx =
  429. (struct acpi_processor_tx_tss *)&(pr->throttling.
  430. states_tss[i]);
  431. state.length = sizeof(struct acpi_processor_tx_tss);
  432. state.pointer = tx;
  433. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
  434. status = acpi_extract_package(&(tss->package.elements[i]),
  435. &format, &state);
  436. if (ACPI_FAILURE(status)) {
  437. ACPI_EXCEPTION((AE_INFO, status, "Invalid _TSS data"));
  438. result = -EFAULT;
  439. kfree(pr->throttling.states_tss);
  440. goto end;
  441. }
  442. if (!tx->freqpercentage) {
  443. printk(KERN_ERR PREFIX
  444. "Invalid _TSS data: freq is zero\n");
  445. result = -EFAULT;
  446. kfree(pr->throttling.states_tss);
  447. goto end;
  448. }
  449. }
  450. end:
  451. kfree(buffer.pointer);
  452. return result;
  453. }
  454. /*
  455. * _TSD - T-State Dependencies
  456. */
  457. static int acpi_processor_get_tsd(struct acpi_processor *pr)
  458. {
  459. int result = 0;
  460. acpi_status status = AE_OK;
  461. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  462. struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
  463. struct acpi_buffer state = { 0, NULL };
  464. union acpi_object *tsd = NULL;
  465. struct acpi_tsd_package *pdomain;
  466. struct acpi_processor_throttling *pthrottling;
  467. pthrottling = &pr->throttling;
  468. pthrottling->tsd_valid_flag = 0;
  469. status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
  470. if (ACPI_FAILURE(status)) {
  471. if (status != AE_NOT_FOUND) {
  472. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSD"));
  473. }
  474. return -ENODEV;
  475. }
  476. tsd = buffer.pointer;
  477. if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) {
  478. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  479. result = -EFAULT;
  480. goto end;
  481. }
  482. if (tsd->package.count != 1) {
  483. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  484. result = -EFAULT;
  485. goto end;
  486. }
  487. pdomain = &(pr->throttling.domain_info);
  488. state.length = sizeof(struct acpi_tsd_package);
  489. state.pointer = pdomain;
  490. status = acpi_extract_package(&(tsd->package.elements[0]),
  491. &format, &state);
  492. if (ACPI_FAILURE(status)) {
  493. printk(KERN_ERR PREFIX "Invalid _TSD data\n");
  494. result = -EFAULT;
  495. goto end;
  496. }
  497. if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) {
  498. printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n");
  499. result = -EFAULT;
  500. goto end;
  501. }
  502. if (pdomain->revision != ACPI_TSD_REV0_REVISION) {
  503. printk(KERN_ERR PREFIX "Unknown _TSD:revision\n");
  504. result = -EFAULT;
  505. goto end;
  506. }
  507. pthrottling = &pr->throttling;
  508. pthrottling->tsd_valid_flag = 1;
  509. pthrottling->shared_type = pdomain->coord_type;
  510. cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map);
  511. /*
  512. * If the coordination type is not defined in ACPI spec,
  513. * the tsd_valid_flag will be clear and coordination type
  514. * will be forecd as DOMAIN_COORD_TYPE_SW_ALL.
  515. */
  516. if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL &&
  517. pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY &&
  518. pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) {
  519. pthrottling->tsd_valid_flag = 0;
  520. pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL;
  521. }
  522. end:
  523. kfree(buffer.pointer);
  524. return result;
  525. }
  526. /* --------------------------------------------------------------------------
  527. Throttling Control
  528. -------------------------------------------------------------------------- */
  529. static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
  530. {
  531. int state = 0;
  532. u32 value = 0;
  533. u32 duty_mask = 0;
  534. u32 duty_value = 0;
  535. if (!pr)
  536. return -EINVAL;
  537. if (!pr->flags.throttling)
  538. return -ENODEV;
  539. pr->throttling.state = 0;
  540. duty_mask = pr->throttling.state_count - 1;
  541. duty_mask <<= pr->throttling.duty_offset;
  542. local_irq_disable();
  543. value = inl(pr->throttling.address);
  544. /*
  545. * Compute the current throttling state when throttling is enabled
  546. * (bit 4 is on).
  547. */
  548. if (value & 0x10) {
  549. duty_value = value & duty_mask;
  550. duty_value >>= pr->throttling.duty_offset;
  551. if (duty_value)
  552. state = pr->throttling.state_count - duty_value;
  553. }
  554. pr->throttling.state = state;
  555. local_irq_enable();
  556. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  557. "Throttling state is T%d (%d%% throttling applied)\n",
  558. state, pr->throttling.states[state].performance));
  559. return 0;
  560. }
  561. #ifdef CONFIG_X86
  562. static int acpi_throttling_rdmsr(struct acpi_processor *pr,
  563. acpi_integer * value)
  564. {
  565. struct cpuinfo_x86 *c;
  566. u64 msr_high, msr_low;
  567. unsigned int cpu;
  568. u64 msr = 0;
  569. int ret = -1;
  570. cpu = pr->id;
  571. c = &cpu_data(cpu);
  572. if ((c->x86_vendor != X86_VENDOR_INTEL) ||
  573. !cpu_has(c, X86_FEATURE_ACPI)) {
  574. printk(KERN_ERR PREFIX
  575. "HARDWARE addr space,NOT supported yet\n");
  576. } else {
  577. msr_low = 0;
  578. msr_high = 0;
  579. rdmsr_safe(MSR_IA32_THERM_CONTROL,
  580. (u32 *)&msr_low , (u32 *) &msr_high);
  581. msr = (msr_high << 32) | msr_low;
  582. *value = (acpi_integer) msr;
  583. ret = 0;
  584. }
  585. return ret;
  586. }
  587. static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
  588. {
  589. struct cpuinfo_x86 *c;
  590. unsigned int cpu;
  591. int ret = -1;
  592. u64 msr;
  593. cpu = pr->id;
  594. c = &cpu_data(cpu);
  595. if ((c->x86_vendor != X86_VENDOR_INTEL) ||
  596. !cpu_has(c, X86_FEATURE_ACPI)) {
  597. printk(KERN_ERR PREFIX
  598. "HARDWARE addr space,NOT supported yet\n");
  599. } else {
  600. msr = value;
  601. wrmsr_safe(MSR_IA32_THERM_CONTROL,
  602. msr & 0xffffffff, msr >> 32);
  603. ret = 0;
  604. }
  605. return ret;
  606. }
  607. #else
  608. static int acpi_throttling_rdmsr(struct acpi_processor *pr,
  609. acpi_integer * value)
  610. {
  611. printk(KERN_ERR PREFIX
  612. "HARDWARE addr space,NOT supported yet\n");
  613. return -1;
  614. }
  615. static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
  616. {
  617. printk(KERN_ERR PREFIX
  618. "HARDWARE addr space,NOT supported yet\n");
  619. return -1;
  620. }
  621. #endif
  622. static int acpi_read_throttling_status(struct acpi_processor *pr,
  623. acpi_integer *value)
  624. {
  625. u32 bit_width, bit_offset;
  626. u64 ptc_value;
  627. u64 ptc_mask;
  628. struct acpi_processor_throttling *throttling;
  629. int ret = -1;
  630. throttling = &pr->throttling;
  631. switch (throttling->status_register.space_id) {
  632. case ACPI_ADR_SPACE_SYSTEM_IO:
  633. ptc_value = 0;
  634. bit_width = throttling->status_register.bit_width;
  635. bit_offset = throttling->status_register.bit_offset;
  636. acpi_os_read_port((acpi_io_address) throttling->status_register.
  637. address, (u32 *) &ptc_value,
  638. (u32) (bit_width + bit_offset));
  639. ptc_mask = (1 << bit_width) - 1;
  640. *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask);
  641. ret = 0;
  642. break;
  643. case ACPI_ADR_SPACE_FIXED_HARDWARE:
  644. ret = acpi_throttling_rdmsr(pr, value);
  645. break;
  646. default:
  647. printk(KERN_ERR PREFIX "Unknown addr space %d\n",
  648. (u32) (throttling->status_register.space_id));
  649. }
  650. return ret;
  651. }
  652. static int acpi_write_throttling_state(struct acpi_processor *pr,
  653. acpi_integer value)
  654. {
  655. u32 bit_width, bit_offset;
  656. u64 ptc_value;
  657. u64 ptc_mask;
  658. struct acpi_processor_throttling *throttling;
  659. int ret = -1;
  660. throttling = &pr->throttling;
  661. switch (throttling->control_register.space_id) {
  662. case ACPI_ADR_SPACE_SYSTEM_IO:
  663. bit_width = throttling->control_register.bit_width;
  664. bit_offset = throttling->control_register.bit_offset;
  665. ptc_mask = (1 << bit_width) - 1;
  666. ptc_value = value & ptc_mask;
  667. acpi_os_write_port((acpi_io_address) throttling->
  668. control_register.address,
  669. (u32) (ptc_value << bit_offset),
  670. (u32) (bit_width + bit_offset));
  671. ret = 0;
  672. break;
  673. case ACPI_ADR_SPACE_FIXED_HARDWARE:
  674. ret = acpi_throttling_wrmsr(pr, value);
  675. break;
  676. default:
  677. printk(KERN_ERR PREFIX "Unknown addr space %d\n",
  678. (u32) (throttling->control_register.space_id));
  679. }
  680. return ret;
  681. }
  682. static int acpi_get_throttling_state(struct acpi_processor *pr,
  683. acpi_integer value)
  684. {
  685. int i;
  686. for (i = 0; i < pr->throttling.state_count; i++) {
  687. struct acpi_processor_tx_tss *tx =
  688. (struct acpi_processor_tx_tss *)&(pr->throttling.
  689. states_tss[i]);
  690. if (tx->control == value)
  691. return i;
  692. }
  693. return -1;
  694. }
  695. static int acpi_get_throttling_value(struct acpi_processor *pr,
  696. int state, acpi_integer *value)
  697. {
  698. int ret = -1;
  699. if (state >= 0 && state <= pr->throttling.state_count) {
  700. struct acpi_processor_tx_tss *tx =
  701. (struct acpi_processor_tx_tss *)&(pr->throttling.
  702. states_tss[state]);
  703. *value = tx->control;
  704. ret = 0;
  705. }
  706. return ret;
  707. }
  708. static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
  709. {
  710. int state = 0;
  711. int ret;
  712. acpi_integer value;
  713. if (!pr)
  714. return -EINVAL;
  715. if (!pr->flags.throttling)
  716. return -ENODEV;
  717. pr->throttling.state = 0;
  718. value = 0;
  719. ret = acpi_read_throttling_status(pr, &value);
  720. if (ret >= 0) {
  721. state = acpi_get_throttling_state(pr, value);
  722. if (state == -1) {
  723. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  724. "Invalid throttling state, reset\n"));
  725. state = 0;
  726. ret = acpi_processor_set_throttling(pr, state, true);
  727. if (ret)
  728. return ret;
  729. }
  730. pr->throttling.state = state;
  731. }
  732. return 0;
  733. }
  734. static int acpi_processor_get_throttling(struct acpi_processor *pr)
  735. {
  736. cpumask_var_t saved_mask;
  737. int ret;
  738. if (!pr)
  739. return -EINVAL;
  740. if (!pr->flags.throttling)
  741. return -ENODEV;
  742. if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
  743. return -ENOMEM;
  744. /*
  745. * Migrate task to the cpu pointed by pr.
  746. */
  747. cpumask_copy(saved_mask, &current->cpus_allowed);
  748. /* FIXME: use work_on_cpu() */
  749. set_cpus_allowed_ptr(current, cpumask_of(pr->id));
  750. ret = pr->throttling.acpi_processor_get_throttling(pr);
  751. /* restore the previous state */
  752. set_cpus_allowed_ptr(current, saved_mask);
  753. free_cpumask_var(saved_mask);
  754. return ret;
  755. }
  756. static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
  757. {
  758. int i, step;
  759. if (!pr->throttling.address) {
  760. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
  761. return -EINVAL;
  762. } else if (!pr->throttling.duty_width) {
  763. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
  764. return -EINVAL;
  765. }
  766. /* TBD: Support duty_cycle values that span bit 4. */
  767. else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
  768. printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
  769. return -EINVAL;
  770. }
  771. pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
  772. /*
  773. * Compute state values. Note that throttling displays a linear power
  774. * performance relationship (at 50% performance the CPU will consume
  775. * 50% power). Values are in 1/10th of a percent to preserve accuracy.
  776. */
  777. step = (1000 / pr->throttling.state_count);
  778. for (i = 0; i < pr->throttling.state_count; i++) {
  779. pr->throttling.states[i].performance = 1000 - step * i;
  780. pr->throttling.states[i].power = 1000 - step * i;
  781. }
  782. return 0;
  783. }
  784. static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
  785. int state, bool force)
  786. {
  787. u32 value = 0;
  788. u32 duty_mask = 0;
  789. u32 duty_value = 0;
  790. if (!pr)
  791. return -EINVAL;
  792. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  793. return -EINVAL;
  794. if (!pr->flags.throttling)
  795. return -ENODEV;
  796. if (!force && (state == pr->throttling.state))
  797. return 0;
  798. if (state < pr->throttling_platform_limit)
  799. return -EPERM;
  800. /*
  801. * Calculate the duty_value and duty_mask.
  802. */
  803. if (state) {
  804. duty_value = pr->throttling.state_count - state;
  805. duty_value <<= pr->throttling.duty_offset;
  806. /* Used to clear all duty_value bits */
  807. duty_mask = pr->throttling.state_count - 1;
  808. duty_mask <<= acpi_gbl_FADT.duty_offset;
  809. duty_mask = ~duty_mask;
  810. }
  811. local_irq_disable();
  812. /*
  813. * Disable throttling by writing a 0 to bit 4. Note that we must
  814. * turn it off before you can change the duty_value.
  815. */
  816. value = inl(pr->throttling.address);
  817. if (value & 0x10) {
  818. value &= 0xFFFFFFEF;
  819. outl(value, pr->throttling.address);
  820. }
  821. /*
  822. * Write the new duty_value and then enable throttling. Note
  823. * that a state value of 0 leaves throttling disabled.
  824. */
  825. if (state) {
  826. value &= duty_mask;
  827. value |= duty_value;
  828. outl(value, pr->throttling.address);
  829. value |= 0x00000010;
  830. outl(value, pr->throttling.address);
  831. }
  832. pr->throttling.state = state;
  833. local_irq_enable();
  834. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  835. "Throttling state set to T%d (%d%%)\n", state,
  836. (pr->throttling.states[state].performance ? pr->
  837. throttling.states[state].performance / 10 : 0)));
  838. return 0;
  839. }
  840. static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
  841. int state, bool force)
  842. {
  843. int ret;
  844. acpi_integer value;
  845. if (!pr)
  846. return -EINVAL;
  847. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  848. return -EINVAL;
  849. if (!pr->flags.throttling)
  850. return -ENODEV;
  851. if (!force && (state == pr->throttling.state))
  852. return 0;
  853. if (state < pr->throttling_platform_limit)
  854. return -EPERM;
  855. value = 0;
  856. ret = acpi_get_throttling_value(pr, state, &value);
  857. if (ret >= 0) {
  858. acpi_write_throttling_state(pr, value);
  859. pr->throttling.state = state;
  860. }
  861. return 0;
  862. }
  863. int acpi_processor_set_throttling(struct acpi_processor *pr,
  864. int state, bool force)
  865. {
  866. cpumask_var_t saved_mask;
  867. int ret = 0;
  868. unsigned int i;
  869. struct acpi_processor *match_pr;
  870. struct acpi_processor_throttling *p_throttling;
  871. struct throttling_tstate t_state;
  872. cpumask_var_t online_throttling_cpus;
  873. if (!pr)
  874. return -EINVAL;
  875. if (!pr->flags.throttling)
  876. return -ENODEV;
  877. if ((state < 0) || (state > (pr->throttling.state_count - 1)))
  878. return -EINVAL;
  879. if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
  880. return -ENOMEM;
  881. if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {
  882. free_cpumask_var(saved_mask);
  883. return -ENOMEM;
  884. }
  885. cpumask_copy(saved_mask, &current->cpus_allowed);
  886. t_state.target_state = state;
  887. p_throttling = &(pr->throttling);
  888. cpumask_and(online_throttling_cpus, cpu_online_mask,
  889. p_throttling->shared_cpu_map);
  890. /*
  891. * The throttling notifier will be called for every
  892. * affected cpu in order to get one proper T-state.
  893. * The notifier event is THROTTLING_PRECHANGE.
  894. */
  895. for_each_cpu(i, online_throttling_cpus) {
  896. t_state.cpu = i;
  897. acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
  898. &t_state);
  899. }
  900. /*
  901. * The function of acpi_processor_set_throttling will be called
  902. * to switch T-state. If the coordination type is SW_ALL or HW_ALL,
  903. * it is necessary to call it for every affected cpu. Otherwise
  904. * it can be called only for the cpu pointed by pr.
  905. */
  906. if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
  907. /* FIXME: use work_on_cpu() */
  908. set_cpus_allowed_ptr(current, cpumask_of(pr->id));
  909. ret = p_throttling->acpi_processor_set_throttling(pr,
  910. t_state.target_state, force);
  911. } else {
  912. /*
  913. * When the T-state coordination is SW_ALL or HW_ALL,
  914. * it is necessary to set T-state for every affected
  915. * cpus.
  916. */
  917. for_each_cpu(i, online_throttling_cpus) {
  918. match_pr = per_cpu(processors, i);
  919. /*
  920. * If the pointer is invalid, we will report the
  921. * error message and continue.
  922. */
  923. if (!match_pr) {
  924. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  925. "Invalid Pointer for CPU %d\n", i));
  926. continue;
  927. }
  928. /*
  929. * If the throttling control is unsupported on CPU i,
  930. * we will report the error message and continue.
  931. */
  932. if (!match_pr->flags.throttling) {
  933. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  934. "Throttling Controll is unsupported "
  935. "on CPU %d\n", i));
  936. continue;
  937. }
  938. t_state.cpu = i;
  939. /* FIXME: use work_on_cpu() */
  940. set_cpus_allowed_ptr(current, cpumask_of(i));
  941. ret = match_pr->throttling.
  942. acpi_processor_set_throttling(
  943. match_pr, t_state.target_state, force);
  944. }
  945. }
  946. /*
  947. * After the set_throttling is called, the
  948. * throttling notifier is called for every
  949. * affected cpu to update the T-states.
  950. * The notifier event is THROTTLING_POSTCHANGE
  951. */
  952. for_each_cpu(i, online_throttling_cpus) {
  953. t_state.cpu = i;
  954. acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE,
  955. &t_state);
  956. }
  957. /* restore the previous state */
  958. /* FIXME: use work_on_cpu() */
  959. set_cpus_allowed_ptr(current, saved_mask);
  960. free_cpumask_var(online_throttling_cpus);
  961. free_cpumask_var(saved_mask);
  962. return ret;
  963. }
  964. int acpi_processor_get_throttling_info(struct acpi_processor *pr)
  965. {
  966. int result = 0;
  967. struct acpi_processor_throttling *pthrottling;
  968. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  969. "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
  970. pr->throttling.address,
  971. pr->throttling.duty_offset,
  972. pr->throttling.duty_width));
  973. if (!pr)
  974. return -EINVAL;
  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. /* proc interface */
  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. };