# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1221212222 -3600
# Node ID 92a5f89175145e78fd2de6cfae863b8bb286b942
# Parent e1e8cc97331de14d03e76b5fb592713e407285e0
x86, xen, pm: Add ppc dynamic change handle
When ppc dynamic change event happened, get new ppc value
and then notify power management logic of Xen hypervisor
through hypercall.
Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
arch/i386/kernel/acpi/processor_extcntl_xen.c | 94 +++++++++++++++-----------
include/xen/interface/platform.h | 2
2 files changed, 56 insertions(+), 40 deletions(-)
diff -r e1e8cc97331d -r 92a5f8917514
arch/i386/kernel/acpi/processor_extcntl_xen.c
--- a/arch/i386/kernel/acpi/processor_extcntl_xen.c Fri Sep 12 07:24:53
2008 +0100
+++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c Fri Sep 12 10:37:02
2008 +0100
@@ -141,7 +141,7 @@ static void convert_psd_pack(struct xen_
static int xen_px_notifier(struct acpi_processor *pr, int action)
{
- int ret;
+ int ret = -EINVAL;
xen_platform_op_t op = {
.cmd = XENPF_set_processor_pminfo,
.interface_version = XENPF_INTERFACE_VERSION,
@@ -153,48 +153,64 @@ static int xen_px_notifier(struct acpi_p
struct acpi_processor_performance *px;
struct acpi_psd_package *pdomain;
- /* leave dynamic ppc handle in the future */
- if (action == PROCESSOR_PM_CHANGE)
- return 0;
+ if (!pr)
+ return -EINVAL;
perf = &op.u.set_pminfo.perf;
px = pr->performance;
- perf->flags = XEN_PX_PPC |
- XEN_PX_PCT |
- XEN_PX_PSS |
- XEN_PX_PSD;
-
- /* ppc */
- perf->ppc = pr->performance_platform_limit;
-
- /* pct */
- convert_pct_reg(&perf->control_register, &px->control_register);
- convert_pct_reg(&perf->status_register, &px->status_register);
-
- /* pss */
- perf->state_count = px->state_count;
- states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
- if (!states)
- return -ENOMEM;
- convert_pss_states(states, px->states, px->state_count);
- set_xen_guest_handle(perf->states, states);
-
- /* psd */
- pdomain = &px->domain_info;
- convert_psd_pack(&perf->domain_info, pdomain);
- if (perf->domain_info.num_processors) {
- if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
- perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
- else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
- perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
- else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
- perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
- } else
- perf->shared_type = CPUFREQ_SHARED_TYPE_NONE;
-
- ret = HYPERVISOR_platform_op(&op);
- kfree(states);
+ switch(action) {
+ case PROCESSOR_PM_CHANGE:
+ /* ppc dynamic handle */
+ perf->flags = XEN_PX_PPC;
+ perf->platform_limit = pr->performance_platform_limit;
+
+ ret = HYPERVISOR_platform_op(&op);
+ break;
+
+ case PROCESSOR_PM_INIT:
+ /* px normal init */
+ perf->flags = XEN_PX_PPC |
+ XEN_PX_PCT |
+ XEN_PX_PSS |
+ XEN_PX_PSD;
+
+ /* ppc */
+ perf->platform_limit = pr->performance_platform_limit;
+
+ /* pct */
+ convert_pct_reg(&perf->control_register, &px->control_register);
+ convert_pct_reg(&perf->status_register, &px->status_register);
+
+ /* pss */
+ perf->state_count = px->state_count;
+ states =
kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
+ if (!states)
+ return -ENOMEM;
+ convert_pss_states(states, px->states, px->state_count);
+ set_xen_guest_handle(perf->states, states);
+
+ /* psd */
+ pdomain = &px->domain_info;
+ convert_psd_pack(&perf->domain_info, pdomain);
+ if (perf->domain_info.num_processors) {
+ if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
+ perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
+ else if (pdomain->coord_type ==
DOMAIN_COORD_TYPE_SW_ANY)
+ perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
+ else if (pdomain->coord_type ==
DOMAIN_COORD_TYPE_HW_ALL)
+ perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
+ } else
+ perf->shared_type = CPUFREQ_SHARED_TYPE_NONE;
+
+ ret = HYPERVISOR_platform_op(&op);
+ kfree(states);
+ break;
+
+ default:
+ break;
+ }
+
return ret;
}
diff -r e1e8cc97331d -r 92a5f8917514 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h Fri Sep 12 07:24:53 2008 +0100
+++ b/include/xen/interface/platform.h Fri Sep 12 10:37:02 2008 +0100
@@ -289,7 +289,7 @@ struct xen_psd_package {
struct xen_processor_performance {
uint32_t flags; /* flag for Px sub info type */
- uint32_t ppc; /* Platform limitation on freq usage */
+ uint32_t platform_limit; /* Platform limitation on freq usage */
struct xen_pct_register control_register;
struct xen_pct_register status_register;
uint32_t state_count; /* total available performance states */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|