All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: x86/SVM: Fixes for AMD ERAPS virtualization
@ 2026-07-16 23:25 Jim Mattson
  2026-07-16 23:25 ` [PATCH 1/3] KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid() Jim Mattson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jim Mattson @ 2026-07-16 23:25 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: Amit Shah, venkateshs, yosry, kvm, Jim Mattson

This series fixes three issues in KVM's virtualization of Enhanced Return
Address Predictor Security (ERAPS):

Patch 1 moves ALLOW_LARGER_RAP configuration from init_vmcb() to
svm_vcpu_after_set_cpuid(). On initial vCPU creation, init_vmcb() runs
before guest CPUID is configured via KVM_SET_CPUID2, leaving the BSP
without ALLOW_LARGER_RAP. Configuring ALLOW_LARGER_RAP in
svm_vcpu_after_set_cpuid() handles all vCPUs in one place.

Patch 2 moves ERAPS dirty tracking into svm_flush_tlb_asid(). AMD ERAPS
architecturally requires clearing the Return Address Predictor (RAP/RSB) on
all implicit TLB invalidations. Centralizing dirty tracking in
svm_flush_tlb_asid() ensures that local/current ASID flushes
(e.g. same-value CR3 reloads under shadow paging, CR4.PAE/SMEP toggles,
single-context INVPCID) correctly mark ERAPS dirty and clear the RAP on the
next VMRUN.

Patch 3 adds a KVM_REQ_TLB_FLUSH_GUEST request to kvm_mtrr_set_msr() when
MTRR MSRs are written via WRMSR. Per AMD APM and Intel SDM, MTRR writes are
implicit TLB invalidations. Requesting a guest TLB flush restores x86
architectural compliance and ensures ERAPS RAP clearing on MTRR writes.

Jim Mattson (3):
  KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid()
  KVM: SVM: Dirty ERAPS register on all ASID TLB flushes
  KVM: x86: Flush guest TLB on MTRR MSR writes

 arch/x86/kvm/mtrr.c    |  1 +
 arch/x86/kvm/svm/svm.c | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)

-- 
2.55.0.229.g6434b31f56-goog


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

end of thread, other threads:[~2026-07-16 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16 23:25 [PATCH 0/3] KVM: x86/SVM: Fixes for AMD ERAPS virtualization Jim Mattson
2026-07-16 23:25 ` [PATCH 1/3] KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid() Jim Mattson
2026-07-16 23:46   ` sashiko-bot
2026-07-16 23:25 ` [PATCH 2/3] KVM: SVM: Dirty ERAPS register on all ASID TLB flushes Jim Mattson
2026-07-16 23:25 ` [PATCH 3/3] KVM: x86: Flush guest TLB on MTRR MSR writes Jim Mattson

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.