Re: [PATCH 2/6] KVM: x86: Fix CPUID range check for Centaur and Hypervisor ranges

From: Paolo Bonzini
Date: Wed Mar 04 2020 - 06:18:21 EST


On 03/03/20 19:01, Sean Christopherson wrote:
> static bool cpuid_function_in_range(struct kvm_vcpu *vcpu, u32 function)
> {
> struct kvm_cpuid_entry2 *max;
>
> if (function >= 0x40000000 && function <= 0x4fffffff)
> max = kvm_find_cpuid_entry(vcpu, function & 0xffffff00, 0);
> else
> max = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0);
> return max && function <= max->eax;
> }

Yes, this is a good idea (except it should be & 0xc0000000 to cover
Centaur).

Paolo