x86/amd: Enumeration for speculative features/hints
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Jul 2021 14:13:32 +0000 (15:13 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 8 Sep 2021 13:16:19 +0000 (14:16 +0100)
commit747424c664bb164a04e7a9f2ffbf02d4a1630d7d
tree86e87d3a4d2a22e4f188e297e0f0d1fc6929b7d1
parent565ebcda976c05b0c6191510d5e32b621a2b1867
x86/amd: Enumeration for speculative features/hints

There is a step change in speculation protections between the Zen1 and Zen2
microarchitectures.

Zen1 and older have no special support.  Control bits in non-architectural
MSRs are used to make lfence be dispatch-serialising (Spectre v1), and to
disable Memory Disambiguation (Speculative Store Bypass).  IBPB was
retrofitted in a microcode update, and software methods are required for
Spectre v2 protections.

Because the bit controlling Memory Disambiguation is model specific,
hypervisors are expected to expose a MSR_VIRT_SPEC_CTRL interface which
abstracts the model specific details.

Zen2 and later implement the MSR_SPEC_CTRL interface in hardware, and
virtualise the interface for HVM guests to use.  A number of hint bits are
specified too to help guide OS software to the most efficient mitigation
strategy.

Zen3 introduced a new feature, Predictive Store Forwarding, along with a
control to disable it in sensitive code.

Add CPUID and VMCB details for all the new functionality.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/libs/light/libxl_cpuid.c
tools/misc/xen-cpuid.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c
xen/include/asm-x86/cpufeature.h
xen/include/asm-x86/hvm/svm/svm.h
xen/include/asm-x86/hvm/svm/vmcb.h
xen/include/asm-x86/msr-index.h
xen/include/public/arch-x86/cpufeatureset.h