Re: [PATCH 3/6] KVM: x86: Mask off reserved bits in CPUID.80000008H

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

 



On Thu, Sep 29, 2022, Jim Mattson wrote:
> KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM
> actually supports. The following ranges of CPUID.80000008H are reserved
> and should be masked off:
>     EDX[31:18]
>     EDX[11:8]

Changelog says EDX, code and APM says ECX.

> Fixes: 24c82e576b78 ("KVM: Sanitize cpuid")
> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> ---
>  arch/x86/kvm/cpuid.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 90f9c295825d..15318f3f415e 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1156,6 +1156,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>  
>  		entry->eax = g_phys_as | (virt_as << 8);
>  		entry->edx = 0;
> +		entry->ecx &= ~(GENMASK(31, 18) | GENMASK(11, 8));

Would it makes sense to also zero out the PerfTscSize bits?  KVM doesn't emulate
MSR_F15H_PTSC.

Uber nit, ECX comes before EDX in both alphabetical and register index order :-D

>  		cpuid_entry_override(entry, CPUID_8000_0008_EBX);
>  		break;
>  	}
> -- 
> 2.38.0.rc1.362.ged0d419d3c-goog
> 



[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