# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222078891 -3600
# Node ID 9cc4cebee50bbf3869b54899919feb899220ad2a
# Parent ad79f7af391619a1fd0746dd31aecea27d811d21
CPUIDLE: Support multiple C3 states
There may be multiple ACPI C3 states reported by BIOS. Those C3 states
may be different on latency & power. So made some modification to
support this case.
Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---
xen/arch/x86/acpi/cpu_idle.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff -r ad79f7af3916 -r 9cc4cebee50b xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c Mon Sep 22 11:16:56 2008 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c Mon Sep 22 11:21:31 2008 +0100
@@ -61,7 +61,7 @@ extern void (*pm_idle) (void);
extern void (*pm_idle) (void);
static void (*pm_idle_save) (void) __read_mostly;
-unsigned int max_cstate __read_mostly = 2;
+unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1;
integer_param("max_cstate", max_cstate);
static struct acpi_processor_power processor_powers[NR_CPUS];
@@ -72,17 +72,13 @@ static void print_acpi_power(uint32_t cp
printk("==cpu%d==\n", cpu);
printk("active state:\t\tC%d\n",
- (power->last_state) ? power->last_state->type : -1);
+ power->last_state ? (int)(power->last_state - power->states) : -1);
printk("max_cstate:\t\tC%d\n", max_cstate);
printk("states:\n");
for ( i = 1; i < power->count; i++ )
{
- if ( power->last_state &&
- power->states[i].type == power->last_state->type )
- printk(" *");
- else
- printk(" ");
+ printk((power->last_state == &power->states[i]) ? " *" : " ");
printk("C%d:\t\t", i);
printk("type[C%d] ", power->states[i].type);
printk("latency[%03d] ", power->states[i].latency);
@@ -222,7 +218,7 @@ static void acpi_processor_idle(void)
if ( power->flags.bm_check && acpi_idle_bm_check()
&& cx->type == ACPI_STATE_C3 )
cx = power->safe_state;
- if ( cx->type > max_cstate )
+ if ( cx - &power->states[0] > max_cstate )
cx = &power->states[max_cstate];
}
if ( !cx )
@@ -565,7 +561,11 @@ static void set_cx(
if ( check_cx(acpi_power, xen_cx) != 0 )
return;
- cx = &acpi_power->states[xen_cx->type];
+ if ( xen_cx->type == ACPI_STATE_C1 )
+ cx = &acpi_power->states[1];
+ else
+ cx = &acpi_power->states[acpi_power->count];
+
if ( !cx->valid )
acpi_power->count++;
@@ -718,7 +718,8 @@ int pmstat_get_cx_stat(uint32_t cpuid, s
uint64_t usage;
int i;
- stat->last = (power->last_state) ? power->last_state->type : 0;
+ stat->last = (power->last_state) ?
+ (int)(power->last_state - &power->states[0]) : 0;
stat->nr = processor_powers[cpuid].count;
stat->idle_time = v->runstate.time[RUNSTATE_running];
if ( v->is_running )
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|