2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
2018-08-13 19:52:54 +08:00
|
|
|
#ifndef SHELL_PRIV_H
|
|
|
|
#define SHELL_PRIV_H
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2021-04-23 15:50:57 +08:00
|
|
|
#include <asm/lib/spinlock.h>
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-07-03 11:51:27 +08:00
|
|
|
#define SHELL_CMD_MAX_LEN 100U
|
2018-12-03 09:15:28 +08:00
|
|
|
#define SHELL_STRING_MAX_LEN (PAGE_SIZE << 2U)
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2019-04-20 06:30:15 +08:00
|
|
|
extern int16_t console_vmid;
|
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
/* Shell Command Function */
|
2018-12-08 00:30:49 +08:00
|
|
|
typedef int32_t (*shell_cmd_fn_t)(int32_t argc, char **argv);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
/* Shell Command */
|
|
|
|
struct shell_cmd {
|
|
|
|
char *str; /* Command string */
|
|
|
|
char *cmd_param; /* Command parameter string */
|
|
|
|
char *help_str; /* Help text associated with the command */
|
|
|
|
shell_cmd_fn_t fcn; /* Command call-back function */
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-08-13 19:52:54 +08:00
|
|
|
/* Shell Control Block */
|
|
|
|
struct shell {
|
|
|
|
char input_line[2][SHELL_CMD_MAX_LEN + 1U]; /* current & last */
|
|
|
|
uint32_t input_line_len; /* Length of current input line */
|
|
|
|
uint32_t input_line_active; /* Active input line index */
|
2018-10-11 17:13:47 +08:00
|
|
|
struct shell_cmd *cmds; /* cmds supported */
|
2018-08-13 19:52:54 +08:00
|
|
|
uint32_t cmd_count; /* Count of cmds supported */
|
|
|
|
};
|
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
/* Shell Command list with parameters and help description */
|
|
|
|
#define SHELL_CMD_HELP "help"
|
|
|
|
#define SHELL_CMD_HELP_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_HELP_HELP "Display information about supported hypervisor shell commands"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2019-06-20 18:00:24 +08:00
|
|
|
#define SHELL_CMD_VERSION "version"
|
|
|
|
#define SHELL_CMD_VERSION_PARAM NULL
|
|
|
|
#define SHELL_CMD_VERSION_HELP "Display the HV version information"
|
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
#define SHELL_CMD_VM_LIST "vm_list"
|
|
|
|
#define SHELL_CMD_VM_LIST_PARAM NULL
|
2019-04-08 15:08:51 +08:00
|
|
|
#define SHELL_CMD_VM_LIST_HELP "List all VMs, displaying the VM UUID, ID, name and state"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_VCPU_LIST "vcpu_list"
|
|
|
|
#define SHELL_CMD_VCPU_LIST_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_VCPU_LIST_HELP "List all vCPUs in all VMs"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_VCPU_DUMPREG "vcpu_dumpreg"
|
|
|
|
#define SHELL_CMD_VCPU_DUMPREG_PARAM "<vm id, vcpu id>"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_VCPU_DUMPREG_HELP "Dump registers for a specific vCPU"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2019-11-19 17:18:31 +08:00
|
|
|
#define SHELL_CMD_DUMP_HOST_MEM "dump_host_mem"
|
|
|
|
#define SHELL_CMD_DUMP_HOST_MEM_PARAM "<addr, length>"
|
|
|
|
#define SHELL_CMD_DUMP_HOST_MEM_HELP "Dump host memory, starting at a given address(Hex), and for a given length (Dec in bytes)"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2019-11-19 17:25:04 +08:00
|
|
|
#define SHELL_CMD_DUMP_GUEST_MEM "dump_guest_mem"
|
|
|
|
#define SHELL_CMD_DUMP_GUEST_MEM_PARAM "<vm_id, addr, length>"
|
|
|
|
#define SHELL_CMD_DUMP_GUEST_MEM_HELP "Dump guest memory, vm id(Dec), starting at a given address(Hex), and for a given length (Dec in bytes)"
|
|
|
|
|
2019-04-16 06:32:38 +08:00
|
|
|
#define SHELL_CMD_VM_CONSOLE "vm_console"
|
|
|
|
#define SHELL_CMD_VM_CONSOLE_PARAM "<vm id>"
|
|
|
|
#define SHELL_CMD_VM_CONSOLE_HELP "Switch to the VM's console. Use [Ctrl+Spacebar] to return to the ACRN shell "\
|
2019-03-19 19:10:06 +08:00
|
|
|
"console"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_INTERRUPT "int"
|
|
|
|
#define SHELL_CMD_INTERRUPT_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_INTERRUPT_HELP "List interrupt information per CPU"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_PTDEV "pt"
|
|
|
|
#define SHELL_CMD_PTDEV_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_PTDEV_HELP "Show pass-through device information"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-05-17 22:21:13 +08:00
|
|
|
#define SHELL_CMD_REBOOT "reboot"
|
|
|
|
#define SHELL_CMD_REBOOT_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_REBOOT_HELP "Trigger a system reboot (immediately)"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_IOAPIC "dump_ioapic"
|
|
|
|
#define SHELL_CMD_IOAPIC_PARAM NULL
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_IOAPIC_HELP "Show native IOAPIC information"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_VIOAPIC "vioapic"
|
|
|
|
#define SHELL_CMD_VIOAPIC_PARAM "<vm id>"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_VIOAPIC_HELP "Show virtual IOAPIC (vIOAPIC) information for a specific VM"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-08-01 00:20:13 +08:00
|
|
|
#define SHELL_CMD_LOG_LVL "loglevel"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_LOG_LVL_PARAM "[<console_loglevel> [<mem_loglevel> [npk_loglevel]]]"
|
|
|
|
#define SHELL_CMD_LOG_LVL_HELP "No argument: get the level of logging for the console, memory and npk. Set "\
|
|
|
|
"the level by giving (up to) 3 parameters between 0 and 6 (verbose)"
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-04-04 15:28:49 +08:00
|
|
|
#define SHELL_CMD_CPUID "cpuid"
|
|
|
|
#define SHELL_CMD_CPUID_PARAM "<leaf> [subleaf]"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_CPUID_HELP "Display the CPUID leaf [subleaf], in hexadecimal"
|
2019-01-21 19:53:22 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_RDMSR "rdmsr"
|
|
|
|
#define SHELL_CMD_RDMSR_PARAM "[-p<pcpu_id>] <msr_index>"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_RDMSR_HELP "Read the MSR at msr_index (in hexadecimal) for CPU ID pcpu_id"
|
2019-01-21 19:53:22 +08:00
|
|
|
|
|
|
|
#define SHELL_CMD_WRMSR "wrmsr"
|
|
|
|
#define SHELL_CMD_WRMSR_PARAM "[-p<pcpu_id>] <msr_index> <value>"
|
2019-03-19 19:10:06 +08:00
|
|
|
#define SHELL_CMD_WRMSR_HELP "Write value (in hexadecimal) to the MSR at msr_index (in hexadecimal) for CPU"\
|
|
|
|
" ID pcpu_id"
|
2018-08-13 19:52:54 +08:00
|
|
|
#endif /* SHELL_PRIV_H */
|