hv: Add reboot shell command

To trigger warm reboot for debugging.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
Yin Fengwei 2018-05-17 22:21:13 +08:00 committed by lijinxia
parent 0e5f7cb91c
commit 6ef48fa30e
6 changed files with 40 additions and 0 deletions

View File

@ -117,6 +117,7 @@ C_SRCS += arch/x86/guest/vioapic.c
C_SRCS += arch/x86/guest/instr_emul.c
C_SRCS += arch/x86/guest/ucode.c
C_SRCS += arch/x86/guest/pm.c
C_SRCS += arch/x86/debug/reboot.c
C_SRCS += lib/spinlock.c
C_SRCS += lib/udelay.c
C_SRCS += lib/mdelay.c

View File

@ -0,0 +1,12 @@
/*
* Copyright (C) <2018> Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <acrn_common.h>
#include <io.h>
int warm_reboot(void)
{
io_write_byte(0x6, 0xcf9);
return 0;
}

View File

@ -33,6 +33,7 @@
#include <hv_arch.h>
#include <hv_debug.h>
#include <hypercall.h>
#include <reboot.h>
#include "shell_internal.h"
#include "serial_internal.h"
@ -931,6 +932,12 @@ int shell_show_ptdev_info(struct shell *p_shell,
return 0;
}
int shell_reboot(__unused struct shell *p_shell,
__unused int argc, __unused char **argv)
{
return warm_reboot();
}
int shell_show_req_info(struct shell *p_shell,
__unused int argc, __unused char **argv)
{

View File

@ -117,6 +117,10 @@ struct shell_cmd {
#define SHELL_CMD_PTDEV_PARAM NULL
#define SHELL_CMD_PTDEV_HELP "show pass-through device info"
#define SHELL_CMD_REBOOT "reboot"
#define SHELL_CMD_REBOOT_PARAM NULL
#define SHELL_CMD_REBOOT_HELP "trigger system warm reboot"
#define SHELL_CMD_REQ "lsreq"
#define SHELL_CMD_REQ_PARAM NULL
#define SHELL_CMD_REQ_HELP "show ioreq info"
@ -170,6 +174,7 @@ int shell_trace_cmd(struct shell *p_shell, int argc, char **argv);
int shell_to_sos_console(struct shell *p_shell, int argc, char **argv);
int shell_show_cpu_int(struct shell *p_shell, int argc, char **argv);
int shell_show_ptdev_info(struct shell *p_shell, int argc, char **argv);
int shell_reboot(struct shell *p_shell, int argc, char **argv);
int shell_show_vioapic_info(struct shell *p_shell, int argc, char **argv);
int shell_show_ioapic_info(struct shell *p_shell, int argc, char **argv);
int shell_show_vmexit_profile(struct shell *p_shell, int argc, char **argv);

View File

@ -147,6 +147,12 @@ static struct shell_cmd acrn_cmd[] = {
.help_str = SHELL_CMD_CPUID_HELP,
.fcn = shell_cpuid,
},
{
.str = SHELL_CMD_REBOOT,
.cmd_param = SHELL_CMD_REBOOT_PARAM,
.help_str = SHELL_CMD_REBOOT_HELP,
.fcn = shell_reboot,
},
};
int shell_init(void)

View File

@ -0,0 +1,9 @@
/*
* Copyright (C) <2018> Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef REBOOT_H
#define REBOOT_H
int warm_reboot(void);
#endif