x86: xsave: restore xcr0 during resume
authorSuresh Siddha <suresh.b.siddha@intel.com>
Wed, 27 Aug 2008 21:57:36 +0000 (14:57 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 27 Aug 2008 22:23:23 +0000 (15:23 -0700)
Add the missing XCR0(XFEATURE_ENABLED_MASK) restore during resume.

Reported-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/power/cpu_32.c
arch/x86/power/cpu_64.c

index 7dc5d5cf50a2c85c2cad15c84f5e455abd42a34e..02f36f53558c9318393007b2b652316ddf3f47a3 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/suspend.h>
 #include <asm/mtrr.h>
 #include <asm/mce.h>
+#include <asm/xcr.h>
 
 static struct saved_context saved_context;
 
@@ -124,6 +125,12 @@ static void __restore_processor_state(struct saved_context *ctxt)
        if (boot_cpu_has(X86_FEATURE_SEP))
                enable_sep_cpu();
 
+       /*
+        * restore XCR0 for xsave capable cpu's.
+        */
+       if (cpu_has_xsave)
+               xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask);
+
        fix_processor_context();
        do_fpu_end();
        mtrr_ap_init();
index 66bdfb591fd8b0adcc1d8181d3d1fcfb14f71808..e3b6cf70d62c504d42f757980ddf562a5cc1ac30 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mtrr.h>
+#include <asm/xcr.h>
 
 static void fix_processor_context(void);
 
@@ -122,6 +123,12 @@ static void __restore_processor_state(struct saved_context *ctxt)
        wrmsrl(MSR_GS_BASE, ctxt->gs_base);
        wrmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base);
 
+       /*
+        * restore XCR0 for xsave capable cpu's.
+        */
+       if (cpu_has_xsave)
+               xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask);
+
        fix_processor_context();
 
        do_fpu_end();