Merge branch 'core/speculation' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / security.c
index b33bafb8fcea1f7a964ad99e203ee0a2cf3103cb..70568ccbd9fd5eae17014473aa415d9b472b7d86 100644 (file)
@@ -57,7 +57,7 @@ void setup_barrier_nospec(void)
        enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
                 security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR);
 
-       if (!no_nospec)
+       if (!no_nospec && !cpu_mitigations_off())
                enable_barrier_nospec(enable);
 }
 
@@ -116,7 +116,7 @@ static int __init handle_nospectre_v2(char *p)
 early_param("nospectre_v2", handle_nospectre_v2);
 void setup_spectre_v2(void)
 {
-       if (no_spectrev2)
+       if (no_spectrev2 || cpu_mitigations_off())
                do_btb_flush_fixups();
        else
                btb_flush_enabled = true;
@@ -300,7 +300,7 @@ void setup_stf_barrier(void)
 
        stf_enabled_flush_types = type;
 
-       if (!no_stf_barrier)
+       if (!no_stf_barrier && !cpu_mitigations_off())
                stf_barrier_enable(enable);
 }