diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-04-28 07:44:37 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-04-28 07:44:37 +0000 |
commit | 88461eb3949700079c8bd4bc3db46d6a263c3bcd (patch) | |
tree | 5a9e66b9a420f0387a0fd2c99d9c9c788379d8e8 /sys | |
parent | d35b6b9f0b2ab4833aab1bdaab5dbfb27351ed1e (diff) |
vmm: don't use invvpid if we didn't detect vpid capability during
vcpu setup
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 16 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 3 |
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index b98c2f080d6..d3954f8912b 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $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> * @@ -2055,8 +2055,10 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, struct vcpu_reg_state *vrs) 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) @@ -3565,10 +3567,12 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp) } } - /* 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(); diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index fcc0224171a..b3d6ec39622 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $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> * @@ -704,6 +704,7 @@ struct vcpu { 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; |