-/* $OpenBSD: vmm.c,v 1.135 2017/04/27 06:49:05 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.136 2017/04/28 07:44:36 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED_CTLS,
IA32_VMX_ACTIVATE_SECONDARY_CONTROLS, 1)) {
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED2_CTLS,
- IA32_VMX_ENABLE_VPID, 1))
+ IA32_VMX_ENABLE_VPID, 1)) {
want1 |= IA32_VMX_ENABLE_VPID;
+ vcpu->vc_vmx_vpid_enabled = 1;
+ }
}
if (vmm_softc->mode == VMM_MODE_EPT)
}
}
- /* Invalidate old TLB mappings */
- vid.vid_vpid = vcpu->vc_parent->vm_id;
- vid.vid_addr = 0;
- invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid);
+ if (vcpu->vc_vmx_vpid_enabled) {
+ /* Invalidate old TLB mappings */
+ vid.vid_vpid = vcpu->vc_parent->vm_id;
+ vid.vid_addr = 0;
+ invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid);
+ }
/* Start / resume the VCPU */
KERNEL_ASSERT_LOCKED();
-/* $OpenBSD: vmmvar.h,v 1.34 2017/04/27 07:15:35 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.35 2017/04/28 07:44:36 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
paddr_t vc_vmx_msr_exit_load_pa;
vaddr_t vc_vmx_msr_entry_load_va;
paddr_t vc_vmx_msr_entry_load_pa;
+ uint8_t vc_vmx_vpid_enabled;
/* SVM only */
vaddr_t vc_svm_hsa_va;