Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/nvmm Localify two functions that are no longer used ...



details:   https://anonhg.NetBSD.org/src/rev/bbb3effd6dc3
branches:  trunk
changeset: 1000096:bbb3effd6dc3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 06 05:13:10 2019 +0000

description:
Localify two functions that are no longer used outside. Also return the
error from the *_vcpu_run() functions, now that we commit the states in
them (which can fail).

diffstat:

 sys/dev/nvmm/nvmm.c          |  20 +++++++++++++-------
 sys/dev/nvmm/nvmm_internal.h |   5 +----
 2 files changed, 14 insertions(+), 11 deletions(-)

diffs (94 lines):

diff -r b6830b571d77 -r bbb3effd6dc3 sys/dev/nvmm/nvmm.c
--- a/sys/dev/nvmm/nvmm.c       Sat Jul 06 05:05:53 2019 +0000
+++ b/sys/dev/nvmm/nvmm.c       Sat Jul 06 05:13:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm.c,v 1.21 2019/05/11 07:31:56 maxv Exp $   */
+/*     $NetBSD: nvmm.c,v 1.22 2019/07/06 05:13:10 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.21 2019/05/11 07:31:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.22 2019/07/06 05:13:10 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -171,7 +171,7 @@
        }
 }
 
-int
+static int
 nvmm_vcpu_get(struct nvmm_machine *mach, nvmm_cpuid_t cpuid,
     struct nvmm_cpu **ret)
 {
@@ -192,7 +192,7 @@
        return 0;
 }
 
-void
+static void
 nvmm_vcpu_put(struct nvmm_cpu *vcpu)
 {
        mutex_exit(&vcpu->lock);
@@ -513,14 +513,18 @@
        return error;
 }
 
-static void
+static int
 nvmm_do_vcpu_run(struct nvmm_machine *mach, struct nvmm_cpu *vcpu,
     struct nvmm_exit *exit)
 {
        struct vmspace *vm = mach->vm;
+       int ret;
 
        while (1) {
-               (*nvmm_impl->vcpu_run)(mach, vcpu, exit);
+               ret = (*nvmm_impl->vcpu_run)(mach, vcpu, exit);
+               if (__predict_false(ret != 0)) {
+                       return ret;
+               }
 
                if (__predict_true(exit->reason != NVMM_EXIT_MEMORY)) {
                        break;
@@ -532,6 +536,8 @@
                        break;
                }
        }
+
+       return 0;
 }
 
 static int
@@ -549,7 +555,7 @@
        if (error)
                goto out;
 
-       nvmm_do_vcpu_run(mach, vcpu, &args->exit);
+       error = nvmm_do_vcpu_run(mach, vcpu, &args->exit);
        nvmm_vcpu_put(vcpu);
 
 out:
diff -r b6830b571d77 -r bbb3effd6dc3 sys/dev/nvmm/nvmm_internal.h
--- a/sys/dev/nvmm/nvmm_internal.h      Sat Jul 06 05:05:53 2019 +0000
+++ b/sys/dev/nvmm/nvmm_internal.h      Sat Jul 06 05:13:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_internal.h,v 1.11 2019/05/01 09:20:21 maxv Exp $  */
+/*     $NetBSD: nvmm_internal.h,v 1.12 2019/07/06 05:13:10 maxv Exp $  */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -112,9 +112,6 @@
            struct nvmm_exit *);
 };
 
-int nvmm_vcpu_get(struct nvmm_machine *, nvmm_cpuid_t, struct nvmm_cpu **);
-void nvmm_vcpu_put(struct nvmm_cpu *);
-
 extern const struct nvmm_impl nvmm_x86_svm;
 extern const struct nvmm_impl nvmm_x86_vmx;
 



Home | Main Index | Thread Index | Old Index