Skip to content

Commit 92e82cf

Browse files
vittyvksean-jc
authored andcommitted
KVM: x86: Introduce __kvm_get_hypervisor_cpuid() helper
Similar to kvm_find_kvm_cpuid_features()/__kvm_find_kvm_cpuid_features(), introduce a helper to search for the specific hypervisor signature in any struct kvm_cpuid_entry2 array, not only in vcpu->arch.cpuid_entries. No functional change intended. Signed-off-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 41bccc9 commit 92e82cf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ static int kvm_cpuid_check_equal(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2
189189
return 0;
190190
}
191191

192-
static struct kvm_hypervisor_cpuid kvm_get_hypervisor_cpuid(struct kvm_vcpu *vcpu,
193-
const char *sig)
192+
static struct kvm_hypervisor_cpuid __kvm_get_hypervisor_cpuid(struct kvm_cpuid_entry2 *entries,
193+
int nent, const char *sig)
194194
{
195195
struct kvm_hypervisor_cpuid cpuid = {};
196196
struct kvm_cpuid_entry2 *entry;
197197
u32 base;
198198

199199
for_each_possible_hypervisor_cpuid_base(base) {
200-
entry = kvm_find_cpuid_entry(vcpu, base);
200+
entry = cpuid_entry2_find(entries, nent, base, KVM_CPUID_INDEX_NOT_SIGNIFICANT);
201201

202202
if (entry) {
203203
u32 signature[3];
@@ -217,6 +217,13 @@ static struct kvm_hypervisor_cpuid kvm_get_hypervisor_cpuid(struct kvm_vcpu *vcp
217217
return cpuid;
218218
}
219219

220+
static struct kvm_hypervisor_cpuid kvm_get_hypervisor_cpuid(struct kvm_vcpu *vcpu,
221+
const char *sig)
222+
{
223+
return __kvm_get_hypervisor_cpuid(vcpu->arch.cpuid_entries,
224+
vcpu->arch.cpuid_nent, sig);
225+
}
226+
220227
static struct kvm_cpuid_entry2 *__kvm_find_kvm_cpuid_features(struct kvm_vcpu *vcpu,
221228
struct kvm_cpuid_entry2 *entries, int nent)
222229
{

0 commit comments

Comments
 (0)