x86/spec-ctrl: Fix the parsing of xpti= on fixed Intel hardware
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 23 Jul 2018 13:29:27 +0000 (14:29 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 24 Jul 2018 10:25:54 +0000 (11:25 +0100)
commitbe5e2ff6f54e0245331ed360b8786760f82fd673
treee42c5c066ef719a1df98e66d9d6f9d4da40810c4
parent8d13ba787c2963f9e3f100d791c5915389c957ec
x86/spec-ctrl: Fix the parsing of xpti= on fixed Intel hardware

The calls to xpti_init_default() in parse_xpti() are buggy.  The CPUID data
hasn't been fetched that early, and boot_cpu_has(X86_FEATURE_ARCH_CAPS) will
always evaluate false.

As a result, the default case won't disable XPTI on Intel hardware which
advertises ARCH_CAPABILITIES_RDCL_NO.

Simplify parse_xpti() to solely the setting of opt_xpti according to the
passed string, and have init_speculation_mitigations() call
xpti_init_default() if appropiate.  Drop the force parameter, and pass caps
instead, to avoid redundant re-reading of MSR_ARCH_CAPS.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/spec_ctrl.c