diff options
author | Dave Voutila <dv@cvs.openbsd.org> | 2022-05-13 18:19:33 +0000 |
---|---|---|
committer | Dave Voutila <dv@cvs.openbsd.org> | 2022-05-13 18:19:33 +0000 |
commit | 5bdc0eb34979abca9000d2de69d909e978416c8c (patch) | |
tree | 1f7cb9e2c1973ac4f499a1ddba8d3ea0b65c16c8 /sys/arch | |
parent | af8c1c71b7aeef5ae85c284ba9b1ce2291dd2828 (diff) |
vmm: add additional fault type, fixing vm receive
After vmm(4)/vmd(8) "receive" a vm via vmctl(8), vmd on Intel hosts
was incorrectly identifying the fault type for nested page fault
exits and resetting the vm. This commit adds a new fault type to
signify the page fault was serviced in vmm and any exit to userland
does not require an assist.
ok mlarkin@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 12 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 090feb6623a..2784aaf654f 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.308 2022/05/04 02:24:26 dv Exp $ */ +/* $OpenBSD: vmm.c,v 1.309 2022/05/13 18:19:32 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -5732,14 +5732,16 @@ vmx_fault_page(struct vcpu *vcpu, paddr_t gpa) int fault_type, ret; fault_type = vmx_get_guest_faulttype(); - if (fault_type == -1) { + switch (fault_type) { + case -1: printf("%s: invalid fault type\n", __func__); return (EINVAL); - } - - if (fault_type == VM_FAULT_PROTECT) { + case VM_FAULT_PROTECT: vcpu->vc_exit.vee.vee_fault_type = VEE_FAULT_PROTECT; return (EAGAIN); + default: + vcpu->vc_exit.vee.vee_fault_type = VEE_FAULT_HANDLED; + break; } /* We may sleep during uvm_fault(9), so reload VMCS. */ diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index f798674dd0f..42b811a2e42 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.75 2022/05/03 21:39:19 dv Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.76 2022/05/13 18:19:32 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -324,7 +324,8 @@ enum { }; enum { - VEE_FAULT_PROTECT + VEE_FAULT_HANDLED, + VEE_FAULT_PROTECT, }; enum { |