@@ -238,7 +238,7 @@ static void x86_amd_ssb_disable(void)
238238
239239/* Default mitigation for MDS-affected CPUs */
240240static enum mds_mitigations mds_mitigation __ro_after_init =
241- IS_ENABLED (CONFIG_MITIGATION_MDS ) ? MDS_MITIGATION_FULL : MDS_MITIGATION_OFF ;
241+ IS_ENABLED (CONFIG_MITIGATION_MDS ) ? MDS_MITIGATION_AUTO : MDS_MITIGATION_OFF ;
242242static bool mds_nosmt __ro_after_init = false;
243243
244244static const char * const mds_strings [] = {
@@ -249,34 +249,37 @@ static const char * const mds_strings[] = {
249249
250250enum taa_mitigations {
251251 TAA_MITIGATION_OFF ,
252+ TAA_MITIGATION_AUTO ,
252253 TAA_MITIGATION_UCODE_NEEDED ,
253254 TAA_MITIGATION_VERW ,
254255 TAA_MITIGATION_TSX_DISABLED ,
255256};
256257
257258/* Default mitigation for TAA-affected CPUs */
258259static enum taa_mitigations taa_mitigation __ro_after_init =
259- IS_ENABLED (CONFIG_MITIGATION_TAA ) ? TAA_MITIGATION_VERW : TAA_MITIGATION_OFF ;
260+ IS_ENABLED (CONFIG_MITIGATION_TAA ) ? TAA_MITIGATION_AUTO : TAA_MITIGATION_OFF ;
260261
261262enum mmio_mitigations {
262263 MMIO_MITIGATION_OFF ,
264+ MMIO_MITIGATION_AUTO ,
263265 MMIO_MITIGATION_UCODE_NEEDED ,
264266 MMIO_MITIGATION_VERW ,
265267};
266268
267269/* Default mitigation for Processor MMIO Stale Data vulnerabilities */
268270static enum mmio_mitigations mmio_mitigation __ro_after_init =
269- IS_ENABLED (CONFIG_MITIGATION_MMIO_STALE_DATA ) ? MMIO_MITIGATION_VERW : MMIO_MITIGATION_OFF ;
271+ IS_ENABLED (CONFIG_MITIGATION_MMIO_STALE_DATA ) ? MMIO_MITIGATION_AUTO : MMIO_MITIGATION_OFF ;
270272
271273enum rfds_mitigations {
272274 RFDS_MITIGATION_OFF ,
275+ RFDS_MITIGATION_AUTO ,
273276 RFDS_MITIGATION_VERW ,
274277 RFDS_MITIGATION_UCODE_NEEDED ,
275278};
276279
277280/* Default mitigation for Register File Data Sampling */
278281static enum rfds_mitigations rfds_mitigation __ro_after_init =
279- IS_ENABLED (CONFIG_MITIGATION_RFDS ) ? RFDS_MITIGATION_VERW : RFDS_MITIGATION_OFF ;
282+ IS_ENABLED (CONFIG_MITIGATION_RFDS ) ? RFDS_MITIGATION_AUTO : RFDS_MITIGATION_OFF ;
280283
281284static void __init mds_select_mitigation (void )
282285{
@@ -285,6 +288,9 @@ static void __init mds_select_mitigation(void)
285288 return ;
286289 }
287290
291+ if (mds_mitigation == MDS_MITIGATION_AUTO )
292+ mds_mitigation = MDS_MITIGATION_FULL ;
293+
288294 if (mds_mitigation == MDS_MITIGATION_FULL ) {
289295 if (!boot_cpu_has (X86_FEATURE_MD_CLEAR ))
290296 mds_mitigation = MDS_MITIGATION_VMWERV ;
@@ -514,6 +520,9 @@ static void __init rfds_select_mitigation(void)
514520 if (rfds_mitigation == RFDS_MITIGATION_OFF )
515521 return ;
516522
523+ if (rfds_mitigation == RFDS_MITIGATION_AUTO )
524+ rfds_mitigation = RFDS_MITIGATION_VERW ;
525+
517526 if (x86_arch_cap_msr & ARCH_CAP_RFDS_CLEAR )
518527 setup_force_cpu_cap (X86_FEATURE_CLEAR_CPU_BUF );
519528 else
@@ -1979,6 +1988,7 @@ void cpu_bugs_smt_update(void)
19791988
19801989 switch (mds_mitigation ) {
19811990 case MDS_MITIGATION_FULL :
1991+ case MDS_MITIGATION_AUTO :
19821992 case MDS_MITIGATION_VMWERV :
19831993 if (sched_smt_active () && !boot_cpu_has (X86_BUG_MSBDS_ONLY ))
19841994 pr_warn_once (MDS_MSG_SMT );
@@ -1990,6 +2000,7 @@ void cpu_bugs_smt_update(void)
19902000
19912001 switch (taa_mitigation ) {
19922002 case TAA_MITIGATION_VERW :
2003+ case TAA_MITIGATION_AUTO :
19932004 case TAA_MITIGATION_UCODE_NEEDED :
19942005 if (sched_smt_active ())
19952006 pr_warn_once (TAA_MSG_SMT );
@@ -2001,6 +2012,7 @@ void cpu_bugs_smt_update(void)
20012012
20022013 switch (mmio_mitigation ) {
20032014 case MMIO_MITIGATION_VERW :
2015+ case MMIO_MITIGATION_AUTO :
20042016 case MMIO_MITIGATION_UCODE_NEEDED :
20052017 if (sched_smt_active ())
20062018 pr_warn_once (MMIO_MSG_SMT );
0 commit comments