Module Name: src Committed By: maxv Date: Sat Jul 6 05:13:11 UTC 2019
Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/nvmm/nvmm.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/nvmm/nvmm_internal.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/nvmm/nvmm.c diff -u src/sys/dev/nvmm/nvmm.c:1.21 src/sys/dev/nvmm/nvmm.c:1.22 --- src/sys/dev/nvmm/nvmm.c:1.21 Sat May 11 07:31:56 2019 +++ src/sys/dev/nvmm/nvmm.c Sat Jul 6 05:13:10 2019 @@ -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 @@ nvmm_vcpu_free(struct nvmm_machine *mach } } -int +static int nvmm_vcpu_get(struct nvmm_machine *mach, nvmm_cpuid_t cpuid, struct nvmm_cpu **ret) { @@ -192,7 +192,7 @@ nvmm_vcpu_get(struct nvmm_machine *mach, return 0; } -void +static void nvmm_vcpu_put(struct nvmm_cpu *vcpu) { mutex_exit(&vcpu->lock); @@ -513,14 +513,18 @@ out: 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 @@ nvmm_do_vcpu_run(struct nvmm_machine *ma break; } } + + return 0; } static int @@ -549,7 +555,7 @@ nvmm_vcpu_run(struct nvmm_owner *owner, 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: Index: src/sys/dev/nvmm/nvmm_internal.h diff -u src/sys/dev/nvmm/nvmm_internal.h:1.11 src/sys/dev/nvmm/nvmm_internal.h:1.12 --- src/sys/dev/nvmm/nvmm_internal.h:1.11 Wed May 1 09:20:21 2019 +++ src/sys/dev/nvmm/nvmm_internal.h Sat Jul 6 05:13:10 2019 @@ -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_impl { 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;