All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Add support for XSAVES to AMD and unify it with Intel
@ 2019-10-21 23:30 Aaron Lewis
  2019-10-21 23:30 ` [PATCH v3 1/9] KVM: x86: Introduce vcpu->arch.xsaves_enabled Aaron Lewis
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Aaron Lewis @ 2019-10-21 23:30 UTC (permalink / raw)
  To: Babu Moger, Yang Weijiang, Sebastian Andrzej Siewior, kvm
  Cc: Paolo Bonzini, Jim Mattson, Aaron Lewis

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

-- 
2.23.0.866.gb869b98d4c-goog


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

end of thread, other threads:[~2019-10-22 13:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 23:30 [PATCH v3 0/9] Add support for XSAVES to AMD and unify it with Intel Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 1/9] KVM: x86: Introduce vcpu->arch.xsaves_enabled Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 2/9] KVM: VMX: Fix conditions for guest IA32_XSS support Aaron Lewis
2019-10-22 13:43   ` Paolo Bonzini
2019-10-21 23:30 ` [PATCH v3 3/9] KVM: x86: Remove unneeded kvm_vcpu variable, guest_xcr0_loaded Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 4/9] KVM: SVM: Use wrmsr for switching between guest and host IA32_XSS on AMD Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 5/9] KVM: VMX: Use wrmsr for switching between guest and host IA32_XSS on Intel Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 6/9] KVM: x86: Move IA32_XSS-swapping on VM-entry/VM-exit to common x86 code Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 7/9] kvm: x86: Move IA32_XSS to kvm_{get,set}_msr_common Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 8/9] kvm: svm: Update svm_xsaves_supported Aaron Lewis
2019-10-21 23:30 ` [PATCH v3 9/9] kvm: tests: Add test to verify MSR_IA32_XSS Aaron Lewis
2019-10-22 13:48 ` [PATCH v3 0/9] Add support for XSAVES to AMD and unify it with Intel Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.