[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <161778981468.29796.2007667039534925425.tip-bot2@tip-bot2>
Date: Wed, 07 Apr 2021 10:03:34 -0000
From: "tip-bot2 for Kai Huang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Kai Huang <kai.huang@...el.com>, Borislav Petkov <bp@...e.de>,
Dave Hansen <dave.hansen@...el.com>,
Jarkko Sakkinen <jarkko@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/sgx] x86/cpufeatures: Make SGX_LC feature bit depend on SGX bit
The following commit has been merged into the x86/sgx branch of tip:
Commit-ID: e9a15a40e857fc6ccfbb05fec7b184e9003057df
Gitweb: https://git.kernel.org/tip/e9a15a40e857fc6ccfbb05fec7b184e9003057df
Author: Kai Huang <kai.huang@...el.com>
AuthorDate: Fri, 19 Mar 2021 20:22:17 +13:00
Committer: Borislav Petkov <bp@...e.de>
CommitterDate: Thu, 25 Mar 2021 17:33:11 +01:00
x86/cpufeatures: Make SGX_LC feature bit depend on SGX bit
Move SGX_LC feature bit to CPUID dependency table to make clearing all
SGX feature bits easier. Also remove clear_sgx_caps() since it is just
a wrapper of setup_clear_cpu_cap(X86_FEATURE_SGX) now.
Suggested-by: Sean Christopherson <seanjc@...gle.com>
Signed-off-by: Kai Huang <kai.huang@...el.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Reviewed-by: Sean Christopherson <seanjc@...gle.com>
Acked-by: Dave Hansen <dave.hansen@...el.com>
Acked-by: Jarkko Sakkinen <jarkko@...nel.org>
Link: https://lkml.kernel.org/r/5d4220fd0a39f52af024d3fa166231c1d498dd10.1616136308.git.kai.huang@intel.com
---
arch/x86/kernel/cpu/cpuid-deps.c | 1 +
arch/x86/kernel/cpu/feat_ctl.c | 12 +++---------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
index 42af31b..d40f8e0 100644
--- a/arch/x86/kernel/cpu/cpuid-deps.c
+++ b/arch/x86/kernel/cpu/cpuid-deps.c
@@ -72,6 +72,7 @@ static const struct cpuid_dep cpuid_deps[] = {
{ X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW },
{ X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES },
{ X86_FEATURE_PER_THREAD_MBA, X86_FEATURE_MBA },
+ { X86_FEATURE_SGX_LC, X86_FEATURE_SGX },
{}
};
diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c
index 3b1b01f..27533a6 100644
--- a/arch/x86/kernel/cpu/feat_ctl.c
+++ b/arch/x86/kernel/cpu/feat_ctl.c
@@ -93,15 +93,9 @@ static void init_vmx_capabilities(struct cpuinfo_x86 *c)
}
#endif /* CONFIG_X86_VMX_FEATURE_NAMES */
-static void clear_sgx_caps(void)
-{
- setup_clear_cpu_cap(X86_FEATURE_SGX);
- setup_clear_cpu_cap(X86_FEATURE_SGX_LC);
-}
-
static int __init nosgx(char *str)
{
- clear_sgx_caps();
+ setup_clear_cpu_cap(X86_FEATURE_SGX);
return 0;
}
@@ -116,7 +110,7 @@ void init_ia32_feat_ctl(struct cpuinfo_x86 *c)
if (rdmsrl_safe(MSR_IA32_FEAT_CTL, &msr)) {
clear_cpu_cap(c, X86_FEATURE_VMX);
- clear_sgx_caps();
+ clear_cpu_cap(c, X86_FEATURE_SGX);
return;
}
@@ -177,6 +171,6 @@ update_sgx:
!(msr & FEAT_CTL_SGX_LC_ENABLED) || !enable_sgx) {
if (enable_sgx)
pr_err_once("SGX disabled by BIOS\n");
- clear_sgx_caps();
+ clear_cpu_cap(c, X86_FEATURE_SGX);
}
}
Powered by blists - more mailing lists