From d0eb83aa0c458816e672078e80d74ae09bd243b0 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Tue, 22 Jan 2019 09:37:04 +0800 Subject: [PATCH] HV: move Kconfig IOREQ_POLLING to acrn vm config Previously I/O emulation completion mode mode was configured in Kconfig: config IOREQ_NOTIFICATION bool "Notification mode" help When I/O request is completed, SOS will mark the completion status and notify hypervisor via hypercall. Hypervisor will finish the post work when notification is received. config IOREQ_POLLING bool "Polling mode" help When I/O request is completed, SOS will only mark completion status without notifying hypervisor. Hypervisor will poll the completion status and finish the post work. Now move this configuration to guest_flags of acrn_vm_config struct. if ((vm_config->guest_flags & IO_COMPLETION_POLLING) != 0U) { I/O with polling; } else { I/O with notification; } Tracked-On: #2291 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/arch/x86/Kconfig | 22 ------------------- hypervisor/arch/x86/guest/vm.c | 8 +++---- hypervisor/partition/apl-mrb/vm_description.c | 3 ++- hypervisor/partition/dnv-cb2/vm_description.c | 4 ++-- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/hypervisor/arch/x86/Kconfig b/hypervisor/arch/x86/Kconfig index 0e0169b65..d15a7a39b 100644 --- a/hypervisor/arch/x86/Kconfig +++ b/hypervisor/arch/x86/Kconfig @@ -40,28 +40,6 @@ config PARTITION_MODE endchoice -choice - prompt "I/O emulation completion mode" - default IOREQ_NOTIFICATION - help - Select the mode of I/O emulation completion - -config IOREQ_NOTIFICATION - bool "Notification mode" - help - When I/O request is completed, SOS will mark the completion status and - notify hypervisor via hypercall. Hypervisor will finish the post work - when notification is received. - -config IOREQ_POLLING - bool "Polling mode" - help - When I/O request is completed, SOS will only mark completion status - without notifying hypervisor. Hypervisor will poll the completion - status and finish the post work. - -endchoice - config BOARD string "Target board" help diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 2bc712df1..f3adcf7a1 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -226,10 +226,10 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ /* Populate return VM handle */ *rtn_vm = vm; vm->sw.io_shared_page = NULL; -#ifdef CONFIG_IOREQ_POLLING - /* Now, enable IO completion polling mode for all VMs with CONFIG_IOREQ_POLLING. */ - vm->sw.is_completion_polling = true; -#endif + if ((vm_config->guest_flags & IO_COMPLETION_POLLING) != 0U) { + /* enable IO completion polling mode per its guest flags in vm_config. */ + vm->sw.is_completion_polling = true; + } status = set_vcpuid_entries(vm); if (status == 0) { vm->state = VM_CREATED; diff --git a/hypervisor/partition/apl-mrb/vm_description.c b/hypervisor/partition/apl-mrb/vm_description.c index 33375829e..82b6a6aa0 100644 --- a/hypervisor/partition/apl-mrb/vm_description.c +++ b/hypervisor/partition/apl-mrb/vm_description.c @@ -143,6 +143,7 @@ struct vm_config_arraies vm_config_partition = { { .type = PRE_LAUNCHED_VM, .pcpu_bitmap = (PLUG_CPU(0) | PLUG_CPU(2)), + .guest_flags = IO_COMPLETION_POLLING, .memory.start_hpa = 0x100000000UL, .memory.size = 0x20000000UL, /* uses contiguous memory from host */ .vm_vuart = true, @@ -155,7 +156,7 @@ struct vm_config_arraies vm_config_partition = { { .type = PRE_LAUNCHED_VM, .pcpu_bitmap = (PLUG_CPU(1) | PLUG_CPU(3)), - .guest_flags = LAPIC_PASSTHROUGH, + .guest_flags = LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING, .memory.start_hpa = 0x120000000UL, .memory.size = 0x20000000UL, /* uses contiguous memory from host */ .vm_vuart = true, diff --git a/hypervisor/partition/dnv-cb2/vm_description.c b/hypervisor/partition/dnv-cb2/vm_description.c index 449da0cae..f6bb32a0c 100644 --- a/hypervisor/partition/dnv-cb2/vm_description.c +++ b/hypervisor/partition/dnv-cb2/vm_description.c @@ -177,7 +177,7 @@ struct vm_config_arraies vm_config_partition = { { .type = PRE_LAUNCHED_VM, .pcpu_bitmap = (PLUG_CPU(0) | PLUG_CPU(2) | PLUG_CPU(4) | PLUG_CPU(6)), - .guest_flags = LAPIC_PASSTHROUGH, + .guest_flags = LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING, .memory.start_hpa = 0x100000000UL, .memory.size = 0x80000000UL, /* uses contiguous memory from host */ .vm_vuart = true, @@ -190,7 +190,7 @@ struct vm_config_arraies vm_config_partition = { { .type = PRE_LAUNCHED_VM, .pcpu_bitmap = (PLUG_CPU(1) | PLUG_CPU(3) | PLUG_CPU(5) | PLUG_CPU(7)), - .guest_flags = LAPIC_PASSTHROUGH, + .guest_flags = LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING, .memory.start_hpa = 0x180000000UL, .memory.size = 0x80000000UL, /* uses contiguous memory from host */ .vm_vuart = true,