All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3)
@ 2013-10-21  8:11 Jan Beulich
  2013-10-21  9:30 ` Andrew Cooper
  2013-10-21 14:07 ` Keir Fraser
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2013-10-21  8:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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] )




[-- Attachment #2: x86-resume-xcr0.patch --]
[-- Type: text/plain, Size: 1242 bytes --]

x86/xsave: also save/restore XCR0 across suspend (ACPI S3)

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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] )

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3)
  2013-10-21  8:11 [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3) Jan Beulich
@ 2013-10-21  9:30 ` Andrew Cooper
  2013-10-21 14:07 ` Keir Fraser
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2013-10-21  9:30 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser


[-- Attachment #1.1: Type: text/plain, Size: 1457 bytes --]

On 21/10/13 09:11, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- 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] )
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 2353 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3)
  2013-10-21  8:11 [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3) Jan Beulich
  2013-10-21  9:30 ` Andrew Cooper
@ 2013-10-21 14:07 ` Keir Fraser
  1 sibling, 0 replies; 3+ messages in thread
From: Keir Fraser @ 2013-10-21 14:07 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 21/10/2013 09:11, "Jan Beulich" <JBeulich@suse.com> wrote:

> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- 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] )
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-21 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21  8:11 [PATCH] x86/xsave: also save/restore XCR0 across suspend (ACPI S3) Jan Beulich
2013-10-21  9:30 ` Andrew Cooper
2013-10-21 14:07 ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.