aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-10-21 17:26:16 +0200
committerJan Beulich <jbeulich@suse.com>2013-10-21 17:26:16 +0200
commite47a90e6dca491c0ceea6ffa18055e7e32565e8e (patch)
treea91fab10b939032820f44cb45f39bdebd590c738
parent06afffeffd7a7da83b17ff7f49979d56bbdf6710 (diff)
downloadxen-e47a90e6dca491c0ceea6ffa18055e7e32565e8e.tar.gz
xen-e47a90e6dca491c0ceea6ffa18055e7e32565e8e.tar.bz2
xen-e47a90e6dca491c0ceea6ffa18055e7e32565e8e.zip
x86/xsave: also save/restore XCR0 across suspend (ACPI S3)
Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
-rw-r--r--xen/arch/x86/acpi/suspend.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c
index 9c3cf38fe5..6fdd876e6b 100644
--- a/xen/arch/x86/acpi/suspend.c
+++ b/xen/arch/x86/acpi/suspend.c
@@ -13,12 +13,14 @@
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
#include <asm/i387.h>
+#include <asm/xstate.h>
#include <xen/hypercall.h>
static unsigned long saved_lstar, saved_cstar;
static unsigned long saved_sysenter_esp, saved_sysenter_eip;
static unsigned long saved_fs_base, saved_gs_base, saved_kernel_gs_base;
static uint16_t saved_segs[4];
+static uint64_t saved_xcr0;
void save_rest_processor_state(void)
{
@@ -38,6 +40,8 @@ void save_rest_processor_state(void)
rdmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp);
rdmsrl(MSR_IA32_SYSENTER_EIP, saved_sysenter_eip);
}
+ if ( cpu_has_xsave )
+ saved_xcr0 = get_xcr0();
}
@@ -77,6 +81,9 @@ void restore_rest_processor_state(void)
do_set_segment_base(SEGBASE_GS_USER_SEL, saved_segs[3]);
}
+ if ( cpu_has_xsave && !set_xcr0(saved_xcr0) )
+ BUG();
+
/* Maybe load the debug registers. */
BUG_ON(is_hvm_vcpu(curr));
if ( !is_idle_vcpu(curr) && curr->arch.debugreg[7] )