Skip to content

amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests

Roger Pau Monne xen-devel 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 16 repliesIn review
  2. v53 patches 6 repliesSuperseded
  3. v43 patches 7 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches9 repliesSuperseded
v23 patches7 repliesSuperseded
v13 patches12 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRLxen/arch/x86/cpuid.c xen/arch/x86/hvm/hvm.c xen/arch/x86/include/asm/msr.h +3 more+33 -20 replies
2/3amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guestsxen/arch/x86/cpuid.c xen/arch/x86/hvm/svm/entry.S xen/arch/x86/hvm/svm/svm.c +4 more+88 -51 reply
3/3amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBDCHANGELOG.md xen/arch/x86/cpu/amd.c xen/arch/x86/hvm/svm/svm.c +2 more+118 -183 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJan BeulichHenry Wang
SeriesA-b
1/3R-b
2/3R-b
3/3R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests

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.

NB: patch 3 introduces some logic in GIF=0 context, such logic has been kept to a minimum due to the special context it's running on.

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

 CHANGELOG.md                                |   3 +
 xen/arch/x86/cpu/amd.c                      | 121 +++++++++++++++++---
 xen/arch/x86/cpuid.c                        |  21 ++++
 xen/arch/x86/hvm/hvm.c                      |   1 +
 xen/arch/x86/hvm/svm/entry.S                |   8 ++
 xen/arch/x86/hvm/svm/svm.c                  |  39 +++++++
 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 +-
 12 files changed, 233 insertions(+), 19 deletions(-)
Signature · 1 line
2.36.0