From 469ce711c583efe72170a61a209cfe2e32f3cdaf Mon Sep 17 00:00:00 2001 From: Kaige Fu Date: Tue, 2 Apr 2019 20:46:51 +0000 Subject: [PATCH] DM: Add new parameter --rtvm for soft/hard real-time guest This patch add one new parameter --rtvm to indicate if the guest is a RTVM or not. For RTVM, it may be not interference by SOS. Tracked-On: #2865 Signed-off-by: Kaige Fu Acked-by: Eddie Dong --- devicemodel/core/main.c | 9 ++++++++- devicemodel/core/vmmapi.c | 5 +++++ devicemodel/include/dm.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 6e237f561..559d4b882 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -88,6 +88,7 @@ uint8_t trusty_enabled; char *mac_seed; bool stdio_in_use; bool lapic_pt; +bool is_rtvm; bool skip_pci_mem64bar_workaround = false; static int virtio_msix = 1; @@ -172,7 +173,8 @@ usage(int code) " its params: threshold/s,probe-period(s),delay_time(ms),delay_duration(ms)\n" " --virtio_poll: enable virtio poll mode with poll interval with ns\n" " --vtpm2: Virtual TPM2 args: sock_path=$PATH_OF_SWTPM_SOCKET\n" - " --lapic_pt: enable local apic passthrough\n", + " --lapic_pt: enable local apic passthrough\n" + " --rtvm: indicate that the guest is rtvm\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), ""); @@ -708,6 +710,7 @@ enum { CMD_OPT_INTR_MONITOR, CMD_OPT_VTPM2, CMD_OPT_LAPIC_PT, + CMD_OPT_RTVM, }; static struct option long_options[] = { @@ -747,6 +750,7 @@ static struct option long_options[] = { {"intr_monitor", required_argument, 0, CMD_OPT_INTR_MONITOR}, {"vtpm2", required_argument, 0, CMD_OPT_VTPM2}, {"lapic_pt", no_argument, 0, CMD_OPT_LAPIC_PT}, + {"rtvm", no_argument, 0, CMD_OPT_RTVM}, {0, 0, 0, 0 }, }; @@ -894,6 +898,9 @@ dm_run(int argc, char *argv[]) case CMD_OPT_LAPIC_PT: lapic_pt = true; break; + case CMD_OPT_RTVM: + is_rtvm = true; + break; case CMD_OPT_VTPM2: if (acrn_parse_vtpm2(optarg) != 0) { errx(EX_USAGE, "invalid vtpm2 param %s", optarg); diff --git a/devicemodel/core/vmmapi.c b/devicemodel/core/vmmapi.c index 912004ddb..202f02faa 100644 --- a/devicemodel/core/vmmapi.c +++ b/devicemodel/core/vmmapi.c @@ -149,6 +149,11 @@ vm_create(const char *name, uint64_t req_buf) create_vm.vm_flag &= (~GUEST_FLAG_IO_COMPLETION_POLLING); } + if (is_rtvm) { + create_vm.vm_flag |= GUEST_FLAG_RT; + create_vm.vm_flag |= GUEST_FLAG_IO_COMPLETION_POLLING; + } + create_vm.req_buf = req_buf; while (retry > 0) { error = ioctl(ctx->fd, IC_CREATE_VM, &create_vm); diff --git a/devicemodel/include/dm.h b/devicemodel/include/dm.h index 994d48505..6dec932bc 100644 --- a/devicemodel/include/dm.h +++ b/devicemodel/include/dm.h @@ -46,6 +46,7 @@ extern char *vmname; extern bool stdio_in_use; extern char *mac_seed; extern bool lapic_pt; +extern bool is_rtvm; int vmexit_task_switch(struct vmctx *ctx, struct vhm_request *vhm_req, int *vcpu);