kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] Clean up the supported xfeatures
@ 2023-02-24 22:35 Aaron Lewis
  2023-02-24 22:36 ` [PATCH v3 1/8] KVM: x86: Add kvm_permitted_xcr0() Aaron Lewis
                   ` (9 more replies)
  0 siblings, 10 replies; 29+ messages in thread
From: Aaron Lewis @ 2023-02-24 22:35 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, jmattson, seanjc, mizhang, Aaron Lewis

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

 arch/x86/kvm/cpuid.c                          |  27 +++-
 arch/x86/kvm/cpuid.h                          |   1 +
 arch/x86/kvm/x86.c                            |   4 +-
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/include/x86_64/processor.h  |  52 +++++++
 tools/testing/selftests/kvm/x86_64/amx_test.c |  46 ++-----
 .../selftests/kvm/x86_64/xcr0_cpuid_test.c    | 128 ++++++++++++++++++
 7 files changed, 220 insertions(+), 39 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/xcr0_cpuid_test.c

-- 
2.39.2.637.g21b0678d19-goog


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2023-03-23 21:48 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-24 22:35 [PATCH v3 0/8] Clean up the supported xfeatures Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 1/8] KVM: x86: Add kvm_permitted_xcr0() Aaron Lewis
2023-03-03 21:13   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 2/8] KVM: x86: Clear all supported MPX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:23   ` Mingwei Zhang
2023-03-03 22:23     ` Aaron Lewis
2023-03-07 16:32       ` Mingwei Zhang
2023-03-23 20:29   ` Sean Christopherson
2023-03-23 21:10     ` Mingwei Zhang
2023-03-23 21:16       ` Mingwei Zhang
2023-03-23 21:30         ` Sean Christopherson
2023-03-23 21:29       ` Sean Christopherson
2023-02-24 22:36 ` [PATCH v3 3/8] KVM: x86: Clear all supported AVX-512 " Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 4/8] KVM: x86: Clear AVX-512 xfeatures if SSE or AVX is clear Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 5/8] KVM: x86: Clear all supported AMX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:12   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 6/8] KVM: selftests: Hoist XGETBV and XSETBV to make them more accessible Aaron Lewis
2023-03-03 21:24   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 7/8] KVM: selftests: Add XFEATURE masks to common code Aaron Lewis
2023-03-03 21:16   ` Mingwei Zhang
2023-03-03 22:25     ` Aaron Lewis
2023-03-07 16:33       ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 8/8] KVM: selftests: Add XCR0 Test Aaron Lewis
2023-03-02 20:34   ` Mingwei Zhang
2023-03-02 22:50     ` Aaron Lewis
2023-03-03 21:11       ` Mingwei Zhang
2023-03-23 21:46   ` Sean Christopherson
2023-03-20 15:45 ` [PATCH v3 0/8] Clean up the supported xfeatures Mingwei Zhang
2023-03-23 21:47 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).