]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Add dedicated helper to get CPUID entry with significant index
authorSean Christopherson <seanjc@google.com>
Tue, 12 Jul 2022 00:06:45 +0000 (02:06 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2022 15:38:32 +0000 (11:38 -0400)
commitf6e1f8213a9b677534d410fc7d9aa919777bc04d
tree66308381c107f60655c3ae1035a2f1e77208a90d
parentab5f3299adda51db9c30f594ac3a4beb5aab1283
KVM: x86: Add dedicated helper to get CPUID entry with significant index

Add a second CPUID helper, kvm_find_cpuid_entry_index(), to handle KVM
queries for CPUID leaves whose index _may_ be significant, and drop the
index param from the existing kvm_find_cpuid_entry().  Add a WARN in the
inner helper, cpuid_entry2_find(), to detect attempts to retrieve a CPUID
entry whose index is significant without explicitly providing an index.

Using an explicit magic number and letting callers omit the index avoids
confusion by eliminating the myriad cases where KVM specifies '0' as a
dummy value.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/hyperv.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/vmx/sgx.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c