From 16ad062d1a7c6763f88b46776fd8ee1a21cf6158 Mon Sep 17 00:00:00 2001 From: Conghui Chen Date: Fri, 30 Aug 2019 13:38:59 +0000 Subject: [PATCH] dm: remove guest cpu number option Remove the guest cpu number option '-c', as the guest cpu number is defined in hypervisor vm configuration file, and the number can be return by vm_create(). Tracked-On: #3663 Signed-off-by: Conghui Chen Acked-by: Yin Fengwei Acked-by: Eddie Dong --- devicemodel/core/main.c | 16 +++++----------- devicemodel/include/dm.h | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 04994c5b2..989b2d078 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -77,7 +77,6 @@ typedef void (*vmexit_handler_t)(struct vmctx *, char *vmname; -int guest_ncpus; char *guest_uuid_str; char *vsbl_file_name; char *ovmf_file_name; @@ -90,6 +89,7 @@ bool lapic_pt; bool is_rtvm; bool skip_pci_mem64bar_workaround = false; +static int guest_ncpus; static int virtio_msix = 1; static bool debugexit_enabled; static char mac_seed_str[50]; @@ -132,7 +132,7 @@ static void usage(int code) { fprintf(stderr, - "Usage: %s [-hAWYv] [-B bootargs] [-c vcpus] [-E elf_image_path]\n" + "Usage: %s [-hAWYv] [-B bootargs] [-E elf_image_path]\n" " %*s [-G GVT_args] [-i ioc_mediator_parameters] [-k kernel_image_path]\n" " %*s [-l lpc] [-m mem] [-r ramdisk_image_path]\n" " %*s [-s pci] [-U uuid] [--vsbl vsbl_file_name] [--ovmf ovmf_file_path]\n" @@ -143,7 +143,6 @@ usage(int code) " %*s [--pm_by_vuart vuart_node] \n" " -A: create ACPI tables\n" " -B: bootargs for kernel\n" - " -c: # cpus (default 1)\n" " -E: elf image path\n" " -G: GVT args: low_gm_size, high_gm_size, fence_sz\n" " -h: help\n" @@ -247,12 +246,12 @@ start_thread(void *param) } static int -add_cpu(struct vmctx *ctx, int guest_ncpus) +add_cpu(struct vmctx *ctx, int vcpu_num) { int i; int error; - for (i = 0; i < guest_ncpus; i++) { + for (i = 0; i < vcpu_num; i++) { error = vm_create_vcpu(ctx, (uint16_t)i); if (error != 0) { fprintf(stderr, "ERROR: could not create VCPU %d\n", i); @@ -735,7 +734,6 @@ enum { static struct option long_options[] = { {"acpi", no_argument, 0, 'A' }, - {"ncpus", required_argument, 0, 'c' }, {"elf_file", required_argument, 0, 'E' }, {"ioc_node", required_argument, 0, 'i' }, {"lpc", required_argument, 0, 'l' }, @@ -774,7 +772,7 @@ static struct option long_options[] = { {0, 0, 0, 0 }, }; -static char optstr[] = "hAWYvE:k:r:B:p:c:s:m:l:U:G:i:"; +static char optstr[] = "hAWYvE:k:r:B:p:s:m:l:U:G:i:"; int main(int argc, char *argv[]) @@ -786,7 +784,6 @@ main(int argc, char *argv[]) int option_idx = 0; progname = basename(argv[0]); - guest_ncpus = 1; memsize = 256 * MB; mptgen = 1; @@ -808,9 +805,6 @@ main(int argc, char *argv[]) case 'A': acpi = 1; break; - case 'c': - dm_strtoi(optarg, NULL, 0, &guest_ncpus); - break; case 'E': if (acrn_parse_elf(optarg) != 0) exit(1); diff --git a/devicemodel/include/dm.h b/devicemodel/include/dm.h index c9e4f987a..7bea234f9 100644 --- a/devicemodel/include/dm.h +++ b/devicemodel/include/dm.h @@ -37,7 +37,6 @@ #define MAX_VMNAME_LEN 128U struct vmctx; -extern int guest_ncpus; extern char *guest_uuid_str; extern uint8_t trusty_enabled; extern char *vsbl_file_name;