Skip to content

KVM: x86: X86_FEATURE bit() cleanup

Sean Christopherson kvm lkml 2 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyApplied
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Rework the assertions to use the reverse_cpuid table instead of using the last cpufeatures word (which was not at all intuitive).

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5KVM: x86: Add dedicated emulator helpers for querying CPUID featuresarch/x86/include/asm/kvm_emulate.h arch/x86/kvm/emulate.c arch/x86/kvm/x86.c+25 -180 replies
2/5KVM: x86: Move bit() helper to cpuid.harch/x86/kvm/cpuid.h arch/x86/kvm/x86.h+5 -50 replies
3/5KVM: x86: Add CPUID_7_1_EAX to the reverse CPUID tablearch/x86/kvm/cpuid.h+1 -00 replies
4/5KVM: x86: Expand build-time assertion on reverse CPUID usagearch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h+33 -90 replies
5/5KVM: x86: Refactor and rename bit() to feature_bit() macroarch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h arch/x86/kvm/svm.c +1 more+29 -270 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] KVM: x86: X86_FEATURE bit() cleanup

Small series to add build-time protections on reverse CPUID lookup (and other usages of bit()), and to rename the misleading-generic bit() helper to something that better conveys its purpose.

I don't love emulator changes in patch 1 as adding one-off helpers is a bit silly, but IMO it's the lesser of two evils, e.g. adding dedicated helpers is arguably less error prone than manually encoding a CPUID lookup, and the helpers approach avoids having to include cpuid.h in the emulator code.

v2:
- Rework the assertions to use the reverse_cpuid table instead of using the last cpufeatures word (which was not at all intuitive).

Sean Christopherson (5):
KVM: x86: Add dedicated emulator helpers for querying CPUID features
KVM: x86: Move bit() helper to cpuid.h
KVM: x86: Add CPUID_7_1_EAX to the reverse CPUID table
KVM: x86: Expand build-time assertion on reverse CPUID usage
KVM: x86: Refactor and rename bit() to feature_bit() macro

 arch/x86/include/asm/kvm_emulate.h |  4 +++
 arch/x86/kvm/cpuid.c               |  5 ++--
 arch/x86/kvm/cpuid.h               | 41 +++++++++++++++++++++++++----
 arch/x86/kvm/emulate.c             | 21 +++------------
 arch/x86/kvm/svm.c                 |  4 +--
 arch/x86/kvm/vmx/vmx.c             | 42 +++++++++++++++---------------
 arch/x86/kvm/x86.c                 | 18 +++++++++++++
 arch/x86/kvm/x86.h                 |  5 ----
 8 files changed, 87 insertions(+), 53 deletions(-)
Signature · 1 line
2.24.1