From: Fenghua Yu <fenghua...@intel.com>

Add kernel parameter noxsaves to disable xsaves/xrstors feature.

Add kernel parameter noxsaveopt in doc.

Signed-off-by: Fenghua Yu <fenghua...@intel.com>
---
 Documentation/kernel-parameters.txt | 9 +++++++++
 arch/x86/kernel/cpu/common.c        | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 4384217..8541752 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2124,6 +2124,15 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
                        and restore using xsave. The kernel will fallback to
                        enabling legacy floating-point and sse state.
 
+       noxsaveopt      [X86] Disables x86 extended register state context
+                       switch using xsaveopt. The kernel wil fallback to use
+                       not optimized xsave to do context switch.
+
+       noxsaves        [X86] Disables x86 extended register state context
+                       switch and save/restore compacted formated xsave
+                       area using xsaves. Then the kernel uses standard
+                       xsave area for xstate.
+
        eagerfpu=       [X86]
                        on      enable eager fpu restore
                        off     disable eager fpu restore
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index a135239..409f47c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -146,6 +146,7 @@ static int __init x86_xsave_setup(char *s)
 {
        setup_clear_cpu_cap(X86_FEATURE_XSAVE);
        setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
+       setup_clear_cpu_cap(X86_FEATURE_XSAVES);
        setup_clear_cpu_cap(X86_FEATURE_AVX);
        setup_clear_cpu_cap(X86_FEATURE_AVX2);
        return 1;
@@ -159,6 +160,13 @@ static int __init x86_xsaveopt_setup(char *s)
 }
 __setup("noxsaveopt", x86_xsaveopt_setup);
 
+static int __init x86_xsaves_setup(char *s)
+{
+       setup_clear_cpu_cap(X86_FEATURE_XSAVES);
+       return 1;
+}
+__setup("noxsaves", x86_xsaves_setup);
+
 #ifdef CONFIG_X86_32
 static int cachesize_override = -1;
 static int disable_x86_serial_nr = 1;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to