s390/speculation: Support 'mitigations=' cmdline option
[sfrench/cifs-2.6.git] / arch / s390 / kernel / nospec-branch.c
index bdddaae9655984dfbf59ccee386c7bb3608cb183..649135cbedd5c4407f16d89f4020d5022f40395e 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/module.h>
 #include <linux/device.h>
+#include <linux/cpu.h>
 #include <asm/nospec-branch.h>
 
 static int __init nobp_setup_early(char *str)
@@ -58,7 +59,7 @@ early_param("nospectre_v2", nospectre_v2_setup_early);
 
 void __init nospec_auto_detect(void)
 {
-       if (test_facility(156)) {
+       if (test_facility(156) || cpu_mitigations_off()) {
                /*
                 * The machine supports etokens.
                 * Disable expolines and disable nobp.