Skip to content

KVM: x86: CPUID emulation and tracing fixes

Sean Christopherson kvm lkml oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 14 repliesIn review
  2. v16 patches 33 repliesSuperseded

Changes in v2 from the cover letter

- Use Jan's patch to fix the trace bug. [Everyone]
- Rework Hypervisor/Centaur handling so that only the Hypervisor sub-ranges get the restrictive 0xffffff00 mask, and so that Centaur's range only gets recognized when the guest vendor is Centaur. [Jim]
- Add the aforementioned bug fixes.
- Add a patch to do build time assertions on the vendor string, which are hand coded u32s in the emulator (for direct comparison against CPUID register output).
- Drop the patch to add CPUID.maxphyaddr emulator helper. [Paolo]
- Redo refactoring patches to land them after all the bug fixes and to do the refactoring without any semantic changes in the emulator.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7KVM: x86: Trace the original requested CPUID function in kvm_cpuid()arch/x86/kvm/cpuid.c+2 -21 reply
2/7KVM: x86: Add helpers to perform CPUID-based guest vendor checkarch/x86/include/asm/kvm_emulate.h arch/x86/kvm/cpuid.h arch/x86/kvm/emulate.c+33 -293 replies
3/7KVM x86: Extend AMD specific guest behavior to Hygon virtual CPUsarch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h arch/x86/kvm/mmu/mmu.c +1 more+8 -50 replies
4/7KVM: x86: Fix CPUID range checks for Hypervisor and Centaur classesarch/x86/include/asm/kvm_emulate.h arch/x86/kvm/cpuid.c+59 -67 replies
5/7KVM: x86: Add build-time assertions on validity of vendor stringsarch/x86/kvm/emulate.c+20 -00 replies
6/7KVM: x86: Refactor out-of-range logic to contain the madnessarch/x86/kvm/cpuid.c+29 -180 replies
7/7KVM: x86: Refactor kvm_cpuid() param that controls out-of-range logicarch/x86/include/asm/kvm_emulate.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +3 more+17 -160 replies

Reviews trailers per patch

2 of 7 patches have a Reviewed-by or Acked-by.

PatchJim Mattson
1/7R-b
2/7R-b
3/7
4/7
5/7
6/7
7/7

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

Read the v2 thread

Cover letter [PATCH v2 0/7] KVM: x86: CPUID emulation and tracing fixes

Round two of trying to wrangle kvm_cpuid() into submission. Two more bug fixes, both related to querying for an "AMD" vendor, in addition to the fixes in v1 (tracing and Hypervisor/Centaur range checks).

In theory, everything up to the refactoring is non-controversial, i.e. we can bikeshed the refactoring without delaying the bug fixes.

v2:
- Use Jan's patch to fix the trace bug. [Everyone]
- Rework Hypervisor/Centaur handling so that only the Hypervisor sub-ranges get the restrictive 0xffffff00 mask, and so that Centaur's range only gets recognized when the guest vendor is Centaur. [Jim]
- Add the aforementioned bug fixes.
- Add a patch to do build time assertions on the vendor string, which are hand coded u32s in the emulator (for direct comparison against CPUID register output).
- Drop the patch to add CPUID.maxphyaddr emulator helper. [Paolo]
- Redo refactoring patches to land them after all the bug fixes and to do the refactoring without any semantic changes in the emulator.

Jan Kiszka (1):
KVM: x86: Trace the original requested CPUID function in kvm_cpuid()

Sean Christopherson (6):
KVM: x86: Add helpers to perform CPUID-based guest vendor check KVM x86: Extend AMD specific guest behavior to Hygon virtual CPUs
KVM: x86: Fix CPUID range checks for Hypervisor and Centaur classes
KVM: x86: Add build-time assertions on validity of vendor strings
KVM: x86: Refactor out-of-range logic to contain the madness
KVM: x86: Refactor kvm_cpuid() param that controls out-of-range logic

 arch/x86/include/asm/kvm_emulate.h |  37 +++++++++-
 arch/x86/kvm/cpuid.c               | 111 +++++++++++++++++++++--------
 arch/x86/kvm/cpuid.h               |   8 ++-
 arch/x86/kvm/emulate.c             |  64 ++++++++---------
 arch/x86/kvm/mmu/mmu.c             |   3 +-
 arch/x86/kvm/svm.c                 |   2 +-
 arch/x86/kvm/x86.c                 |   7 +-
 7 files changed, 162 insertions(+), 70 deletions(-)
Signature · 1 line
2.24.1