]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: Add framework to query KVM CPUID bits
authorSean Christopherson <seanjc@google.com>
Tue, 14 Jun 2022 20:06:28 +0000 (20:06 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:09 +0000 (18:14 -0700)
commitb8d76c5f0c32cbe6bcd9e7f25e86478cc7f66206
tree108ff9d7c8abf748b80d22bd3902adc0f0425b7a
parent29c8bdefe2d2b479066531036eb4f474a7a832d5
KVM: selftests: Add framework to query KVM CPUID bits

Add X86_FEATURE_* magic in the style of KVM-Unit-Tests' implementation,
where the CPUID function, index, output register, and output bit position
are embedded in the macro value.  Add kvm_cpu_has() to query KVM's
supported CPUID and use it set_sregs_test, which is the most prolific
user of manual feature querying.

Opportunstically rename calc_cr4_feature_bits() to
calc_supported_cr4_feature_bits() to better capture how the CR4 bits are
chosen.

Link: https://lore.kernel.org/all/20210422005626.564163-1-ricarkol@google.com
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220614200707.3315957-4-seanjc@google.com
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c
tools/testing/selftests/kvm/x86_64/set_sregs_test.c