From: "Jan Beulich" Subject: [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3) Date: Mon, 21 Oct 2013 09:11:40 +0100 Message-ID: <5264FDDC02000078000FC4BD@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part132028AC.0__=" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VYAaY-0007GZ-KE for xen-devel@lists.xenproject.org; Mon, 21 Oct 2013 08:11:46 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part132028AC.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -13,12 +13,14 @@ #include #include #include +#include #include =20 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; =20 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 =3D get_xcr0(); } =20 =20 @@ -77,6 +81,9 @@ void restore_rest_processor_state(void) do_set_segment_base(SEGBASE_GS_USER_SEL, saved_segs[3]); } =20 + 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] ) --=__Part132028AC.0__= Content-Type: text/plain; name="x86-resume-xcr0.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-resume-xcr0.patch" x86/xsave: also save/restore XCR0 across suspend (ACPI S3)=0A=0ASigned-off-= by: Jan Beulich =0A=0A--- a/xen/arch/x86/acpi/suspend.c= =0A+++ b/xen/arch/x86/acpi/suspend.c=0A@@ -13,12 +13,14 @@=0A #include = =0A #include =0A #include =0A= +#include =0A #include =0A =0A static = unsigned long saved_lstar, saved_cstar;=0A static unsigned long saved_sysen= ter_esp, saved_sysenter_eip;=0A static unsigned long saved_fs_base, = saved_gs_base, saved_kernel_gs_base;=0A static uint16_t saved_segs[4];=0A+s= tatic uint64_t saved_xcr0;=0A =0A void save_rest_processor_state(void)=0A = {=0A@@ -38,6 +40,8 @@ void save_rest_processor_state(void)=0A = rdmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp);=0A rdmsrl(MSR_IA= 32_SYSENTER_EIP, saved_sysenter_eip);=0A }=0A+ if ( cpu_has_xsave = )=0A+ saved_xcr0 =3D get_xcr0();=0A }=0A =0A =0A@@ -77,6 +81,9 @@ = void restore_rest_processor_state(void)=0A do_set_segment_base(SEGB= ASE_GS_USER_SEL, saved_segs[3]);=0A }=0A =0A+ if ( cpu_has_xsave && = !set_xcr0(saved_xcr0) )=0A+ BUG();=0A+=0A /* Maybe load the = debug registers. */=0A BUG_ON(is_hvm_vcpu(curr));=0A if ( = !is_idle_vcpu(curr) && curr->arch.debugreg[7] )=0A --=__Part132028AC.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part132028AC.0__=--