x86/amd: Enumeration for speculative features/hints
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Oct 2021 09:14:46 +0000 (11:14 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 Oct 2021 09:14:46 +0000 (11:14 +0200)
commit15734a72d7d38e9f8fd6a1a0bbb2a493a53d8dce
treeb62fe280352e0a70a3ce50bc526c31bd9b8ab84a
parentb7afc6b455d88ae440113ae222c98a9b49bf1fd5
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>
master commit: 747424c664bb164a04e7a9f2ffbf02d4a1630d7d
master date: 2021-09-08 14:16:19 +0100
tools/libxl/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