diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 7de54709b..04994c5b2 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -258,7 +258,6 @@ add_cpu(struct vmctx *ctx, int guest_ncpus) fprintf(stderr, "ERROR: could not create VCPU %d\n", i); return error; } - CPU_SET_ATOMIC(i, &cpumask); mt_vmm_info[i].mt_ctx = ctx; @@ -962,7 +961,7 @@ main(int argc, char *argv[]) for (;;) { pr_notice("vm_create: %s\n", vmname); - ctx = vm_create(vmname, (unsigned long)vhm_req_buf); + ctx = vm_create(vmname, (unsigned long)vhm_req_buf, &guest_ncpus); if (!ctx) { pr_err("vm_create failed"); goto create_fail; diff --git a/devicemodel/core/vmmapi.c b/devicemodel/core/vmmapi.c index 44939761e..0a7b912ec 100644 --- a/devicemodel/core/vmmapi.c +++ b/devicemodel/core/vmmapi.c @@ -87,7 +87,7 @@ check_api(int fd) static int devfd = -1; struct vmctx * -vm_create(const char *name, uint64_t req_buf) +vm_create(const char *name, uint64_t req_buf, int *vcpu_num) { struct vmctx *ctx; struct acrn_create_vm create_vm; @@ -168,6 +168,7 @@ vm_create(const char *name, uint64_t req_buf) goto err; } + *vcpu_num = create_vm.vcpu_num; ctx->vmid = create_vm.vmid; return ctx; diff --git a/devicemodel/include/vmmapi.h b/devicemodel/include/vmmapi.h index 64bb5d134..1eeff5675 100644 --- a/devicemodel/include/vmmapi.h +++ b/devicemodel/include/vmmapi.h @@ -87,7 +87,7 @@ struct vm_isa_irq { * * Returns a pointer to the memory segment on success and MAP_FAILED otherwise. */ -struct vmctx *vm_create(const char *name, uint64_t req_buf); +struct vmctx *vm_create(const char *name, uint64_t req_buf, int* vcpu_num); void vm_pause(struct vmctx *ctx); void vm_reset(struct vmctx *ctx); int vm_create_ioreq_client(struct vmctx *ctx);