Re: [PATCH v3 5/8] KVM: x86: Clear all supported AMX xfeatures if they are not all set

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

 



On Fri, Feb 24, 2023, Aaron Lewis wrote:
> Be a good citizen and don't allow any of the supported AMX xfeatures[1]
> to be set if they can't all be set.  That way userspace or a guest
> doesn't fail if it attempts to set them in XCR0.
> 
> [1] CPUID.(EAX=0DH,ECX=0):EAX.XTILE_CFG[bit-17]
>     CPUID.(EAX=0DH,ECX=0):EAX.XTILE_DATA[bit-18]
> 
> Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx>

Reviewed-by: Mingwei Zhang <mizhang@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 1eff76f836a2..ac0423508b28 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -72,6 +72,9 @@ static u64 sanitize_xcr0(u64 xcr0)
>  	if ((xcr0 & mask) != mask)
>  		xcr0 &= ~XFEATURE_MASK_AVX512;
>  
> +	if ((xcr0 & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE)
> +		xcr0 &= ~XFEATURE_MASK_XTILE;
> +
>  	return xcr0;
>  }
>  
> -- 
> 2.39.2.637.g21b0678d19-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