bool cpu_has_ibpb_brtype_microcode(void)
 {
-       u8 fam = boot_cpu_data.x86;
-
+       switch (boot_cpu_data.x86) {
        /* Zen1/2 IBPB flushes branch type predictions too. */
-       if (fam == 0x17)
+       case 0x17:
                return boot_cpu_has(X86_FEATURE_AMD_IBPB);
-       /* Poke the MSR bit on Zen3/4 to check its presence. */
-       else if (fam == 0x19)
-               return !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB);
-       else
+       case 0x19:
+               /* Poke the MSR bit on Zen3/4 to check its presence. */
+               if (!wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {
+                       setup_force_cpu_cap(X86_FEATURE_SBPB);
+                       return true;
+               } else {
+                       return false;
+               }
+       default:
                return false;
+       }
 }
 
                 * flags for guests.
                 */
                setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
-               setup_force_cpu_cap(X86_FEATURE_SBPB);
 
                /*
                 * Zen1/2 with SMT off aren't vulnerable after the right
                 * IBPB microcode has been applied.
                 */
                if ((boot_cpu_data.x86 < 0x19) &&
-                   (cpu_smt_control == CPU_SMT_DISABLED))
+                   (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED)))
                        setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
        }
 
        pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode"));
 
 pred_cmd:
-       if (boot_cpu_has(X86_FEATURE_SRSO_NO) ||
-           srso_cmd == SRSO_CMD_OFF)
+       if ((boot_cpu_has(X86_FEATURE_SRSO_NO) || srso_cmd == SRSO_CMD_OFF) &&
+            boot_cpu_has(X86_FEATURE_SBPB))
                x86_pred_cmd = PRED_CMD_SBPB;
 }