From c8a4ca6c7868324c63797db66ec974621c2f835e Mon Sep 17 00:00:00 2001 From: Vijay Dhanraj Date: Fri, 6 Dec 2019 19:14:25 -0800 Subject: [PATCH] HV: Extend non-contiguous HPA for hybrid scenario This patch extends non-contiguous HPA allocations for pre-launched VMs in hybrid scenario. Tracked-On: #4217 Signed-off-by: Vijay Dhanraj Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vm.c | 7 +++++++ hypervisor/include/arch/x86/vm_config.h | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index c9fa2eafb..593e519b2 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -321,6 +321,13 @@ static void create_sos_vm_e820(struct acrn_vm *vm) filter_mem_from_sos_e820(vm, vm_config->memory.start_hpa, vm_config->memory.start_hpa + vm_config->memory.size); sos_vm_config->memory.size -= vm_config->memory.size; + + /* if HPA2 is available, filter it out as well*/ + if (vm_config->memory.size_hpa2 != 0UL) { + filter_mem_from_sos_e820(vm, vm_config->memory.start_hpa2, + vm_config->memory.start_hpa2 + vm_config->memory.size_hpa2); + sos_vm_config->memory.size -= vm_config->memory.size_hpa2; + } } } } diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index f4a0672ea..b11431251 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -37,8 +37,9 @@ enum acrn_vm_load_order { struct acrn_vm_mem_config { uint64_t start_hpa; /* the start HPA of VM memory configuration, for pre-launched VMs only */ uint64_t size; /* VM memory size configuration */ - uint64_t start_hpa2; /* the start HPA of VM memory configuration, for pre-launched VMs only */ - uint64_t size_hpa2; /* VM shared memory size configuration */ + uint64_t start_hpa2; /* Start of second HPA for non-contiguous allocations in VM memory configuration, + for pre-launched VMs only */ + uint64_t size_hpa2; /* Size of second HPA for non-contiguous allocations in VM memory configuration */ }; struct target_vuart {