Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/nvmm Provide the hardware error code for NVMM_EXIT_I...



details:   https://anonhg.NetBSD.org/src/rev/e6f12eebe8e0
branches:  trunk
changeset: 841018:e6f12eebe8e0
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Apr 24 18:19:28 2019 +0000

description:
Provide the hardware error code for NVMM_EXIT_INVALID, useful when
debugging.

diffstat:

 sys/dev/nvmm/nvmm.h             |   7 ++++++-
 sys/dev/nvmm/x86/nvmm_x86_svm.c |  13 ++++++++++---
 sys/dev/nvmm/x86/nvmm_x86_vmx.c |  13 ++++++++++---
 3 files changed, 26 insertions(+), 7 deletions(-)

diffs (110 lines):

diff -r 660e9f5d95ba -r e6f12eebe8e0 sys/dev/nvmm/nvmm.h
--- a/sys/dev/nvmm/nvmm.h       Wed Apr 24 17:27:08 2019 +0000
+++ b/sys/dev/nvmm/nvmm.h       Wed Apr 24 18:19:28 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm.h,v 1.5 2019/03/21 20:21:40 maxv Exp $    */
+/*     $NetBSD: nvmm.h,v 1.6 2019/04/24 18:19:28 maxv Exp $    */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -103,6 +103,10 @@
        uint64_t npc;
 };
 
+struct nvmm_exit_invalid {
+       uint64_t hwcode;
+};
+
 struct nvmm_exit {
        enum nvmm_exit_reason reason;
        union {
@@ -110,6 +114,7 @@
                struct nvmm_exit_io io;
                struct nvmm_exit_msr msr;
                struct nvmm_exit_insn insn;
+               struct nvmm_exit_invalid inv;
        } u;
        uint64_t exitstate[8];
 };
diff -r 660e9f5d95ba -r e6f12eebe8e0 sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Apr 24 17:27:08 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Apr 24 18:19:28 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.39 2019/04/20 08:45:30 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.40 2019/04/24 18:19:28 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.39 2019/04/20 08:45:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.40 2019/04/24 18:19:28 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1118,6 +1118,13 @@
        svm_inject_gp(mach, vcpu);
 }
 
+static void
+svm_exit_invalid(struct nvmm_exit *exit, uint64_t code)
+{
+       exit->u.inv.hwcode = code;
+       exit->reason = NVMM_EXIT_INVALID;
+}
+
 /* -------------------------------------------------------------------------- */
 
 static void
@@ -1364,7 +1371,7 @@
                        break;
                case VMCB_EXITCODE_FERR_FREEZE: /* ? */
                default:
-                       exit->reason = NVMM_EXIT_INVALID;
+                       svm_exit_invalid(exit, vmcb->ctrl.exitcode);
                        break;
                }
 
diff -r 660e9f5d95ba -r e6f12eebe8e0 sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Wed Apr 24 17:27:08 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Wed Apr 24 18:19:28 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.26 2019/04/20 08:45:30 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.27 2019/04/24 18:19:28 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.26 2019/04/20 08:45:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.27 2019/04/24 18:19:28 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1623,6 +1623,13 @@
        exit->u.mem.inst_len = 0;
 }
 
+static void
+vmx_exit_invalid(struct nvmm_exit *exit, uint64_t code)
+{
+       exit->u.inv.hwcode = code;
+       exit->reason = NVMM_EXIT_INVALID;
+}
+
 /* -------------------------------------------------------------------------- */
 
 static void
@@ -1917,7 +1924,7 @@
                        exit->reason = NVMM_EXIT_NMI_READY;
                        break;
                default:
-                       exit->reason = NVMM_EXIT_INVALID;
+                       vmx_exit_invalid(exit, exitcode);
                        break;
                }
 



Home | Main Index | Thread Index | Old Index