dm: cmdline: remove unused parameters
Remove unused parameters for acrn-dm Tracked-On: #1616 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
4261ca223e
commit
3010718d4a
|
@ -121,7 +121,6 @@ SRCS += core/console.c
|
|||
SRCS += core/inout.c
|
||||
SRCS += core/mem.c
|
||||
SRCS += core/post.c
|
||||
SRCS += core/consport.c
|
||||
SRCS += core/vmmapi.c
|
||||
SRCS += core/mptbl.c
|
||||
SRCS += core/main.c
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2011 NetApp, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inout.h"
|
||||
#include "lpc.h"
|
||||
|
||||
#define BVM_CONSOLE_PORT 0x220
|
||||
#define BVM_CONS_SIG ('b' << 8 | 'v')
|
||||
|
||||
static bool bvmcons_enabled = false;
|
||||
static struct termios tio_orig, tio_new;
|
||||
|
||||
static void
|
||||
ttyclose(void)
|
||||
{
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig);
|
||||
}
|
||||
|
||||
static void
|
||||
ttyopen(void)
|
||||
{
|
||||
tcgetattr(STDIN_FILENO, &tio_orig);
|
||||
|
||||
cfmakeraw(&tio_new);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &tio_new);
|
||||
|
||||
atexit(ttyclose);
|
||||
}
|
||||
|
||||
static bool
|
||||
tty_char_available(void)
|
||||
{
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
if (select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv) > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
ttyread(void)
|
||||
{
|
||||
char rb;
|
||||
|
||||
if (tty_char_available()) {
|
||||
if (read(STDIN_FILENO, &rb, 1) > 0)
|
||||
return (rb & 0xff);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ttywrite(unsigned char wb)
|
||||
{
|
||||
if (write(STDOUT_FILENO, &wb, 1) > 0)
|
||||
return 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
console_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
|
||||
uint32_t *eax, void *arg)
|
||||
{
|
||||
static int opened;
|
||||
|
||||
if (bytes == 2 && in) {
|
||||
*eax = BVM_CONS_SIG;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Guests might probe this port to look for old ISA devices
|
||||
* using single-byte reads. Return 0xff for those.
|
||||
*/
|
||||
if (bytes == 1 && in) {
|
||||
*eax = 0xff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bytes != 4)
|
||||
return -1;
|
||||
|
||||
if (!opened) {
|
||||
ttyopen();
|
||||
opened = 1;
|
||||
}
|
||||
|
||||
if (in)
|
||||
*eax = ttyread();
|
||||
else
|
||||
ttywrite(*eax);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYSRES_IO(BVM_CONSOLE_PORT, 4);
|
||||
|
||||
static struct inout_port consport = {
|
||||
"bvmcons",
|
||||
BVM_CONSOLE_PORT,
|
||||
1,
|
||||
IOPORT_F_INOUT,
|
||||
console_handler
|
||||
};
|
||||
|
||||
void
|
||||
enable_bvmcons(void)
|
||||
{
|
||||
bvmcons_enabled = true;
|
||||
}
|
||||
|
||||
int
|
||||
init_bvmcons(void)
|
||||
{
|
||||
if (bvmcons_enabled)
|
||||
register_inout(&consport);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
deinit_bvmcons(void)
|
||||
{
|
||||
if (bvmcons_enabled)
|
||||
unregister_inout(&consport);
|
||||
}
|
|
@ -85,11 +85,8 @@ uint8_t trusty_enabled;
|
|||
bool stdio_in_use;
|
||||
|
||||
static int virtio_msix = 1;
|
||||
static int x2apic_mode; /* default is xAPIC */
|
||||
static bool debugexit_enabled;
|
||||
|
||||
static int strictmsr = 1;
|
||||
|
||||
static int acpi;
|
||||
|
||||
static char *progname;
|
||||
|
@ -131,28 +128,20 @@ static void
|
|||
usage(int code)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-abehuwxACHPSTWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n"
|
||||
"Usage: %s [-hAEWY] [-c vcpus] [-l <lpc>]\n"
|
||||
" %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] \n"
|
||||
" %*s [--vsbl vsbl_file_name] [--part_info part_info_name]\n"
|
||||
" %*s [--enable_trusty] [--debugexit] <vm>\n"
|
||||
" -a: local apic is in xAPIC mode (deprecated)\n"
|
||||
" -A: create ACPI tables\n"
|
||||
" -b: enable bvmcons\n"
|
||||
" -c: # cpus (default 1)\n"
|
||||
" -C: include guest memory in core file\n"
|
||||
" -E: elf image path\n"
|
||||
" -g: gdb port\n"
|
||||
" -h: help\n"
|
||||
" -l: LPC device configuration\n"
|
||||
" -m: memory size in MB\n"
|
||||
" -p: pin 'vcpu' to 'hostcpu'\n"
|
||||
" -s: <slot,driver,configinfo> PCI slot config\n"
|
||||
" -S: guest memory cannot be swapped\n"
|
||||
" -u: RTC keeps UTC time\n"
|
||||
" -U: uuid\n"
|
||||
" -w: ignore unimplemented MSRs\n"
|
||||
" -W: force virtio to use single-vector MSI\n"
|
||||
" -x: local apic is in x2APIC mode\n"
|
||||
" -Y: disable MPtable generation\n"
|
||||
" -k: kernel image path\n"
|
||||
" -r: ramdisk image path\n"
|
||||
|
@ -445,7 +434,6 @@ vm_init_vdevs(struct vmctx *ctx)
|
|||
goto vpit_fail;
|
||||
|
||||
sci_init(ctx);
|
||||
init_bvmcons();
|
||||
|
||||
if (debugexit_enabled)
|
||||
init_debugexit();
|
||||
|
@ -466,7 +454,6 @@ monitor_fail:
|
|||
if (debugexit_enabled)
|
||||
deinit_debugexit();
|
||||
|
||||
deinit_bvmcons();
|
||||
vpit_deinit(ctx);
|
||||
vpit_fail:
|
||||
vrtc_deinit(ctx);
|
||||
|
@ -487,7 +474,6 @@ vm_deinit_vdevs(struct vmctx *ctx)
|
|||
if (debugexit_enabled)
|
||||
deinit_debugexit();
|
||||
|
||||
deinit_bvmcons();
|
||||
vpit_deinit(ctx);
|
||||
vrtc_deinit(ctx);
|
||||
ioc_deinit(ctx);
|
||||
|
@ -715,24 +701,16 @@ enum {
|
|||
};
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"no_x2apic_mode", no_argument, 0, 'a' },
|
||||
{"acpi", no_argument, 0, 'A' },
|
||||
{"bvmcons", no_argument, 0, 'b' },
|
||||
{"pincpu", required_argument, 0, 'p' },
|
||||
{"ncpus", required_argument, 0, 'c' },
|
||||
{"memflags_incore", no_argument, 0, 'C' },
|
||||
{"elf_file", required_argument, 0, 'E' },
|
||||
{"gdb_port", required_argument, 0, 'g' },
|
||||
{"ioc node", required_argument, 0, 'i' },
|
||||
{"ioc_node", required_argument, 0, 'i' },
|
||||
{"lpc", required_argument, 0, 'l' },
|
||||
{"pci_slot", required_argument, 0, 's' },
|
||||
{"memflags_wired", no_argument, 0, 'S' },
|
||||
{"memsize", required_argument, 0, 'm' },
|
||||
{"rtc_localtime", no_argument, 0, 'u' },
|
||||
{"uuid", required_argument, 0, 'U' },
|
||||
{"strictmsr", no_argument, 0, 'w' },
|
||||
{"virtio_msix", no_argument, 0, 'W' },
|
||||
{"x2apic_mode", no_argument, 0, 'x' },
|
||||
{"mptgen", no_argument, 0, 'Y' },
|
||||
{"kernel", required_argument, 0, 'k' },
|
||||
{"ramdisk", required_argument, 0, 'r' },
|
||||
|
@ -756,23 +734,21 @@ static struct option long_options[] = {
|
|||
{0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static char optstr[] = "abhuwxACSWYvE:k:r:B:p:g:c:s:m:l:U:G:i:";
|
||||
static char optstr[] = "hAWYvE:k:r:B:p:c:s:m:l:U:G:i:";
|
||||
|
||||
int
|
||||
dm_run(int argc, char *argv[])
|
||||
{
|
||||
int c, error, gdb_port, err;
|
||||
int max_vcpus, mptgen, memflags;
|
||||
int c, error, err;
|
||||
int max_vcpus, mptgen;
|
||||
struct vmctx *ctx;
|
||||
size_t memsize;
|
||||
int option_idx = 0;
|
||||
|
||||
progname = basename(argv[0]);
|
||||
gdb_port = 0;
|
||||
guest_ncpus = 1;
|
||||
memsize = 256 * MB;
|
||||
mptgen = 1;
|
||||
memflags = 0;
|
||||
quit_vm_loop = 0;
|
||||
|
||||
if (signal(SIGHUP, sig_handler_term) == SIG_ERR)
|
||||
|
@ -783,15 +759,9 @@ dm_run(int argc, char *argv[])
|
|||
while ((c = getopt_long(argc, argv, optstr, long_options,
|
||||
&option_idx)) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
x2apic_mode = 0;
|
||||
break;
|
||||
case 'A':
|
||||
acpi = 1;
|
||||
break;
|
||||
case 'b':
|
||||
enable_bvmcons();
|
||||
break;
|
||||
case 'p':
|
||||
if (pincpu_parse(optarg) != 0) {
|
||||
errx(EX_USAGE,
|
||||
|
@ -802,19 +772,12 @@ dm_run(int argc, char *argv[])
|
|||
case 'c':
|
||||
guest_ncpus = atoi(optarg);
|
||||
break;
|
||||
case 'C':
|
||||
memflags |= VM_MEM_F_INCORE;
|
||||
break;
|
||||
case 'E':
|
||||
if (acrn_parse_elf(optarg) != 0)
|
||||
exit(1);
|
||||
else
|
||||
break;
|
||||
break;
|
||||
case 'g':
|
||||
gdb_port = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
ioc_parse(optarg);
|
||||
break;
|
||||
|
@ -831,29 +794,17 @@ dm_run(int argc, char *argv[])
|
|||
exit(1);
|
||||
else
|
||||
break;
|
||||
case 'S':
|
||||
memflags |= VM_MEM_F_WIRED;
|
||||
break;
|
||||
case 'm':
|
||||
error = vm_parse_memsize(optarg, &memsize);
|
||||
if (error)
|
||||
errx(EX_USAGE, "invalid memsize '%s'", optarg);
|
||||
break;
|
||||
case 'u':
|
||||
vrtc_enable_localtime(0);
|
||||
break;
|
||||
case 'U':
|
||||
guest_uuid_str = optarg;
|
||||
break;
|
||||
case 'w':
|
||||
strictmsr = 0;
|
||||
break;
|
||||
case 'W':
|
||||
virtio_msix = 0;
|
||||
break;
|
||||
case 'x':
|
||||
x2apic_mode = 1;
|
||||
break;
|
||||
case 'Y':
|
||||
mptgen = 0;
|
||||
break;
|
||||
|
@ -944,7 +895,6 @@ dm_run(int argc, char *argv[])
|
|||
goto fail;
|
||||
}
|
||||
|
||||
vm_set_memflags(ctx, memflags);
|
||||
err = vm_setup_memory(ctx, memsize);
|
||||
if (err) {
|
||||
fprintf(stderr, "Unable to setup memory (%d)\n", errno);
|
||||
|
@ -958,9 +908,6 @@ dm_run(int argc, char *argv[])
|
|||
goto mevent_fail;
|
||||
}
|
||||
|
||||
if (gdb_port != 0)
|
||||
fprintf(stderr, "dbgport not supported\n");
|
||||
|
||||
if (vm_init_vdevs(ctx) < 0) {
|
||||
fprintf(stderr, "Unable to init vdev (%d)\n", errno);
|
||||
goto dev_fail;
|
||||
|
|
|
@ -120,7 +120,6 @@ vm_create(const char *name, uint64_t req_buf)
|
|||
uuid_copy(create_vm.GUID, vm_uuid);
|
||||
|
||||
ctx->fd = devfd;
|
||||
ctx->memflags = 0;
|
||||
ctx->lowmem_limit = 2 * GB;
|
||||
ctx->name = (char *)(ctx + 1);
|
||||
strcpy(ctx->name, name);
|
||||
|
@ -262,18 +261,6 @@ vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit)
|
|||
ctx->lowmem_limit = limit;
|
||||
}
|
||||
|
||||
void
|
||||
vm_set_memflags(struct vmctx *ctx, int flags)
|
||||
{
|
||||
ctx->memflags = flags;
|
||||
}
|
||||
|
||||
int
|
||||
vm_get_memflags(struct vmctx *ctx)
|
||||
{
|
||||
return ctx->memflags;
|
||||
}
|
||||
|
||||
int
|
||||
vm_map_memseg_vma(struct vmctx *ctx, size_t len, vm_paddr_t gpa,
|
||||
uint64_t vma, int prot)
|
||||
|
|
|
@ -144,7 +144,6 @@ static const int month_days[12] = {
|
|||
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
||||
};
|
||||
|
||||
static int local_time = 1;
|
||||
|
||||
/*
|
||||
* This inline avoids some unnecessary modulo operations
|
||||
|
@ -1064,12 +1063,6 @@ vrtc_reset(struct vrtc *vrtc)
|
|||
pthread_mutex_unlock(&vrtc->mtx);
|
||||
}
|
||||
|
||||
void
|
||||
vrtc_enable_localtime(int l_time)
|
||||
{
|
||||
local_time = l_time;
|
||||
}
|
||||
|
||||
int
|
||||
vrtc_init(struct vmctx *ctx)
|
||||
{
|
||||
|
|
|
@ -76,8 +76,5 @@ int register_inout(struct inout_port *iop);
|
|||
int unregister_inout(struct inout_port *iop);
|
||||
int enable_inout(struct inout_port *iop);
|
||||
int disable_inout(struct inout_port *iop);
|
||||
int init_bvmcons(void);
|
||||
void deinit_bvmcons(void);
|
||||
void enable_bvmcons(void);
|
||||
|
||||
#endif /* _INOUT_H_ */
|
||||
|
|
|
@ -52,7 +52,6 @@ struct vmctx {
|
|||
int vmid;
|
||||
int ioreq_client;
|
||||
uint32_t lowmem_limit;
|
||||
int memflags;
|
||||
size_t lowmem;
|
||||
size_t highmem;
|
||||
char *baseaddr;
|
||||
|
@ -69,17 +68,6 @@ struct vmctx {
|
|||
struct acrn_set_vcpu_regs bsp_regs;
|
||||
};
|
||||
|
||||
/*
|
||||
* 'flags' value passed to 'vm_set_memflags()'.
|
||||
*/
|
||||
#define VM_MEM_F_INCORE 0x01 /* include guest memory in core file */
|
||||
#define VM_MEM_F_WIRED 0x02 /* guest memory is wired */
|
||||
|
||||
#define VM_MEMMAP_F_WIRED 0x01
|
||||
#define VM_MEMMAP_F_IOMMU 0x02
|
||||
|
||||
#define VM_MEMSEG_NAME(m) ((m)->name[0] != '\0' ? (m)->name : NULL)
|
||||
|
||||
#define PROT_RW (PROT_READ | PROT_WRITE)
|
||||
#define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC)
|
||||
|
||||
|
@ -122,8 +110,6 @@ void hugetlb_unsetup_memory(struct vmctx *ctx);
|
|||
void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len);
|
||||
uint32_t vm_get_lowmem_limit(struct vmctx *ctx);
|
||||
void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit);
|
||||
void vm_set_memflags(struct vmctx *ctx, int flags);
|
||||
int vm_get_memflags(struct vmctx *ctx);
|
||||
size_t vm_get_lowmem_size(struct vmctx *ctx);
|
||||
size_t vm_get_highmem_size(struct vmctx *ctx);
|
||||
int vm_run(struct vmctx *ctx);
|
||||
|
|
Loading…
Reference in New Issue