xen-acpi-processor.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /*
  2. * Copyright 2012 by Oracle Inc
  3. * Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  4. *
  5. * This code borrows ideas from https://lkml.org/lkml/2011/11/30/249
  6. * so many thanks go to Kevin Tian <kevin.tian@intel.com>
  7. * and Yu Ke <ke.yu@intel.com>.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms and conditions of the GNU General Public License,
  11. * version 2, as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. */
  19. #include <linux/cpumask.h>
  20. #include <linux/cpufreq.h>
  21. #include <linux/freezer.h>
  22. #include <linux/kernel.h>
  23. #include <linux/kthread.h>
  24. #include <linux/init.h>
  25. #include <linux/module.h>
  26. #include <linux/types.h>
  27. #include <acpi/acpi_bus.h>
  28. #include <acpi/acpi_drivers.h>
  29. #include <acpi/processor.h>
  30. #include <xen/xen.h>
  31. #include <xen/interface/platform.h>
  32. #include <asm/xen/hypercall.h>
  33. #define DRV_NAME "xen-acpi-processor: "
  34. static int no_hypercall;
  35. MODULE_PARM_DESC(off, "Inhibit the hypercall.");
  36. module_param_named(off, no_hypercall, int, 0400);
  37. /*
  38. * Note: Do not convert the acpi_id* below to cpumask_var_t or use cpumask_bit
  39. * - as those shrink to nr_cpu_bits (which is dependent on possible_cpu), which
  40. * can be less than what we want to put in. Instead use the 'nr_acpi_bits'
  41. * which is dynamically computed based on the MADT or x2APIC table.
  42. */
  43. static unsigned int nr_acpi_bits;
  44. /* Mutex to protect the acpi_ids_done - for CPU hotplug use. */
  45. static DEFINE_MUTEX(acpi_ids_mutex);
  46. /* Which ACPI ID we have processed from 'struct acpi_processor'. */
  47. static unsigned long *acpi_ids_done;
  48. /* Which ACPI ID exist in the SSDT/DSDT processor definitions. */
  49. static unsigned long __initdata *acpi_id_present;
  50. /* And if there is an _CST definition (or a PBLK) for the ACPI IDs */
  51. static unsigned long __initdata *acpi_id_cst_present;
  52. static int push_cxx_to_hypervisor(struct acpi_processor *_pr)
  53. {
  54. struct xen_platform_op op = {
  55. .cmd = XENPF_set_processor_pminfo,
  56. .interface_version = XENPF_INTERFACE_VERSION,
  57. .u.set_pminfo.id = _pr->acpi_id,
  58. .u.set_pminfo.type = XEN_PM_CX,
  59. };
  60. struct xen_processor_cx *dst_cx, *dst_cx_states = NULL;
  61. struct acpi_processor_cx *cx;
  62. unsigned int i, ok;
  63. int ret = 0;
  64. dst_cx_states = kcalloc(_pr->power.count,
  65. sizeof(struct xen_processor_cx), GFP_KERNEL);
  66. if (!dst_cx_states)
  67. return -ENOMEM;
  68. for (ok = 0, i = 1; i <= _pr->power.count; i++) {
  69. cx = &_pr->power.states[i];
  70. if (!cx->valid)
  71. continue;
  72. dst_cx = &(dst_cx_states[ok++]);
  73. dst_cx->reg.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
  74. if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
  75. dst_cx->reg.bit_width = 8;
  76. dst_cx->reg.bit_offset = 0;
  77. dst_cx->reg.access_size = 1;
  78. } else {
  79. dst_cx->reg.space_id = ACPI_ADR_SPACE_FIXED_HARDWARE;
  80. if (cx->entry_method == ACPI_CSTATE_FFH) {
  81. /* NATIVE_CSTATE_BEYOND_HALT */
  82. dst_cx->reg.bit_offset = 2;
  83. dst_cx->reg.bit_width = 1; /* VENDOR_INTEL */
  84. }
  85. dst_cx->reg.access_size = 0;
  86. }
  87. dst_cx->reg.address = cx->address;
  88. dst_cx->type = cx->type;
  89. dst_cx->latency = cx->latency;
  90. dst_cx->power = cx->power;
  91. dst_cx->dpcnt = 0;
  92. set_xen_guest_handle(dst_cx->dp, NULL);
  93. }
  94. if (!ok) {
  95. pr_debug(DRV_NAME "No _Cx for ACPI CPU %u\n", _pr->acpi_id);
  96. kfree(dst_cx_states);
  97. return -EINVAL;
  98. }
  99. op.u.set_pminfo.power.count = ok;
  100. op.u.set_pminfo.power.flags.bm_control = _pr->flags.bm_control;
  101. op.u.set_pminfo.power.flags.bm_check = _pr->flags.bm_check;
  102. op.u.set_pminfo.power.flags.has_cst = _pr->flags.has_cst;
  103. op.u.set_pminfo.power.flags.power_setup_done =
  104. _pr->flags.power_setup_done;
  105. set_xen_guest_handle(op.u.set_pminfo.power.states, dst_cx_states);
  106. if (!no_hypercall)
  107. ret = HYPERVISOR_dom0_op(&op);
  108. if (!ret) {
  109. pr_debug("ACPI CPU%u - C-states uploaded.\n", _pr->acpi_id);
  110. for (i = 1; i <= _pr->power.count; i++) {
  111. cx = &_pr->power.states[i];
  112. if (!cx->valid)
  113. continue;
  114. pr_debug(" C%d: %s %d uS\n",
  115. cx->type, cx->desc, (u32)cx->latency);
  116. }
  117. } else if (ret != -EINVAL)
  118. /* EINVAL means the ACPI ID is incorrect - meaning the ACPI
  119. * table is referencing a non-existing CPU - which can happen
  120. * with broken ACPI tables. */
  121. pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n",
  122. ret, _pr->acpi_id);
  123. kfree(dst_cx_states);
  124. return ret;
  125. }
  126. static struct xen_processor_px *
  127. xen_copy_pss_data(struct acpi_processor *_pr,
  128. struct xen_processor_performance *dst_perf)
  129. {
  130. struct xen_processor_px *dst_states = NULL;
  131. unsigned int i;
  132. BUILD_BUG_ON(sizeof(struct xen_processor_px) !=
  133. sizeof(struct acpi_processor_px));
  134. dst_states = kcalloc(_pr->performance->state_count,
  135. sizeof(struct xen_processor_px), GFP_KERNEL);
  136. if (!dst_states)
  137. return ERR_PTR(-ENOMEM);
  138. dst_perf->state_count = _pr->performance->state_count;
  139. for (i = 0; i < _pr->performance->state_count; i++) {
  140. /* Fortunatly for us, they are both the same size */
  141. memcpy(&(dst_states[i]), &(_pr->performance->states[i]),
  142. sizeof(struct acpi_processor_px));
  143. }
  144. return dst_states;
  145. }
  146. static int xen_copy_psd_data(struct acpi_processor *_pr,
  147. struct xen_processor_performance *dst)
  148. {
  149. struct acpi_psd_package *pdomain;
  150. BUILD_BUG_ON(sizeof(struct xen_psd_package) !=
  151. sizeof(struct acpi_psd_package));
  152. /* This information is enumerated only if acpi_processor_preregister_performance
  153. * has been called.
  154. */
  155. dst->shared_type = _pr->performance->shared_type;
  156. pdomain = &(_pr->performance->domain_info);
  157. /* 'acpi_processor_preregister_performance' does not parse if the
  158. * num_processors <= 1, but Xen still requires it. Do it manually here.
  159. */
  160. if (pdomain->num_processors <= 1) {
  161. if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
  162. dst->shared_type = CPUFREQ_SHARED_TYPE_ALL;
  163. else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
  164. dst->shared_type = CPUFREQ_SHARED_TYPE_HW;
  165. else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
  166. dst->shared_type = CPUFREQ_SHARED_TYPE_ANY;
  167. }
  168. memcpy(&(dst->domain_info), pdomain, sizeof(struct acpi_psd_package));
  169. return 0;
  170. }
  171. static int xen_copy_pct_data(struct acpi_pct_register *pct,
  172. struct xen_pct_register *dst_pct)
  173. {
  174. /* It would be nice if you could just do 'memcpy(pct, dst_pct') but
  175. * sadly the Xen structure did not have the proper padding so the
  176. * descriptor field takes two (dst_pct) bytes instead of one (pct).
  177. */
  178. dst_pct->descriptor = pct->descriptor;
  179. dst_pct->length = pct->length;
  180. dst_pct->space_id = pct->space_id;
  181. dst_pct->bit_width = pct->bit_width;
  182. dst_pct->bit_offset = pct->bit_offset;
  183. dst_pct->reserved = pct->reserved;
  184. dst_pct->address = pct->address;
  185. return 0;
  186. }
  187. static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
  188. {
  189. int ret = 0;
  190. struct xen_platform_op op = {
  191. .cmd = XENPF_set_processor_pminfo,
  192. .interface_version = XENPF_INTERFACE_VERSION,
  193. .u.set_pminfo.id = _pr->acpi_id,
  194. .u.set_pminfo.type = XEN_PM_PX,
  195. };
  196. struct xen_processor_performance *dst_perf;
  197. struct xen_processor_px *dst_states = NULL;
  198. dst_perf = &op.u.set_pminfo.perf;
  199. dst_perf->platform_limit = _pr->performance_platform_limit;
  200. dst_perf->flags |= XEN_PX_PPC;
  201. xen_copy_pct_data(&(_pr->performance->control_register),
  202. &dst_perf->control_register);
  203. xen_copy_pct_data(&(_pr->performance->status_register),
  204. &dst_perf->status_register);
  205. dst_perf->flags |= XEN_PX_PCT;
  206. dst_states = xen_copy_pss_data(_pr, dst_perf);
  207. if (!IS_ERR_OR_NULL(dst_states)) {
  208. set_xen_guest_handle(dst_perf->states, dst_states);
  209. dst_perf->flags |= XEN_PX_PSS;
  210. }
  211. if (!xen_copy_psd_data(_pr, dst_perf))
  212. dst_perf->flags |= XEN_PX_PSD;
  213. if (dst_perf->flags != (XEN_PX_PSD | XEN_PX_PSS | XEN_PX_PCT | XEN_PX_PPC)) {
  214. pr_warn(DRV_NAME "ACPI CPU%u missing some P-state data (%x), skipping.\n",
  215. _pr->acpi_id, dst_perf->flags);
  216. ret = -ENODEV;
  217. goto err_free;
  218. }
  219. if (!no_hypercall)
  220. ret = HYPERVISOR_dom0_op(&op);
  221. if (!ret) {
  222. struct acpi_processor_performance *perf;
  223. unsigned int i;
  224. perf = _pr->performance;
  225. pr_debug("ACPI CPU%u - P-states uploaded.\n", _pr->acpi_id);
  226. for (i = 0; i < perf->state_count; i++) {
  227. pr_debug(" %cP%d: %d MHz, %d mW, %d uS\n",
  228. (i == perf->state ? '*' : ' '), i,
  229. (u32) perf->states[i].core_frequency,
  230. (u32) perf->states[i].power,
  231. (u32) perf->states[i].transition_latency);
  232. }
  233. } else if (ret != -EINVAL)
  234. /* EINVAL means the ACPI ID is incorrect - meaning the ACPI
  235. * table is referencing a non-existing CPU - which can happen
  236. * with broken ACPI tables. */
  237. pr_warn(DRV_NAME "(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
  238. ret, _pr->acpi_id);
  239. err_free:
  240. if (!IS_ERR_OR_NULL(dst_states))
  241. kfree(dst_states);
  242. return ret;
  243. }
  244. static int upload_pm_data(struct acpi_processor *_pr)
  245. {
  246. int err = 0;
  247. mutex_lock(&acpi_ids_mutex);
  248. if (__test_and_set_bit(_pr->acpi_id, acpi_ids_done)) {
  249. mutex_unlock(&acpi_ids_mutex);
  250. return -EBUSY;
  251. }
  252. if (_pr->flags.power)
  253. err = push_cxx_to_hypervisor(_pr);
  254. if (_pr->performance && _pr->performance->states)
  255. err |= push_pxx_to_hypervisor(_pr);
  256. mutex_unlock(&acpi_ids_mutex);
  257. return err;
  258. }
  259. static unsigned int __init get_max_acpi_id(void)
  260. {
  261. struct xenpf_pcpuinfo *info;
  262. struct xen_platform_op op = {
  263. .cmd = XENPF_get_cpuinfo,
  264. .interface_version = XENPF_INTERFACE_VERSION,
  265. };
  266. int ret = 0;
  267. unsigned int i, last_cpu, max_acpi_id = 0;
  268. info = &op.u.pcpu_info;
  269. info->xen_cpuid = 0;
  270. ret = HYPERVISOR_dom0_op(&op);
  271. if (ret)
  272. return NR_CPUS;
  273. /* The max_present is the same irregardless of the xen_cpuid */
  274. last_cpu = op.u.pcpu_info.max_present;
  275. for (i = 0; i <= last_cpu; i++) {
  276. info->xen_cpuid = i;
  277. ret = HYPERVISOR_dom0_op(&op);
  278. if (ret)
  279. continue;
  280. max_acpi_id = max(info->acpi_id, max_acpi_id);
  281. }
  282. max_acpi_id *= 2; /* Slack for CPU hotplug support. */
  283. pr_debug(DRV_NAME "Max ACPI ID: %u\n", max_acpi_id);
  284. return max_acpi_id;
  285. }
  286. /*
  287. * The read_acpi_id and check_acpi_ids are there to support the Xen
  288. * oddity of virtual CPUs != physical CPUs in the initial domain.
  289. * The user can supply 'xen_max_vcpus=X' on the Xen hypervisor line
  290. * which will band the amount of CPUs the initial domain can see.
  291. * In general that is OK, except it plays havoc with any of the
  292. * for_each_[present|online]_cpu macros which are banded to the virtual
  293. * CPU amount.
  294. */
  295. static acpi_status __init
  296. read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv)
  297. {
  298. u32 acpi_id;
  299. acpi_status status;
  300. acpi_object_type acpi_type;
  301. unsigned long long tmp;
  302. union acpi_object object = { 0 };
  303. struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
  304. acpi_io_address pblk = 0;
  305. status = acpi_get_type(handle, &acpi_type);
  306. if (ACPI_FAILURE(status))
  307. return AE_OK;
  308. switch (acpi_type) {
  309. case ACPI_TYPE_PROCESSOR:
  310. status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
  311. if (ACPI_FAILURE(status))
  312. return AE_OK;
  313. acpi_id = object.processor.proc_id;
  314. pblk = object.processor.pblk_address;
  315. break;
  316. case ACPI_TYPE_DEVICE:
  317. status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp);
  318. if (ACPI_FAILURE(status))
  319. return AE_OK;
  320. acpi_id = tmp;
  321. break;
  322. default:
  323. return AE_OK;
  324. }
  325. /* There are more ACPI Processor objects than in x2APIC or MADT.
  326. * This can happen with incorrect ACPI SSDT declerations. */
  327. if (acpi_id > nr_acpi_bits) {
  328. pr_debug(DRV_NAME "We only have %u, trying to set %u\n",
  329. nr_acpi_bits, acpi_id);
  330. return AE_OK;
  331. }
  332. /* OK, There is a ACPI Processor object */
  333. __set_bit(acpi_id, acpi_id_present);
  334. pr_debug(DRV_NAME "ACPI CPU%u w/ PBLK:0x%lx\n", acpi_id,
  335. (unsigned long)pblk);
  336. status = acpi_evaluate_object(handle, "_CST", NULL, &buffer);
  337. if (ACPI_FAILURE(status)) {
  338. if (!pblk)
  339. return AE_OK;
  340. }
  341. /* .. and it has a C-state */
  342. __set_bit(acpi_id, acpi_id_cst_present);
  343. return AE_OK;
  344. }
  345. static int __init check_acpi_ids(struct acpi_processor *pr_backup)
  346. {
  347. if (!pr_backup)
  348. return -ENODEV;
  349. /* All online CPUs have been processed at this stage. Now verify
  350. * whether in fact "online CPUs" == physical CPUs.
  351. */
  352. acpi_id_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
  353. if (!acpi_id_present)
  354. return -ENOMEM;
  355. acpi_id_cst_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
  356. if (!acpi_id_cst_present) {
  357. kfree(acpi_id_present);
  358. return -ENOMEM;
  359. }
  360. acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
  361. ACPI_UINT32_MAX,
  362. read_acpi_id, NULL, NULL, NULL);
  363. acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL);
  364. if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) {
  365. unsigned int i;
  366. for_each_set_bit(i, acpi_id_present, nr_acpi_bits) {
  367. pr_backup->acpi_id = i;
  368. /* Mask out C-states if there are no _CST or PBLK */
  369. pr_backup->flags.power = test_bit(i, acpi_id_cst_present);
  370. (void)upload_pm_data(pr_backup);
  371. }
  372. }
  373. kfree(acpi_id_present);
  374. acpi_id_present = NULL;
  375. kfree(acpi_id_cst_present);
  376. acpi_id_cst_present = NULL;
  377. return 0;
  378. }
  379. static int __init check_prereq(void)
  380. {
  381. struct cpuinfo_x86 *c = &cpu_data(0);
  382. if (!xen_initial_domain())
  383. return -ENODEV;
  384. if (!acpi_gbl_FADT.smi_command)
  385. return -ENODEV;
  386. if (c->x86_vendor == X86_VENDOR_INTEL) {
  387. if (!cpu_has(c, X86_FEATURE_EST))
  388. return -ENODEV;
  389. return 0;
  390. }
  391. if (c->x86_vendor == X86_VENDOR_AMD) {
  392. /* Copied from powernow-k8.h, can't include ../cpufreq/powernow
  393. * as we get compile warnings for the static functions.
  394. */
  395. #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
  396. #define USE_HW_PSTATE 0x00000080
  397. u32 eax, ebx, ecx, edx;
  398. cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
  399. if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE)
  400. return -ENODEV;
  401. return 0;
  402. }
  403. return -ENODEV;
  404. }
  405. /* acpi_perf_data is a pointer to percpu data. */
  406. static struct acpi_processor_performance __percpu *acpi_perf_data;
  407. static void free_acpi_perf_data(void)
  408. {
  409. unsigned int i;
  410. /* Freeing a NULL pointer is OK, and alloc_percpu zeroes. */
  411. for_each_possible_cpu(i)
  412. free_cpumask_var(per_cpu_ptr(acpi_perf_data, i)
  413. ->shared_cpu_map);
  414. free_percpu(acpi_perf_data);
  415. }
  416. static int __init xen_acpi_processor_init(void)
  417. {
  418. struct acpi_processor *pr_backup = NULL;
  419. unsigned int i;
  420. int rc = check_prereq();
  421. if (rc)
  422. return rc;
  423. nr_acpi_bits = get_max_acpi_id() + 1;
  424. acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
  425. if (!acpi_ids_done)
  426. return -ENOMEM;
  427. acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
  428. if (!acpi_perf_data) {
  429. pr_debug(DRV_NAME "Memory allocation error for acpi_perf_data.\n");
  430. kfree(acpi_ids_done);
  431. return -ENOMEM;
  432. }
  433. for_each_possible_cpu(i) {
  434. if (!zalloc_cpumask_var_node(
  435. &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map,
  436. GFP_KERNEL, cpu_to_node(i))) {
  437. rc = -ENOMEM;
  438. goto err_out;
  439. }
  440. }
  441. /* Do initialization in ACPI core. It is OK to fail here. */
  442. (void)acpi_processor_preregister_performance(acpi_perf_data);
  443. for_each_possible_cpu(i) {
  444. struct acpi_processor_performance *perf;
  445. perf = per_cpu_ptr(acpi_perf_data, i);
  446. rc = acpi_processor_register_performance(perf, i);
  447. if (rc)
  448. goto err_out;
  449. }
  450. rc = acpi_processor_notify_smm(THIS_MODULE);
  451. if (rc)
  452. goto err_unregister;
  453. for_each_possible_cpu(i) {
  454. struct acpi_processor *_pr;
  455. _pr = per_cpu(processors, i /* APIC ID */);
  456. if (!_pr)
  457. continue;
  458. if (!pr_backup) {
  459. pr_backup = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
  460. if (pr_backup)
  461. memcpy(pr_backup, _pr, sizeof(struct acpi_processor));
  462. }
  463. (void)upload_pm_data(_pr);
  464. }
  465. rc = check_acpi_ids(pr_backup);
  466. kfree(pr_backup);
  467. pr_backup = NULL;
  468. if (rc)
  469. goto err_unregister;
  470. return 0;
  471. err_unregister:
  472. for_each_possible_cpu(i) {
  473. struct acpi_processor_performance *perf;
  474. perf = per_cpu_ptr(acpi_perf_data, i);
  475. acpi_processor_unregister_performance(perf, i);
  476. }
  477. err_out:
  478. /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
  479. free_acpi_perf_data();
  480. kfree(acpi_ids_done);
  481. return rc;
  482. }
  483. static void __exit xen_acpi_processor_exit(void)
  484. {
  485. int i;
  486. kfree(acpi_ids_done);
  487. for_each_possible_cpu(i) {
  488. struct acpi_processor_performance *perf;
  489. perf = per_cpu_ptr(acpi_perf_data, i);
  490. acpi_processor_unregister_performance(perf, i);
  491. }
  492. free_acpi_perf_data();
  493. }
  494. MODULE_AUTHOR("Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>");
  495. MODULE_DESCRIPTION("Xen ACPI Processor P-states (and Cx) driver which uploads PM data to Xen hypervisor");
  496. MODULE_LICENSE("GPL");
  497. /* We want to be loaded before the CPU freq scaling drivers are loaded.
  498. * They are loaded in late_initcall. */
  499. device_initcall(xen_acpi_processor_init);
  500. module_exit(xen_acpi_processor_exit);