On Tue, Jan 19, 2021, Borislav Petkov wrote: > On Mon, Jan 18, 2021 at 04:26:49PM +1300, Kai Huang wrote: > > diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c > > index 3b1b01f2b248..7937a315f8cf 100644 > > --- a/arch/x86/kernel/cpu/feat_ctl.c > > +++ b/arch/x86/kernel/cpu/feat_ctl.c > > @@ -96,7 +96,6 @@ static void init_vmx_capabilities(struct cpuinfo_x86 *c) > > static void clear_sgx_caps(void) > > { > > setup_clear_cpu_cap(X86_FEATURE_SGX); > > - setup_clear_cpu_cap(X86_FEATURE_SGX_LC); > > Why is that line being removed here? > > Shouldn't this add SGX1 and SGX2 here instead as this function is > supposed to, well, *clear* sgx caps on feat_ctl setup failures or > "nosgx" cmdline? Doesn't adding making the SGX sub-features depend on X86_FEATURE_SGX have the same net effect? Or am I misreading do_clear_cpu_cap()? Though if we use the cpuid_deps table, I'd vote to get rid of clear_sgx_caps() and call setup_clear_cpu_cap(X86_FEATURE_SGX) directly. And probably change the existing SGX_LC behavior and drop clear_sgx_caps() in a separate patch instead of squeezing it into this one.