From: Kanth Ghatraju Date: Tue, 21 May 2019 21:55:18 +0000 (-0400) Subject: x86/speculation/mds: Check for the right microcode before setting mitigation X-Git-Tag: v4.1.12-124.31.3~104 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=95a0087d10d019ca1729ebdcf18a2876cb5bd203;p=users%2Fjedix%2Flinux-maple.git x86/speculation/mds: Check for the right microcode before setting mitigation With the addition of new mitigation for idle, need to check the availability of microcode when mds=idle. The fix is to take the check out of the if statement. Orabug: 29797118 Signed-off-by: Kanth Ghatraju Reviewed-by: Mihai Carabas Signed-off-by: Brian Maly --- diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index d6f796c37540..17ca33fac5dc 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -1391,6 +1391,11 @@ static void mds_select_mitigation(void) return; } + if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) { + mds_mitigation = MDS_MITIGATION_VMWERV; + return; + } + ret = cmdline_find_option(boot_command_line, "mds", arg, sizeof(arg)); if (ret > 0) { @@ -1405,8 +1410,6 @@ static void mds_select_mitigation(void) } if (mds_mitigation == MDS_MITIGATION_FULL) { - if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) - mds_mitigation = MDS_MITIGATION_VMWERV; static_branch_enable(&mds_user_clear);