Re: [PATCH 5/6] KVM: x86: Mask off reserved bits in CPUID.8000001EH

[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.8000001EH are reserved
> and should be masked off:
>     EBX[31:16]
>     ECX[31:11]

LOL, APM is buggy, it says all bits in ECX are reserved.

  31:0  -                Reserved.
  10:8 NodesPerProcessor
  7:0  NodeId

Advertising NodeId seems all kinds of wrong :-(

>     EDX[31:0]
> 
> Fixes: 382409b4c43e ("kvm: x86: Include CPUID leaf 0x8000001e in kvm's supported CPUID")
> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> ---
>  arch/x86/kvm/cpuid.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 5d1ec390aa45..576cbcf489ce 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1179,6 +1179,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>  		entry->ebx = entry->ecx = entry->edx = 0;
>  		break;
>  	case 0x8000001e:
> +		entry->ebx &= ~GENMASK(31, 16);
> +		entry->ecx &= ~GENMASK(31, 11);
> +		entry->edx = 0;
>  		break;
>  	case 0x8000001F:
>  		if (!kvm_cpu_cap_has(X86_FEATURE_SEV)) {
> -- 
> 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