On Fri, Feb 24, 2023, Aaron Lewis wrote: > Make sure the supported xfeatures, i.e. EDX:EAX of CPUID.(EAX=0DH,ECX=0), > for MPX, AVX-512, and AMX are in a valid state and follow the rules > outlined in the SDM vol 1, section 13.3 ENABLING THE XSAVE FEATURE SET > AND XSAVE-ENABLED FEATURES. While those rules apply to the enabled > xfeatures, i.e. XCR0, use them to set the supported xfeatures. That way > if they are used by userspace or a guest to set the enabled xfeatures, > they won't cause a #GP. > > A test is then added to verify the supported xfeatures are in this > sanitied state. > > v2 -> v3: > - Sanitize the supported XCR0 in XSAVES2 [Sean] > - Split AVX-512 into 2 commits [Sean] > - Added XFEATURE_MASK_FP to selftests [Sean] > - Reworked XCR0 test to split up architectural and kvm rules [Sean] > > Aaron Lewis (8): > KVM: x86: Add kvm_permitted_xcr0() > KVM: x86: Clear all supported MPX xfeatures if they are not all set > KVM: x86: Clear all supported AVX-512 xfeatures if they are not all set > KVM: x86: Clear AVX-512 xfeatures if SSE or AVX is clear > KVM: x86: Clear all supported AMX xfeatures if they are not all set > KVM: selftests: Hoist XGETBV and XSETBV to make them more accessible > KVM: selftests: Add XFEATURE masks to common code > KVM: selftests: Add XCR0 Test A few nits on the new selftest, but I can clean those up when posting v4. I'll wait to do that until you've had a chance to weigh in on my proposal (see response to patch 2). Thanks!