acrn-dm: implement cpu_affinity command line argument

User has a chance to specify VCPU affinity through acrn-dm command line
argument. Examples of the command line:

3 PCPUs: 1/2/3
--cpu_affinity 1-3

5 PCPUs: 2/3/6/7/8
--cpu_affinity 2,3,6-8

8 PCPUs: 2/3/6/7/9/10/11/12
--cpu_affinity 2,3,6-7,9,10-12

The specified pCPUs must be included in the guest VM's statically
defined vm_config[].cpu_affinity_bitmap.

Tracked-On: #4616
Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Zide Chen
2020-01-21 14:53:21 -08:00
committed by wenlingz
parent 3691e305c0
commit 71bdc27a0f
3 changed files with 87 additions and 0 deletions

View File

@@ -164,6 +164,7 @@ usage(int code)
#endif
" --vsbl: vsbl file path\n"
" --ovmf: ovmf file path\n"
" --pcpu_list: list of pCPUs assigned to this VM\n"
" --part_info: guest partition info file path\n"
" --enable_trusty: enable trusty for guest\n"
" --debugexit: enable debug exit function\n"
@@ -718,6 +719,7 @@ sig_handler_term(int signo)
enum {
CMD_OPT_VSBL = 1000,
CMD_OPT_OVMF,
CMD_OPT_PCPU_LIST,
CMD_OPT_PART_INFO,
CMD_OPT_TRUSTY_ENABLE,
CMD_OPT_VIRTIO_POLL_ENABLE,
@@ -757,6 +759,7 @@ static struct option long_options[] = {
#endif
{"vsbl", required_argument, 0, CMD_OPT_VSBL},
{"ovmf", required_argument, 0, CMD_OPT_OVMF},
{"pcpu_list", required_argument, 0, CMD_OPT_PCPU_LIST},
{"part_info", required_argument, 0, CMD_OPT_PART_INFO},
{"enable_trusty", no_argument, 0,
CMD_OPT_TRUSTY_ENABLE},
@@ -874,6 +877,10 @@ main(int argc, char *argv[])
errx(EX_USAGE, "invalid ovmf param %s", optarg);
skip_pci_mem64bar_workaround = true;
break;
case CMD_OPT_PCPU_LIST:
if (acrn_parse_pcpu_list(optarg) != 0)
errx(EX_USAGE, "invalid pcpu param %s", optarg);
break;
case CMD_OPT_PART_INFO:
if (acrn_parse_guest_part_info(optarg) != 0) {
errx(EX_USAGE,