[PATCH 0/4] KVM: VMX: Add helper+macros to do sec exec adjustment

From: Sean Christopherson
Date: Wed Sep 23 2020 - 12:51:10 EST


Add a helper function and macro wrappers to consolidate code for adjusting
secondary execution controls based on guest CPUID. The adjustments are
effectively 10+ lines of copy+paste for each control, with slight tweaks
to account for annoying differences, e.g. XSAVES has additional checks.

Patches 1-3 are prep work to make INVPCID and RDTSCP align with the
"standard" nomenclature so that they don't require special casing.

Sean Christopherson (4):
KVM: VMX: Rename vmx_*_supported() helpers to cpu_has_vmx_*()
KVM: VMX: Unconditionally clear CPUID.INVPCID if !CPUID.PCID
KVM: VMX: Rename RDTSCP secondary exec control name to insert "ENABLE"
KVM: VMX: Add a helper and macros to reduce boilerplate for sec exec
ctls

arch/x86/include/asm/vmx.h | 2 +-
arch/x86/kvm/vmx/capabilities.h | 10 +-
arch/x86/kvm/vmx/nested.c | 4 +-
arch/x86/kvm/vmx/vmx.c | 150 +++++++-----------
.../selftests/kvm/include/x86_64/vmx.h | 2 +-
5 files changed, 64 insertions(+), 104 deletions(-)

--
2.28.0