DM: Enable vsbl boot path.

There are two things here:
1. Enable basic vsbl boot functionality.
2. add long option to DM to specific vsbl file. So DM could
   choice to boot guest with vsbl.

It's hard to find a suitable short option. So only long option
is supported for vsbl file name option.

If long option "--vsbl='vsbl_file_name'" is given in DM
commandline, the "vsbl_file_name" will be loaded by DM
first and running. vsbl will be response to lead guest to
next boot stage.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yin Fengwei
2018-03-21 15:13:02 +08:00
committed by Jack Ren
parent 860c2cab3e
commit 1e13533ec0
5 changed files with 313 additions and 4 deletions

View File

@@ -46,6 +46,7 @@
#include "types.h"
#include "vmm.h"
#include "vmmapi.h"
#include "sw_load.h"
#include "cpuset.h"
#include "dm.h"
#include "acpi.h"
@@ -72,6 +73,7 @@ char *vmname;
int guest_ncpus;
char *guest_uuid_str;
char *vsbl_file_name;
bool stdio_in_use;
static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
@@ -125,7 +127,8 @@ usage(int code)
{
fprintf(stderr,
"Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n"
" %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] <vm>\n"
" %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] \n"
" %*s [--vsbl vsbl_file_name] <vm>\n"
" -a: local apic is in xAPIC mode (deprecated)\n"
" -A: create ACPI tables\n"
" -c: # cpus (default 1)\n"
@@ -150,8 +153,9 @@ usage(int code)
" -k: kernel image path\n"
" -r: ramdisk image path\n"
" -B: bootargs for kernel\n"
" -v: version\n",
progname, (int)strlen(progname), "");
" -v: version\n"
" --vsbl: vsbl file path\n",
progname, (int)strlen(progname), "", (int)strlen(progname), "");
exit(code);
}
@@ -545,6 +549,10 @@ sig_handler_term(int signo)
mevent_notify();
}
enum {
CMD_OPT_VSBL = 1000,
};
static struct option long_options[] = {
{"no_x2apic_mode", no_argument, 0, 'a' },
{"acpi", no_argument, 0, 'A' },
@@ -573,6 +581,9 @@ static struct option long_options[] = {
{"version", no_argument, 0, 'v' },
{"gvtargs", required_argument, 0, 'G' },
{"help", no_argument, 0, 'h' },
/* Following cmd option only has long option */
{"vsbl", required_argument, 0, CMD_OPT_VSBL},
{0, 0, 0, 0 },
};
@@ -707,6 +718,12 @@ main(int argc, char *argv[])
case 'v':
print_version();
break;
case CMD_OPT_VSBL:
if (acrn_parse_vsbl(optarg) != 0) {
errx(EX_USAGE, "invalid vsbl param %s", optarg);
exit(1);
}
break;
case 'h':
usage(0);
default: