diff options
author | Keir Fraser <keir@xen.org> | 2012-03-22 12:20:13 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2012-03-22 12:20:13 +0000 |
commit | 269f543ea750ed567d18f2e819e5d5ce58eda5c5 (patch) | |
tree | f1bfaca66eeec018fa55f65817fa387ca62c082f /xen/arch/x86/acpi | |
parent | 8aed7f047dacebfe8c28109b7adb55784e5bc8ef (diff) | |
download | xen-269f543ea750ed567d18f2e819e5d5ce58eda5c5.tar.gz xen-269f543ea750ed567d18f2e819e5d5ce58eda5c5.tar.bz2 xen-269f543ea750ed567d18f2e819e5d5ce58eda5c5.zip |
Introduce system_state variable.
Use it to replace x86-specific early_boot boolean variable.
Also use it to detect suspend/resume case during cpu offline/online
to avoid unnecessarily breaking vcpu and cpupool affinities.
Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Diffstat (limited to 'xen/arch/x86/acpi')
-rw-r--r-- | xen/arch/x86/acpi/power.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 4b242043c8..9e1f98904f 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -135,6 +135,9 @@ static int enter_state(u32 state) if ( !spin_trylock(&pm_lock) ) return -EBUSY; + BUG_ON(system_state != SYS_STATE_active); + system_state = SYS_STATE_suspend; + printk(XENLOG_INFO "Preparing system for ACPI S%d state.\n", state); freeze_domains(); @@ -142,7 +145,10 @@ static int enter_state(u32 state) acpi_dmar_reinstate(); if ( (error = disable_nonboot_cpus()) ) + { + system_state = SYS_STATE_resume; goto enable_cpu; + } cpufreq_del_cpu(0); @@ -159,6 +165,7 @@ static int enter_state(u32 state) if ( (error = device_power_down()) ) { printk(XENLOG_ERR "Some devices failed to power down."); + system_state = SYS_STATE_resume; goto done; } @@ -179,6 +186,8 @@ static int enter_state(u32 state) break; } + system_state = SYS_STATE_resume; + /* Restore CR4 and EFER from cached values. */ cr4 = read_cr4(); write_cr4(cr4 & ~X86_CR4_MCE); @@ -212,6 +221,7 @@ static int enter_state(u32 state) mtrr_aps_sync_end(); acpi_dmar_zap(); thaw_domains(); + system_state = SYS_STATE_active; spin_unlock(&pm_lock); return error; } |