Skip to content

Clean up the supported xfeatures

Aaron Lewis kvm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 20 repliesIn review
  2. v26 patches 22 repliesSuperseded

Changes in v3 from the cover letter

- 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]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8KVM: x86: Add kvm_permitted_xcr0()arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h arch/x86/kvm/x86.c+8 -41 reply
2/8KVM: x86: Clear all supported MPX xfeatures if they are not all setarch/x86/kvm/cpuid.c+14 -18 replies
3/8KVM: x86: Clear all supported AVX-512 xfeatures if they are not all setarch/x86/kvm/cpuid.c+4 -00 replies
4/8KVM: x86: Clear AVX-512 xfeatures if SSE or AVX is cleararch/x86/kvm/cpuid.c+1 -10 replies
5/8KVM: x86: Clear all supported AMX xfeatures if they are not all setarch/x86/kvm/cpuid.c+3 -01 reply
6/8KVM: selftests: Hoist XGETBV and XSETBV to make them more accessibletools/testing/selftests/kvm/include/x86_64/processor.h tools/testing/selftests/kvm/x86_64/amx_test.c+21 -211 reply
7/8KVM: selftests: Add XFEATURE masks to common codetools/testing/selftests/kvm/include/x86_64/processor.h tools/testing/selftests/kvm/x86_64/amx_test.c+25 -143 replies
8/8KVM: selftests: Add XCR0 Testtools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/include/x86_64/processor.h tools/testing/selftests/kvm/x86_64/xcr0_cpuid_test.c+146 -04 replies

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchJim MattsonMingwei Zhang
1/8R-b
2/8R-b R-b
3/8
4/8
5/8R-b
6/8R-b R-b
7/8
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/8] Clean up the supported xfeatures

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
Signature · 1 line
2.39.2.637.g21b0678d19-goog