[PATCH v4 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests

Roger Pau Monne posted 3 patches 2 years, 7 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20220427104718.81342-1-roger.pau@citrix.com
There is a newer version of this series
xen/arch/x86/cpu/amd.c                      | 119 +++++++++++++++++---
xen/arch/x86/cpuid.c                        |  28 +++++
xen/arch/x86/hvm/hvm.c                      |   1 +
xen/arch/x86/hvm/svm/entry.S                |   8 ++
xen/arch/x86/hvm/svm/svm.c                  |  40 +++++++
xen/arch/x86/include/asm/amd.h              |   4 +
xen/arch/x86/include/asm/cpufeatures.h      |   1 +
xen/arch/x86/include/asm/msr.h              |  14 +++
xen/arch/x86/msr.c                          |  26 +++++
xen/arch/x86/spec_ctrl.c                    |  12 +-
xen/include/public/arch-x86/cpufeatureset.h |   2 +-
11 files changed, 236 insertions(+), 19 deletions(-)
[PATCH v4 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests
Posted by Roger Pau Monne 2 years, 7 months ago
Hello,

The following series implements support for MSR_VIRT_SPEC_CTRL
(VIRT_SSBD) on different AMD CPU families.

Note that the support is added backwards, starting with the newer CPUs
that support MSR_SPEC_CTRL and moving to the older ones either using
MSR_VIRT_SPEC_CTRL or the SSBD bit in LS_CFG.

Xen is still free to use it's own SSBD setting, as the selection is
context switched on vm{entry,exit}.

On Zen2 and later, SPEC_CTRL.SSBD should exist and should be used in
preference to VIRT_SPEC_CTRL.SSBD.  However, for migration
compatibility, Xen offers VIRT_SSBD to guests (in the max cpuid policy,
not default) implemented in terms of SPEC_CTRL.SSBD.

On Fam15h thru Zen1, Xen exposes VIRT_SSBD to guests by default to
abstract away the model and/or hypervisor specific differences in
MSR_LS_CFG/MSR_VIRT_SPEC_CTRL.

So the implementation of VIRT_SSBD exposed to HVM guests will use one of
the following underlying mechanisms, in the preference order listed
below:

 * SPEC_CTRL.SSBD: patch 1
 * VIRT_SPEC_CTRL.SSBD: patch 2.
 * Non-architectural way using LS_CFG: patch 3.

Roger Pau Monne (3):
  amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
  amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
  amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD

 xen/arch/x86/cpu/amd.c                      | 119 +++++++++++++++++---
 xen/arch/x86/cpuid.c                        |  28 +++++
 xen/arch/x86/hvm/hvm.c                      |   1 +
 xen/arch/x86/hvm/svm/entry.S                |   8 ++
 xen/arch/x86/hvm/svm/svm.c                  |  40 +++++++
 xen/arch/x86/include/asm/amd.h              |   4 +
 xen/arch/x86/include/asm/cpufeatures.h      |   1 +
 xen/arch/x86/include/asm/msr.h              |  14 +++
 xen/arch/x86/msr.c                          |  26 +++++
 xen/arch/x86/spec_ctrl.c                    |  12 +-
 xen/include/public/arch-x86/cpufeatureset.h |   2 +-
 11 files changed, 236 insertions(+), 19 deletions(-)

-- 
2.35.1