Add a flag indicating whenever ENCLS[EUPDATESVN] SGX instruction is
supported. This will be used by SGX driver to perform CPU SVN updates.

Reviewed-by: Jarkko Sakkinen <[email protected]>
Reviewed-by: Kai Huang <[email protected]>
Reviewed-by: Dave Hansen <[email protected]>
Signed-off-by: Elena Reshetova <[email protected]>
Tested-by: Nataliia Bondarevska <[email protected]>
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kernel/cpu/cpuid-deps.c   | 1 +
 arch/x86/kernel/cpu/scattered.c    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/cpufeatures.h 
b/arch/x86/include/asm/cpufeatures.h
index 4091a776e37a..76364b6dd93b 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -499,6 +499,7 @@
 #define X86_FEATURE_IBPB_EXIT_TO_USER  (21*32+14) /* Use IBPB on 
exit-to-userspace, see VMSCAPE bug */
 #define X86_FEATURE_ABMC               (21*32+15) /* Assignable Bandwidth 
Monitoring Counters */
 #define X86_FEATURE_MSR_IMM            (21*32+16) /* MSR immediate form 
instructions */
+#define X86_FEATURE_SGX_EUPDATESVN     (21*32+17) /* Support for 
ENCLS[EUPDATESVN] instruction */
 
 /*
  * BUG word(s)
diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
index 46efcbd6afa4..3d9f49ad0efd 100644
--- a/arch/x86/kernel/cpu/cpuid-deps.c
+++ b/arch/x86/kernel/cpu/cpuid-deps.c
@@ -79,6 +79,7 @@ static const struct cpuid_dep cpuid_deps[] = {
        { X86_FEATURE_SGX_LC,                   X86_FEATURE_SGX       },
        { X86_FEATURE_SGX1,                     X86_FEATURE_SGX       },
        { X86_FEATURE_SGX2,                     X86_FEATURE_SGX1      },
+       { X86_FEATURE_SGX_EUPDATESVN,           X86_FEATURE_SGX1      },
        { X86_FEATURE_SGX_EDECCSSA,             X86_FEATURE_SGX1      },
        { X86_FEATURE_XFD,                      X86_FEATURE_XSAVES    },
        { X86_FEATURE_XFD,                      X86_FEATURE_XGETBV1   },
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index caa4dc885c21..37850356a9b5 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -43,6 +43,7 @@ static const struct cpuid_bit cpuid_bits[] = {
        { X86_FEATURE_PER_THREAD_MBA,           CPUID_ECX,  0, 0x00000010, 3 },
        { X86_FEATURE_SGX1,                     CPUID_EAX,  0, 0x00000012, 0 },
        { X86_FEATURE_SGX2,                     CPUID_EAX,  1, 0x00000012, 0 },
+       { X86_FEATURE_SGX_EUPDATESVN,           CPUID_EAX, 10, 0x00000012, 0 },
        { X86_FEATURE_SGX_EDECCSSA,             CPUID_EAX, 11, 0x00000012, 0 },
        { X86_FEATURE_HW_PSTATE,                CPUID_EDX,  7, 0x80000007, 0 },
        { X86_FEATURE_CPB,                      CPUID_EDX,  9, 0x80000007, 0 },
-- 
2.45.2


Reply via email to