From b08dbd4141cbc33995e2f475b760d736db5a8526 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Thu, 16 Apr 2020 16:02:41 +0800 Subject: [PATCH] HV: fix wrong gpa start of hpa2 in ve820.c The current logic puts hpa2 above GPA 4G always, which is incorrect. Need to set gpa start of hpa2 right after hpa1 when hpa1 size is less then 2G; Tracked-On: #4458 Signed-off-by: Victor Sun --- hypervisor/arch/x86/guest/ve820.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hypervisor/arch/x86/guest/ve820.c b/hypervisor/arch/x86/guest/ve820.c index 05344a7d2..98ea895fe 100644 --- a/hypervisor/arch/x86/guest/ve820.c +++ b/hypervisor/arch/x86/guest/ve820.c @@ -190,6 +190,8 @@ void create_prelaunched_vm_e820(struct acrn_vm *vm) } else { /* need to revise length of hpa1 entry to its actual size */ vm->e820_entries[ENTRY_HPA1].length = vm_config->memory.size - MEM_1M; + /* need to set gpa_start for hpa2 */ + gpa_start = vm->e820_entries[ENTRY_HPA1].baseaddr + vm->e820_entries[ENTRY_HPA1].length; if ((vm_config->memory.size < MEM_2G) && (remaining_hpa2_size > (MEM_2G - vm_config->memory.size))) { /* need to split hpa2 and add an entry for hpa2_lo */