From 65178f413c1258d59531892a0351b5ab7751cd00 Mon Sep 17 00:00:00 2001 From: dv Date: Sun, 26 Nov 2023 13:02:44 +0000 Subject: [PATCH] vmm(4)/vmx: pass correct vpid value to invvpid. While vmm's use of invvpid in the vmx vcpu run loop is questionable since we require and use EPT, the vpid value is unquestionably wrong in these calls. ok mlarkin@ --- sys/arch/amd64/amd64/vmm_machdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arch/amd64/amd64/vmm_machdep.c b/sys/arch/amd64/amd64/vmm_machdep.c index 5bdb9fc80f0..82decbd3fed 100644 --- a/sys/arch/amd64/amd64/vmm_machdep.c +++ b/sys/arch/amd64/amd64/vmm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm_machdep.c,v 1.10 2023/11/24 21:48:25 dv Exp $ */ +/* $OpenBSD: vmm_machdep.c,v 1.11 2023/11/26 13:02:44 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -4155,7 +4155,7 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp) if (vcpu->vc_vmx_vpid_enabled) { /* Invalidate old TLB mappings */ - vid.vid_vpid = vcpu->vc_parent->vm_id; + vid.vid_vpid = vcpu->vc_vpid; vid.vid_addr = 0; invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid); } @@ -5447,7 +5447,7 @@ vmx_handle_cr0_write(struct vcpu *vcpu, uint64_t r) /* Paging was disabled (prev. enabled) - Flush TLB */ if (vmm_softc->mode == VMM_MODE_EPT && vcpu->vc_vmx_vpid_enabled) { - vid.vid_vpid = vcpu->vc_parent->vm_id; + vid.vid_vpid = vcpu->vc_vpid; vid.vid_addr = 0; invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid); } -- 2.20.1