git: a03354b00238 - main - arm64/vmm: Implement vm_disable_vcpu_creation()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Jun 2024 01:21:20 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=a03354b00238b73568efe225c754cba197393f77
commit a03354b00238b73568efe225c754cba197393f77
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-14 00:16:28 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-14 01:19:00 +0000
arm64/vmm: Implement vm_disable_vcpu_creation()
No functional change intended.
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D45556
---
sys/arm64/include/vmm.h | 1 +
sys/arm64/vmm/vmm.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys/arm64/include/vmm.h b/sys/arm64/include/vmm.h
index c06d2ad947e4..cf00dd60a43f 100644
--- a/sys/arm64/include/vmm.h
+++ b/sys/arm64/include/vmm.h
@@ -127,6 +127,7 @@ struct vm_eventinfo {
int vm_create(const char *name, struct vm **retvm);
struct vcpu *vm_alloc_vcpu(struct vm *vm, int vcpuid);
+void vm_disable_vcpu_creation(struct vm *vm);
void vm_slock_vcpus(struct vm *vm);
void vm_unlock_vcpus(struct vm *vm);
void vm_destroy(struct vm *vm);
diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c
index a2cc63448f19..c6a49ebc4b03 100644
--- a/sys/arm64/vmm/vmm.c
+++ b/sys/arm64/vmm/vmm.c
@@ -141,6 +141,7 @@ struct vm {
volatile cpuset_t active_cpus; /* (i) active vcpus */
volatile cpuset_t debug_cpus; /* (i) vcpus stopped for debug */
int suspend; /* (i) stop VM execution */
+ bool dying; /* (o) is dying */
volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */
volatile cpuset_t halted_cpus; /* (x) cpus in a hard halt */
struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */
@@ -405,6 +406,14 @@ vm_init(struct vm *vm, bool create)
}
}
+void
+vm_disable_vcpu_creation(struct vm *vm)
+{
+ sx_xlock(&vm->vcpus_init_lock);
+ vm->dying = true;
+ sx_xunlock(&vm->vcpus_init_lock);
+}
+
struct vcpu *
vm_alloc_vcpu(struct vm *vm, int vcpuid)
{
@@ -423,7 +432,7 @@ vm_alloc_vcpu(struct vm *vm, int vcpuid)
sx_xlock(&vm->vcpus_init_lock);
vcpu = vm->vcpu[vcpuid];
- if (vcpu == NULL/* && !vm->dying*/) {
+ if (vcpu == NULL && !vm->dying) {
vcpu = vcpu_alloc(vm, vcpuid);
vcpu_init(vcpu);