|
@@ -4140,9 +4140,10 @@ static void exit_lmode(struct kvm_vcpu *vcpu)
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid)
|
|
|
+static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid,
|
|
|
+ bool invalidate_gpa)
|
|
|
{
|
|
|
- if (enable_ept) {
|
|
|
+ if (enable_ept && (invalidate_gpa || !enable_vpid)) {
|
|
|
if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
|
|
|
return;
|
|
|
ept_sync_context(construct_eptp(vcpu, vcpu->arch.mmu.root_hpa));
|
|
@@ -4151,15 +4152,15 @@ static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void vmx_flush_tlb(struct kvm_vcpu *vcpu)
|
|
|
+static void vmx_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa)
|
|
|
{
|
|
|
- __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid);
|
|
|
+ __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid, invalidate_gpa);
|
|
|
}
|
|
|
|
|
|
static void vmx_flush_tlb_ept_only(struct kvm_vcpu *vcpu)
|
|
|
{
|
|
|
if (enable_ept)
|
|
|
- vmx_flush_tlb(vcpu);
|
|
|
+ vmx_flush_tlb(vcpu, true);
|
|
|
}
|
|
|
|
|
|
static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu)
|
|
@@ -4357,7 +4358,7 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
|
|
|
ept_load_pdptrs(vcpu);
|
|
|
}
|
|
|
|
|
|
- vmx_flush_tlb(vcpu);
|
|
|
+ vmx_flush_tlb(vcpu, true);
|
|
|
vmcs_writel(GUEST_CR3, guest_cr3);
|
|
|
}
|
|
|
|
|
@@ -7932,7 +7933,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
}
|
|
|
|
|
|
- __vmx_flush_tlb(vcpu, vmx->nested.vpid02);
|
|
|
+ __vmx_flush_tlb(vcpu, vmx->nested.vpid02, true);
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
@@ -10614,11 +10615,11 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
|
|
|
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
|
|
|
if (vmcs12->virtual_processor_id != vmx->nested.last_vpid) {
|
|
|
vmx->nested.last_vpid = vmcs12->virtual_processor_id;
|
|
|
- __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
|
|
|
+ __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02, true);
|
|
|
}
|
|
|
} else {
|
|
|
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
|
|
|
- vmx_flush_tlb(vcpu);
|
|
|
+ vmx_flush_tlb(vcpu, true);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -11323,7 +11324,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
|
|
|
* L1's vpid. TODO: move to a more elaborate solution, giving
|
|
|
* each L2 its own vpid and exposing the vpid feature to L1.
|
|
|
*/
|
|
|
- vmx_flush_tlb(vcpu);
|
|
|
+ vmx_flush_tlb(vcpu, true);
|
|
|
}
|
|
|
/* Restore posted intr vector. */
|
|
|
if (nested_cpu_has_posted_intr(vmcs12))
|