On Tue, Dec 27, 2022 at 12:44 PM Aaron Lewis <aaronlewis@xxxxxxxxxx> wrote: > > > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > > > index 0b5bf013fcb8e..2d9910847786a 100644 > > > --- a/arch/x86/kvm/cpuid.c > > > +++ b/arch/x86/kvm/cpuid.c > > > @@ -977,6 +977,10 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) > > > u64 permitted_xcr0 = kvm_caps.supported_xcr0 & xstate_get_guest_group_perm(); > > > u64 permitted_xss = kvm_caps.supported_xss; > > > > > > + if (!(permitted_xcr0 & XFEATURE_MASK_XTILE_CFG) || > > > + !(permitted_xcr0 & XFEATURE_MASK_XTILE_DATA)) > > > + permitted_xcr0 &= ~XFEATURE_MASK_XTILE; > > > + > > > entry->eax &= permitted_xcr0; > > > entry->ebx = xstate_required_size(permitted_xcr0, false); > > > entry->ecx = entry->ebx; > > > -- > > > 2.39.0.314.g84b9a713c41-goog > > > > > > > Two questions: > > > > 1) Under what circumstances would this happen? > This would happen if userspace hasn't opted in to using AMX via arch_prctl(). > > > 2) Shouldn't we also clear XFEATURE_MASK_CFG if both bits are not set? > Both CFG and DATA are cleared with XFEATURE_MASK_XTILE. It defines both. Doh! Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>