powerpc/64s: flush L1D on kernel entry
[linux-2.6-microblaze.git] / arch / powerpc / platforms / powernv / setup.c
index 9acaa0f..d04a085 100644 (file)
@@ -122,12 +122,23 @@ static void pnv_setup_rfi_flush(void)
                        type = L1D_FLUSH_ORI;
        }
 
+       /*
+        * If we are non-Power9 bare metal, we don't need to flush on kernel
+        * entry: it fixes a P9 specific vulnerability.
+        */
+       if (!pvr_version_is(PVR_POWER9))
+               security_ftr_clear(SEC_FTR_L1D_FLUSH_ENTRY);
+
        enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \
                 (security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)   || \
                  security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));
 
        setup_rfi_flush(type, enable);
        setup_count_cache_flush();
+
+       enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
+                security_ftr_enabled(SEC_FTR_L1D_FLUSH_ENTRY);
+       setup_entry_flush(enable);
 }
 
 static void __init pnv_check_guarded_cores(void)