lkml.org 
[lkml]   [2021]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 18/19] kvm: x86: AMX XCR0 support for guest
From
On 12/8/21 01:03, Yang Zhong wrote:
> +
> +#ifdef CONFIG_X86_64
> + if ((xcr0 & XFEATURE_MASK_XTILE) &&
> + ((xcr0 & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE))
> + return 1;
> +#else
> + /*
> + * Intel AMX instructions can be executed only in 64-bit mode but
> + * XSAVE can operate on XTILECFG and XTILEDATA in any mode.
> + * Since the FPU core follows SDM recommendation to set
> + * XCR[18:17] only in 64-bit environment, here also prevent any
> + * guest OS from setting the two bits when host is 32-bit.
> + *
> + * XFEATURE_MASK_XTILE cannot be used since it is 0 in this case.
> + */
> + xcr0 &= ~(XFEATURE_MASK_XTILE_DATA | XFEATURE_MASK_XTILE_CFG);
> +#endif

This should not be necessary, because on a 32-bit system the bits won't
be part of supported_xcr0.

Paolo

\
 
 \ /
  Last update: 2021-12-10 17:31    [W:0.518 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site