Re: [RFC][PATCH] kvm: x86: Improve emulation of CPUID leaves 0BH and 1FH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 18, 2019 at 10:31 PM Xiaoyao Li <xiaoyao.li@xxxxxxxxx> wrote:
> I vote for Sean's one-off case, how about something like this:
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 22c2720cd948..6af5febf7b12 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -976,11 +976,23 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax,
> u32 *ebx,
>                 u32 *ecx, u32 *edx, bool check_limit)
>   {
>          u32 function = *eax, index = *ecx;
> -       struct kvm_cpuid_entry2 *best;
> +       struct kvm_cpuid_entry2 *best, tmp;
>          bool entry_found = true;
>
>          best = kvm_find_cpuid_entry(vcpu, function, index);
>
> +       if (!best && (fuction == 0xb || function == 0x1f) && index > 0) {
> +               best = kvm_find_cpuid_entry(vcpu, function, 0);
> +               if (best) {
> +                       tmp.eax = 0;
> +                       tmp.ebx = 0;
> +                       tmp.ecx = index & 0xff;
> +                       tmp.edx = best->edx;
> +                       best = &tmp;
> +                       goto out;
> +               }
> +       }
> +

I don't believe this works for the case where 0BH or 1FH is the
maximum basic leaf, in which case all out-of-range leaves should have
this behavior. But I'll go ahead and work up a solution using this
two-off :-) approach.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux