aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/feat_ctl.c
diff options
context:
space:
mode:
authorGravatar Kai Huang <kai.huang@intel.com> 2021-03-19 20:22:17 +1300
committerGravatar Borislav Petkov <bp@suse.de> 2021-03-25 17:33:11 +0100
commite9a15a40e857fc6ccfbb05fec7b184e9003057df (patch)
treeecbd1593e483739054736e0f3f80e37f70a3bb22 /arch/x86/kernel/cpu/feat_ctl.c
parentx86/sgx: Remove unnecessary kmap() from sgx_ioc_enclave_init() (diff)
downloadlinux-e9a15a40e857fc6ccfbb05fec7b184e9003057df.tar.gz
linux-e9a15a40e857fc6ccfbb05fec7b184e9003057df.tar.bz2
linux-e9a15a40e857fc6ccfbb05fec7b184e9003057df.zip
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@google.com> Signed-off-by: Kai Huang <kai.huang@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Sean Christopherson <seanjc@google.com> Acked-by: Dave Hansen <dave.hansen@intel.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lkml.kernel.org/r/5d4220fd0a39f52af024d3fa166231c1d498dd10.1616136308.git.kai.huang@intel.com
Diffstat (limited to 'arch/x86/kernel/cpu/feat_ctl.c')
-rw-r--r--arch/x86/kernel/cpu/feat_ctl.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c
index 3b1b01f2b248..27533a6e04fa 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);
}
}