aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-02-03 16:03:20 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-03-14 12:35:42 -0400
commit59a56802918100c1e39e68c30a2e5ae9f7d837f0 (patch)
tree18bf73e267ec02e0f8337a039ac12cec83c9e12d /include/xen
parentead1d01425bbd28c4354b539caa4075bde00ed72 (diff)
xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.
This driver solves three problems: 1). Parse and upload ACPI0007 (or PROCESSOR_TYPE) information to the hypervisor - aka P-states (cpufreq data). 2). Upload the the Cx state information (cpuidle data). 3). Inhibit CPU frequency scaling drivers from loading. The reason for wanting to solve 1) and 2) is such that the Xen hypervisor is the only one that knows the CPU usage of different guests and can make the proper decision of when to put CPUs and packages in proper states. Unfortunately the hypervisor has no support to parse ACPI DSDT tables, hence it needs help from the initial domain to provide this information. The reason for 3) is that we do not want the initial domain to change P-states while the hypervisor is doing it as well - it causes rather some funny cases of P-states transitions. For this to work, the driver parses the Power Management data and uploads said information to the Xen hypervisor. It also calls acpi_processor_notify_smm() to inhibit the other CPU frequency scaling drivers from being loaded. Everything revolves around the 'struct acpi_processor' structure which gets updated during the bootup cycle in different stages. At the startup, when the ACPI parser starts, the C-state information is processed (processor_idle) and saved in said structure as 'power' element. Later on, the CPU frequency scaling driver (powernow-k8 or acpi_cpufreq), would call the the acpi_processor_* (processor_perflib functions) to parse P-states information and populate in the said structure the 'performance' element. Since we do not want the CPU frequency scaling drivers from loading we have to call the acpi_processor_* functions to parse the P-states and call "acpi_processor_notify_smm" to stop them from loading. There is also one oddity in this driver which is that under Xen, the physical online CPU count can be different from the virtual online CPU count. Meaning that the macros 'for_[online|possible]_cpu' would process only up to virtual online CPU count. We on the other hand want to process the full amount of physical CPUs. For that, the driver checks if the ACPI IDs count is different from the APIC ID count - which can happen if the user choose to use dom0_max_vcpu argument. In such a case a backup of the PM structure is used and uploaded to the hypervisor. [v1-v2: Initial RFC implementations that were posted] [v3: Changed the name to passthru suggested by Pasi Kärkkäinen <pasik@iki.fi>] [v4: Added vCPU != pCPU support - aka dom0_max_vcpus support] [v5: Cleaned up the driver, fix bug under Athlon XP] [v6: Changed the driver to a CPU frequency governor] [v7: Jan Beulich <jbeulich@suse.com> suggestion to make it a cpufreq scaling driver made me rework it as driver that inhibits cpufreq scaling driver] [v8: Per Jan's review comments, fixed up the driver] [v9: Allow to continue even if acpi_processor_preregister_perf.. fails] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/xen')
-rw-r--r--include/xen/interface/platform.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index 861b359b44aa..486653f0dd8f 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -298,6 +298,22 @@ struct xenpf_set_processor_pminfo {
298}; 298};
299DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); 299DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
300 300
301#define XENPF_get_cpuinfo 55
302struct xenpf_pcpuinfo {
303 /* IN */
304 uint32_t xen_cpuid;
305 /* OUT */
306 /* The maxium cpu_id that is present */
307 uint32_t max_present;
308#define XEN_PCPU_FLAGS_ONLINE 1
309 /* Correponding xen_cpuid is not present*/
310#define XEN_PCPU_FLAGS_INVALID 2
311 uint32_t flags;
312 uint32_t apic_id;
313 uint32_t acpi_id;
314};
315DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
316
301struct xen_platform_op { 317struct xen_platform_op {
302 uint32_t cmd; 318 uint32_t cmd;
303 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ 319 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -313,6 +329,7 @@ struct xen_platform_op {
313 struct xenpf_change_freq change_freq; 329 struct xenpf_change_freq change_freq;
314 struct xenpf_getidletime getidletime; 330 struct xenpf_getidletime getidletime;
315 struct xenpf_set_processor_pminfo set_pminfo; 331 struct xenpf_set_processor_pminfo set_pminfo;
332 struct xenpf_pcpuinfo pcpu_info;
316 uint8_t pad[128]; 333 uint8_t pad[128];
317 } u; 334 } u;
318}; 335};