Merge tag 'kvm-x86-svm-6.8' of https://github.com/kvm-x86/linux into HEAD
KVM SVM changes for 6.8: - Revert a bogus, made-up nested SVM consistency check for TLB_CONTROL. - Advertise flush-by-ASID support for nSVM unconditionally, as KVM always flushes on nested transitions, i.e. always satisfies flush requests. This allows running bleeding edge versions of VMware Workstation on top of KVM. - Sanity check that the CPU supports flush-by-ASID when enabling SEV support. - Fix a benign NMI virtualization bug where KVM would unnecessarily intercept IRET when manually injecting an NMI, e.g. when KVM pends an NMI and injects a second, "simultaneous" NMI.
This commit is contained in:
@@ -253,18 +253,6 @@ static bool nested_svm_check_bitmap_pa(struct kvm_vcpu *vcpu, u64 pa, u32 size)
|
||||
kvm_vcpu_is_legal_gpa(vcpu, addr + size - 1);
|
||||
}
|
||||
|
||||
static bool nested_svm_check_tlb_ctl(struct kvm_vcpu *vcpu, u8 tlb_ctl)
|
||||
{
|
||||
/* Nested FLUSHBYASID is not supported yet. */
|
||||
switch(tlb_ctl) {
|
||||
case TLB_CONTROL_DO_NOTHING:
|
||||
case TLB_CONTROL_FLUSH_ALL_ASID:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
|
||||
struct vmcb_ctrl_area_cached *control)
|
||||
{
|
||||
@@ -284,9 +272,6 @@ static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
|
||||
IOPM_SIZE)))
|
||||
return false;
|
||||
|
||||
if (CC(!nested_svm_check_tlb_ctl(vcpu, control->tlb_ctl)))
|
||||
return false;
|
||||
|
||||
if (CC((control->int_ctl & V_NMI_ENABLE_MASK) &&
|
||||
!vmcb12_is_intercept(control, INTERCEPT_NMI))) {
|
||||
return false;
|
||||
|
||||
@@ -2191,10 +2191,13 @@ void __init sev_hardware_setup(void)
|
||||
/*
|
||||
* SEV must obviously be supported in hardware. Sanity check that the
|
||||
* CPU supports decode assists, which is mandatory for SEV guests to
|
||||
* support instruction emulation.
|
||||
* support instruction emulation. Ditto for flushing by ASID, as SEV
|
||||
* guests are bound to a single ASID, i.e. KVM can't rotate to a new
|
||||
* ASID to effect a TLB flush.
|
||||
*/
|
||||
if (!boot_cpu_has(X86_FEATURE_SEV) ||
|
||||
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)))
|
||||
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)) ||
|
||||
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID)))
|
||||
goto out;
|
||||
|
||||
/* Retrieve SEV CPUID information */
|
||||
|
||||
+16
-2
@@ -3563,8 +3563,15 @@ static void svm_inject_nmi(struct kvm_vcpu *vcpu)
|
||||
if (svm->nmi_l1_to_l2)
|
||||
return;
|
||||
|
||||
svm->nmi_masked = true;
|
||||
svm_set_iret_intercept(svm);
|
||||
/*
|
||||
* No need to manually track NMI masking when vNMI is enabled, hardware
|
||||
* automatically sets V_NMI_BLOCKING_MASK as appropriate, including the
|
||||
* case where software directly injects an NMI.
|
||||
*/
|
||||
if (!is_vnmi_enabled(svm)) {
|
||||
svm->nmi_masked = true;
|
||||
svm_set_iret_intercept(svm);
|
||||
}
|
||||
++vcpu->stat.nmi_injections;
|
||||
}
|
||||
|
||||
@@ -5079,6 +5086,13 @@ static __init void svm_set_cpu_caps(void)
|
||||
kvm_cpu_cap_set(X86_FEATURE_SVM);
|
||||
kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
|
||||
|
||||
/*
|
||||
* KVM currently flushes TLBs on *every* nested SVM transition,
|
||||
* and so for all intents and purposes KVM supports flushing by
|
||||
* ASID, i.e. KVM is guaranteed to honor every L1 ASID flush.
|
||||
*/
|
||||
kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
|
||||
|
||||
if (nrips)
|
||||
kvm_cpu_cap_set(X86_FEATURE_NRIPS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user