mbox series

[v2,0/3] SEV-ES TSC_AUX virtualization fix and optimization

Message ID cover.1694811272.git.thomas.lendacky@amd.com (mailing list archive)
Headers show
Series SEV-ES TSC_AUX virtualization fix and optimization | expand

Message

Tom Lendacky Sept. 15, 2023, 8:54 p.m. UTC
This patch series provides fixes to the TSC_AUX virtualization support
and an optimization to reduce the number of WRMSRs to TSC_AUX when
it is virtualized.

---

Changes since v1:
- Move TSC_AUX virtualization support out of init_vmcb_after_set_cpuid()
  path and into the vcpu_after_set_cpuid() path
- Add an additional patch to properly set or clear intercepts based
  on TSC_AUX virtualization requirements
- Simplify the TSC_AUX virtualization optimization to set the host save
  area TSC_AUX value once during svm_hardware_enable().
- Since the TSC_AUX virtualization can't be disabled for an SEV-ES guest,
  eliminate the "v_tsc_aux" flag and check against the host feature and
  type of guest, directly.

Patches based on https://git.kernel.org/pub/scm/virt/kvm/kvm.git master
and commit:
  7c7cce2cf7ee ("Merge tag 'kvmarm-fixes-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD")

Tom Lendacky (3):
  KVM: SVM: Fix TSC_AUX virtualization setup
  KVM: SVM: Fix TSC_AUX virtualization intercept update logic
  KVM: SVM: Do not use user return MSR support for virtualized TSC_AUX

 arch/x86/kvm/svm/sev.c | 34 +++++++++++++++++++++++++--------
 arch/x86/kvm/svm/svm.c | 43 ++++++++++++++++++++++++++++++++++--------
 arch/x86/kvm/svm/svm.h |  1 +
 3 files changed, 62 insertions(+), 16 deletions(-)

Comments

Paolo Bonzini Sept. 22, 2023, 9:24 p.m. UTC | #1
Queued, thanks.  The part that stood out in patch 2 is the removal of
svm_clr_intercept(), which also applies when the initialization is done
in the wrong place.  Either way, svm_clr_intercept() is always going
to be called by svm_recalc_instruction_intercepts() if guest has the
RDTSC bit in its CPUID.

So I extracted that into a separate patch and squashed the rest of
patch 2 into patch 1.

Paolo
Tom Lendacky Sept. 25, 2023, 3:23 p.m. UTC | #2
On 9/22/23 16:24, Paolo Bonzini wrote:
> Queued, thanks.  The part that stood out in patch 2 is the removal of
> svm_clr_intercept(), which also applies when the initialization is done
> in the wrong place.  Either way, svm_clr_intercept() is always going
> to be called by svm_recalc_instruction_intercepts() if guest has the
> RDTSC bit in its CPUID.
> 
> So I extracted that into a separate patch and squashed the rest of
> patch 2 into patch 1.

Works for me. Thanks, Paolo!

> 
> Paolo
> 
>