Messages in this thread | | | Subject | Re: [PATCH v2] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode | From | Xiaoyao Li <> | Date | Wed, 8 Jul 2020 14:58:24 +0800 |
| |
On 7/3/2020 5:38 AM, Abhishek Bhardwaj wrote: > This change adds a new kernel configuration that sets the l1d cache > flush setting at compile time rather than at run time. > > Signed-off-by: Abhishek Bhardwaj <abhishekbh@google.com> > > --- > > Changes in v2: > - Fix typo in the help of the new KConfig. > > arch/x86/kernel/cpu/bugs.c | 8 ++++++++ > arch/x86/kvm/Kconfig | 17 +++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 0b71970d2d3d2..1dcc875cf5547 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -1406,7 +1406,15 @@ enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH; > #if IS_ENABLED(CONFIG_KVM_INTEL) > EXPORT_SYMBOL_GPL(l1tf_mitigation); > #endif > +#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER; > +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND; > +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS; > +#else > enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO; > +#endif
how about
enum vmx_l1d_flush_state l1tf_vmx_mitigation = #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1) VMENTER_L1D_FLUSH_NEVER; #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2) VMENTER_L1D_FLUSH_COND; #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3) VMENTER_L1D_FLUSH_ALWAYS; #else VMENTER_L1D_FLUSH_AUTO; #endif
| |