mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-12 12:30:08 +00:00
DM: add guest vm power manager by vuart
vuart can be used as communication channel between VMs; here vuart used to control vm's power off flow; control command is from SOS to UOS Tracked-On: #3564 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
00401a1e78
commit
eb5a57b780
@@ -63,6 +63,7 @@
|
||||
#include "atomic.h"
|
||||
#include "tpm.h"
|
||||
#include "virtio.h"
|
||||
#include "pm_vuart.h"
|
||||
#include "log.h"
|
||||
|
||||
#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
|
||||
@@ -138,7 +139,8 @@ usage(int code)
|
||||
" %*s [--part_info part_info_name] [--enable_trusty] [--intr_monitor param_setting]\n"
|
||||
" %*s [--vtpm2 sock_path] [--virtio_poll interval] [--mac_seed seed_string]\n"
|
||||
" %*s [--vmcfg sub_options] [--dump vm_idx] [--ptdev_no_reset] [--debugexit] \n"
|
||||
" %*s [--logger-setting param_setting] [--pm_notify_channel] <vm>\n"
|
||||
" %*s [--logger-setting param_setting] [--pm_notify_channel]\n"
|
||||
" %*s [--pm_by_vuart vuart_node] <vm>\n"
|
||||
" -A: create ACPI tables\n"
|
||||
" -B: bootargs for kernel\n"
|
||||
" -c: # cpus (default 1)\n"
|
||||
@@ -173,11 +175,12 @@ usage(int code)
|
||||
" --lapic_pt: enable local apic passthrough\n"
|
||||
" --rtvm: indicate that the guest is rtvm\n"
|
||||
" --logger_setting: params like console,level=4;kmsg,level=3\n"
|
||||
" --pm_notify_channel: define the channel used to notify guest about power event\n",
|
||||
" --pm_notify_channel: define the channel used to notify guest about power event\n"
|
||||
" --pm_by_vuart:pty,/run/acrn/vuart_vmname or tty,/dev/ttySn\n",
|
||||
progname, (int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "",
|
||||
(int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "",
|
||||
(int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "",
|
||||
(int)strnlen(progname, PATH_MAX), "");
|
||||
(int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "");
|
||||
|
||||
exit(code);
|
||||
}
|
||||
@@ -421,6 +424,8 @@ guest_pm_notify_init(struct vmctx *ctx)
|
||||
ioc_init(ctx);
|
||||
else if (PWR_EVENT_NOTIFY_PWR_BT == pm_notify_channel)
|
||||
power_button_init(ctx);
|
||||
else if (PWR_EVENT_NOTIFY_UART == pm_notify_channel)
|
||||
pm_by_vuart_init(ctx);
|
||||
else
|
||||
pr_err("No correct pm notify channel given\n");
|
||||
}
|
||||
@@ -432,6 +437,8 @@ guest_pm_notify_deinit(struct vmctx *ctx)
|
||||
ioc_deinit(ctx);
|
||||
else if (PWR_EVENT_NOTIFY_PWR_BT == pm_notify_channel)
|
||||
power_button_deinit(ctx);
|
||||
else if (PWR_EVENT_NOTIFY_UART == pm_notify_channel)
|
||||
pm_by_vuart_deinit(ctx);
|
||||
else
|
||||
pr_err("No correct pm notify channel given\n");
|
||||
}
|
||||
@@ -724,6 +731,7 @@ enum {
|
||||
CMD_OPT_RTVM,
|
||||
CMD_OPT_LOGGER_SETTING,
|
||||
CMD_OPT_PM_NOTIFY_CHANNEL,
|
||||
CMD_OPT_PM_BY_VUART,
|
||||
};
|
||||
|
||||
static struct option long_options[] = {
|
||||
@@ -763,6 +771,7 @@ static struct option long_options[] = {
|
||||
{"rtvm", no_argument, 0, CMD_OPT_RTVM},
|
||||
{"logger_setting", required_argument, 0, CMD_OPT_LOGGER_SETTING},
|
||||
{"pm_notify_channel", required_argument, 0, CMD_OPT_PM_NOTIFY_CHANNEL},
|
||||
{"pm_by_vuart", required_argument, 0, CMD_OPT_PM_BY_VUART},
|
||||
{0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -924,6 +933,10 @@ main(int argc, char *argv[])
|
||||
pm_notify_channel = PWR_EVENT_NOTIFY_UART;
|
||||
|
||||
break;
|
||||
case CMD_OPT_PM_BY_VUART:
|
||||
if (parse_pm_by_vuart(optarg) != 0)
|
||||
errx(EX_USAGE, "invalid pm-by-vuart params %s", optarg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(0);
|
||||
default:
|
||||
|
Reference in New Issue
Block a user