Skip to content

Commit c351101

Browse files
ChangSeokBaesuryasaimadhu
authored andcommitted
x86/cpufeatures: Add eXtended Feature Disabling (XFD) feature bit
Intel's eXtended Feature Disable (XFD) feature is an extension of the XSAVE architecture. XFD allows the kernel to enable a feature state in XCR0 and to receive a #NM trap when a task uses instructions accessing that state. This is going to be used to postpone the allocation of a larger XSTATE buffer for a task to the point where it is actually using a related instruction after the permission to use that facility has been granted. XFD is not used by the kernel, but only applied to userspace. This is a matter of policy as the kernel knows how a fpstate is reallocated and the XFD state. The compacted XSAVE format is adjustable for dynamic features. Make XFD depend on XSAVES. Signed-off-by: Chang S. Bae <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Chang S. Bae <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e61d631 commit c351101

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277
#define X86_FEATURE_XSAVEC (10*32+ 1) /* XSAVEC instruction */
278278
#define X86_FEATURE_XGETBV1 (10*32+ 2) /* XGETBV with ECX = 1 instruction */
279279
#define X86_FEATURE_XSAVES (10*32+ 3) /* XSAVES/XRSTORS instructions */
280+
#define X86_FEATURE_XFD (10*32+ 4) /* "" eXtended Feature Disabling */
280281

281282
/*
282283
* Extended auxiliary flags: Linux defined - for features scattered in various

arch/x86/kernel/cpu/cpuid-deps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static const struct cpuid_dep cpuid_deps[] = {
7575
{ X86_FEATURE_SGX_LC, X86_FEATURE_SGX },
7676
{ X86_FEATURE_SGX1, X86_FEATURE_SGX },
7777
{ X86_FEATURE_SGX2, X86_FEATURE_SGX1 },
78+
{ X86_FEATURE_XFD, X86_FEATURE_XSAVES },
7879
{}
7980
};
8081

0 commit comments

Comments
 (0)