mbox series

[0/5] x86: AMD CPUID handling improvements

Message ID 20240429151625.977884-1-andrew.cooper3@citrix.com (mailing list archive)
Headers show
Series x86: AMD CPUID handling improvements | expand

Message

Andrew Cooper April 29, 2024, 3:16 p.m. UTC
This is (half) the series I've promised various people, to untangle some AMD
CPUID handling.  It moves the SVM feature leaf into the standard
x86_capabilities[] infrastructure.

On a random Milan system, with this in place, xen-cpuid reports:

Dynamic sets:
Raw                             178bfbff:7eda320b:2fd3fbff:75c237ff:0000000f:219c95a9:0040069c:00006799:91bef75f:00000000:00000000:0000204d:00000000:00000000:00000000:00000000:00000000:00000000:119b9cff:0101fd3f
  [18] CPUID 0x8000000a.edx     npt v-lbr svm-lock nrips v-tsc-rate vmcb-cleanbits flush-by-asid decode-assist pause-filter <11> pause-thresh v-loadsave v-gif <17> npt-sss v-spec-ctrl <23> <24> <28>
  [19] CPUID 0x8000001f.eax     sme sev <2> sev-es sev-snp <5> <8> <10> <11> <12> <13> <14> <15> <16> <24>

Host                            178bf3ff:76da320b:2fd3fbff:644037ff:0000000f:219c95a9:0040068c:00000780:319ed205:00000000:00000000:18000045:00000000:00000000:00000000:00000000:00000000:00000000:001994ff:00000000
  [18] CPUID 0x8000000a.edx     npt v-lbr svm-lock nrips v-tsc-rate vmcb-cleanbits flush-by-asid decode-assist pause-filter pause-thresh v-loadsave v-gif npt-sss v-spec-ctrl
  [19] CPUID 0x8000001f.eax

HVM Max                         178bfbff:f6fa3203:2e500800:440001f7:0000000f:219c05a9:0040060c:00000100:331ed005:00000000:00000000:18000045:00000000:00000000:00000000:00000000:00000000:00000000:000004ab:00000000
  [18] CPUID 0x8000000a.edx     npt v-lbr nrips vmcb-cleanbits decode-assist pause-filter
  [19] CPUID 0x8000001f.eax


Unforunately, I haven't managed to do the second half to make the host_policy
usable earlier on boot.  Untanling __setup_xen() is proving stuborn due to
(ab)uses of the MB1 module list.

Andrew Cooper (5):
  x86/cpu-policy: Infrastructure for the AMD SVM and SEV leaves
  x86/cpu-policy: Add SVM features already used by Xen
  x86/spec-ctrl: Remove open-coded check of SVM_FEATURE_SPEC_CTRL
  x86/svm: Switch SVM features over normal cpu_has_*
  x86/cpu-policy: Introduce some SEV features

 tools/libs/light/libxl_cpuid.c              |  2 +
 tools/misc/xen-cpuid.c                      | 24 ++++++++++
 xen/arch/x86/cpu-policy.c                   | 17 +++----
 xen/arch/x86/cpu/common.c                   |  4 ++
 xen/arch/x86/hvm/svm/asid.c                 |  5 +--
 xen/arch/x86/hvm/svm/emulate.c              |  3 +-
 xen/arch/x86/hvm/svm/intr.c                 |  1 -
 xen/arch/x86/hvm/svm/nestedsvm.c            | 14 +++---
 xen/arch/x86/hvm/svm/svm.c                  | 50 +++++----------------
 xen/arch/x86/hvm/svm/vmcb.c                 |  1 -
 xen/arch/x86/include/asm/cpufeature.h       | 16 +++++++
 xen/arch/x86/include/asm/hvm/svm/svm.h      | 36 ---------------
 xen/arch/x86/spec_ctrl.c                    |  7 +--
 xen/include/public/arch-x86/cpufeatureset.h | 22 +++++++++
 xen/include/xen/lib/x86/cpu-policy.h        | 24 +++++++++-
 xen/lib/x86/cpuid.c                         |  4 ++
 xen/tools/gen-cpuid.py                      |  7 +++
 17 files changed, 128 insertions(+), 109 deletions(-)

--
2.30.2