Merge tag 'vla-leftovers-v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / arch / s390 / kernel / nospec-branch.c
index 18ae7b9..bdddaae 100644 (file)
@@ -35,6 +35,8 @@ early_param("nospec", nospec_setup_early);
 
 static int __init nospec_report(void)
 {
+       if (test_facility(156))
+               pr_info("Spectre V2 mitigation: etokens\n");
        if (IS_ENABLED(CC_USING_EXPOLINE) && !nospec_disable)
                pr_info("Spectre V2 mitigation: execute trampolines\n");
        if (__test_facility(82, S390_lowcore.alt_stfle_fac_list))
@@ -56,7 +58,15 @@ early_param("nospectre_v2", nospectre_v2_setup_early);
 
 void __init nospec_auto_detect(void)
 {
-       if (IS_ENABLED(CC_USING_EXPOLINE)) {
+       if (test_facility(156)) {
+               /*
+                * The machine supports etokens.
+                * Disable expolines and disable nobp.
+                */
+               if (IS_ENABLED(CC_USING_EXPOLINE))
+                       nospec_disable = 1;
+               __clear_facility(82, S390_lowcore.alt_stfle_fac_list);
+       } else if (IS_ENABLED(CC_USING_EXPOLINE)) {
                /*
                 * The kernel has been compiled with expolines.
                 * Keep expolines enabled and disable nobp.