From 8347a0eb0bc1902e1616b1edbda0d7ad7c794159 Mon Sep 17 00:00:00 2001 From: dv Date: Tue, 18 May 2021 00:05:20 +0000 Subject: [PATCH] vmm(4): add more specific error messages for vm-entry failures To aid vmx debugging, specify if the error was related to vmresume or vmlaunch. For vm-entry failures due to failed checks, decode the errors per the SDM Vol. 3C 26.8. --- sys/arch/amd64/amd64/vmm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 7e3ebf8a55f..8ef4a14f85f 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.283 2021/05/17 23:36:40 dv Exp $ */ +/* $OpenBSD: vmm.c,v 1.284 2021/05/18 00:05:20 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -4882,8 +4882,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp) #endif /* VMM_DEBUG */ ret = EINVAL; } else { - printf("%s: failed launch for unknown reason %d\n", - __func__, ret); + printf("%s: failed %s for unknown reason %d\n", + __func__, resume ? "vmresume" : "vmlaunch", ret); #ifdef VMM_DEBUG vmx_vcpu_dump_regs(vcpu); dump_vcpu(vcpu); @@ -7596,6 +7596,9 @@ vmx_instruction_error_decode(uint32_t code) case 20: return "VMCALL: invalid VM exit control fields"; case 26: return "VM entry: blocked by MOV SS"; case 28: return "Invalid operand to INVEPT/INVVPID"; + case 0x80000021: return "VM entry: invalid guest state"; + case 0x80000022: return "VM entry: failure due to MSR loading"; + case 0x80000029: return "VM entry: machine-check event"; default: return "unknown"; } } -- 2.20.1