]> xenbits.xensource.com Git - xen.git/commitdiff
x86/spec-ctrl: Fix default calculation of opt_srb_lock
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 7 Jan 2022 07:54:38 +0000 (08:54 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 Jan 2022 07:54:38 +0000 (08:54 +0100)
Since this logic was introduced, opt_tsx has become more complicated and
shouldn't be compared to 0 directly.  While there are no buggy logic paths,
the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
easier and clearer to use.

Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
master date: 2022-01-05 09:44:26 +0000

xen/arch/x86/spec_ctrl.c

index 7e0c171dc835460918caf3e28676413408f30369..f70535b6e7bfee21963b1a575440749d116846d4 100644 (file)
@@ -1197,7 +1197,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;