Add support for XSAVES to AMD and unify it with Intel
Status from this message: Queued, thanks.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest9 patches 2 repliesApplied
- v25 patches 5 repliesSuperseded
- v16 patches 19 repliesSuperseded
Changes in v3 from the cover letter
- Remove guest_xcr0_loaded from kvm_vcpu.
- Add vcpu->arch.xsaves_enabled.
- Add staged rollout to load the hardware IA32_XSS MSR with guest/host values on VM-entry and VM-exit:
1) Introduce vcpu->arch->xsaves_enabled.
2) Add svm implementation for switching between guest and host IA32_XSS.
3) Add vmx implementation for switching between guest and host IA32_XSS.
4) Remove svm and vmx implementation and add it to common code.
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | KVM: x86: Introduce vcpu->arch.xsaves_enabledarch/ arch/ arch/ | +9 | 0 replies | |
| 2/9 | KVM: VMX: Fix conditions for guest IA32_XSS supportarch/ | +11 | 1 reply | |
| 3/9 | KVM: x86: Remove unneeded kvm_vcpu variable, guest_xcr0_loadedarch/ include/ | +5 | 0 replies | |
| 4/9 | KVM: SVM: Use wrmsr for switching between guest and host IA32_XSS on AMDarch/ | +23 | 0 replies | |
| 5/9 | KVM: VMX: Use wrmsr for switching between guest and host IA32_XSS on Intelarch/ | +18 | 0 replies | |
| 6/9 | KVM: x86: Move IA32_XSS-swapping on VM-entry/VM-exit to common x86 codearch/ arch/ arch/ +1 more | +34 | 0 replies | |
| 7/9 | kvm: x86: Move IA32_XSS to kvm_{get,set}_msr_commonarch/ arch/ | +20 | 0 replies | |
| 8/9 | kvm: svm: Update svm_xsaves_supportedarch/ | +1 | 0 replies | |
| 9/9 | kvm: tests: Add test to verify MSR_IA32_XSStools/ tools/ tools/ +2 more | +147 | 0 replies |
Reviews trailers per patch
All 9 patches have a Reviewed-by or Acked-by.
| Patch | Jim Mattson |
|---|---|
| 1/9 | R-b |
| 2/9 | R-b |
| 3/9 | R-b |
| 4/9 | R-b |
| 5/9 | R-b |
| 6/9 | R-b |
| 7/9 | R-b |
| 8/9 | R-b |
| 9/9 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/9] Add support for XSAVES to AMD and unify it with Intel
Unify AMD's and Intel's approach for supporting XSAVES. To do this change Intel's approach from using the MSR-load areas to writing the guest/host values to IA32_XSS on a VM-enter/VM-exit. Switching to this strategy allows for a common approach between both AMD and Intel. Additionally, define svm_xsaves_supported() based on AMD's feedback, and add vcpu->arch.xsaves_enabled to track whether XSAVES is enabled in the guest.
This change sets up IA32_XSS to be a non-zero value in the future, which may happen sooner than later with support for guest CET feature being added.
v2 -> v3:
- Remove guest_xcr0_loaded from kvm_vcpu.
- Add vcpu->arch.xsaves_enabled.
- Add staged rollout to load the hardware IA32_XSS MSR with guest/host values on VM-entry and VM-exit:
1) Introduce vcpu->arch->xsaves_enabled.
2) Add svm implementation for switching between guest and host IA32_XSS.
3) Add vmx implementation for switching between guest and host IA32_XSS.
4) Remove svm and vmx implementation and add it to common code.
v1 -> v2:
- Add the flag xsaves_enabled to kvm_vcpu_arch to track when XSAVES is enabled in the guest, whether or not XSAVES is enumerated in the guest CPUID.
- Remove code that sets the X86_FEATURE_XSAVES bit in the guest CPUID which was added in patch "Enumerate XSAVES in guest CPUID when it is available to the guest". As a result we no longer need that patch.
- Added a comment to kvm_set_msr_common to describe how to save/restore PT MSRS without using XSAVES/XRSTORS.
- Added more comments to the "Add support for XSAVES on AMD" patch.
- Replaced vcpu_set_msr_expect_result() with _vcpu_set_msr() in the test library.
Aaron Lewis (9):
KVM: x86: Introduce vcpu->arch.xsaves_enabled
KVM: VMX: Fix conditions for guest IA32_XSS support
KVM: x86: Remove unneeded kvm_vcpu variable, guest_xcr0_loaded
KVM: SVM: Use wrmsr for switching between guest and host IA32_XSS on AMD
KVM: VMX: Use wrmsr for switching between guest and host IA32_XSS on Intel
KVM: x86: Move IA32_XSS-swapping on VM-entry/VM-exit to common x86 code
kvm: x86: Move IA32_XSS to kvm_{get,set}_msr_common
kvm: svm: Update svm_xsaves_supported
kvm: tests: Add test to verify MSR_IA32_XSS
arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm.c | 9 ++- arch/x86/kvm/vmx/vmx.c | 41 ++-------- arch/x86/kvm/x86.c | 52 ++++++++++--- arch/x86/kvm/x86.h | 4 +- include/linux/kvm_host.h | 1 - tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/include/x86_64/processor.h | 7 +- .../selftests/kvm/lib/x86_64/processor.c | 72 +++++++++++++++--- .../selftests/kvm/x86_64/xss_msr_test.c | 76 +++++++++++++++++++ 11 files changed, 205 insertions(+), 60 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/xss_msr_test.c
Signature · 1 line
2.23.0.866.gb869b98d4c-goog