arm64/vmm: Implement vm_disable_vcpu_creation()

No functional change intended.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D45556
This commit is contained in:
Mark Johnston 2024-06-13 20:16:28 -04:00
parent b16b4c22d2
commit a03354b002
2 changed files with 11 additions and 1 deletions

View File

@ -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);

View File

@ -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);