Skip to content

Commit 176bfc5

Browse files
committed
KVM: nSVM: Advertise support for flush-by-ASID
Advertise support for FLUSHBYASID when nested SVM is enabled, as KVM can always emulate flushing TLB entries for a vmcb12 ASID, e.g. by running L2 with a new, fresh ASID in vmcb02. Some modern hypervisors, e.g. VMWare Workstation 17, require FLUSHBYASID support and will refuse to run if it's not present. Punt on proper support, as "Honor L1's request to flush an ASID on nested VMRUN" is one of the TODO items in the (incomplete) list of issues that need to be addressed in order for KVM to NOT do a full TLB flush on every nested SVM transition (see nested_svm_transition_tlb_flush()). Reported-by: Stefan Sterz <s.sterz@proxmox.com> Closes: https://lkml.kernel.org/r/b9915c9c-4cf6-051a-2d91-44cc6380f455%40proxmox.com Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Link: https://lore.kernel.org/r/20231018194104.1896415-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent a484755 commit 176bfc5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

arch/x86/kvm/svm/svm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5076,6 +5076,13 @@ static __init void svm_set_cpu_caps(void)
50765076
kvm_cpu_cap_set(X86_FEATURE_SVM);
50775077
kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
50785078

5079+
/*
5080+
* KVM currently flushes TLBs on *every* nested SVM transition,
5081+
* and so for all intents and purposes KVM supports flushing by
5082+
* ASID, i.e. KVM is guaranteed to honor every L1 ASID flush.
5083+
*/
5084+
kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
5085+
50795086
if (nrips)
50805087
kvm_cpu_cap_set(X86_FEATURE_NRIPS);
50815088

0 commit comments

Comments
 (0)