mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
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. -----BEGIN PGP SIGNATURE----- iQJGBAABCgAwFiEEMHr+pfEFOIzK+KY1YJEiAU0MEvkFAmWW/9ESHHNlYW5qY0Bn b29nbGUuY29tAAoJEGCRIgFNDBL50PcP/Rbdf/68/g1m4JQYl8rf2h7BD4PGE5yw ZpeXSkeZmzyRYPiJjJaZLcvvezyusIPoGRfmsKgj2nI7LCSVyHDmaHVp2h854Xz8 kSWmK5znBYDx+vUqhIKEN2nwFNYSUaSqcRZWvoXi0BzalWlwCgK2yu8xeRDUhn4B +gDKlqZuJMYY1J3V8e64ZkvdxRHsw0WyvD0Ns4EgCe/2v5V9gc08a7vuSq80EtaE yf0cZmubDwuV96LfZnDkZnZpm4C1GNeLxAN1wlj7J6fAvrCAggetDtkJtWCd8yd0 0ZtfjBOMVsCDWQsYXbwGGKdeynzATxc354k6yHBIO863z+M5MtEMKlFNCclrakMO RHfofZHhL+hn3ACESJPcse3ei0VbV28cL2NFdstUEukvZQoacIH9fz7+1GuWqBpv Vb9UJDde029HHsGf+n8LtfQsqV7/8aLV+/4bpiPOHQU+tzAJVxni/H9nJ+7V0lxd NfhWME1lEsQWxpBpcXcVB7D7+ri1Wd9eB4IR9xc/VqgLE1Nj4kIZqtOJF9lbY3wk +H/Ze/MNNg6E9yIErSIv7sWdrvoOPYWZdGCT8Fhm4OILAsDEO96z7WoVF0eWCdJ1 xDIFGXNFuyIpVOqk/JZE/Lv5U1C4xhyFQCmk6gXDgepnTn4d8gx3S79iUfXD32gE GqAjV9Wwmz+o =mXEf -----END PGP SIGNATURE----- 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:
commit
8c9244af4d
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user