From f3327364c315a9c5f3989599bcf9b22e946e44c4 Mon Sep 17 00:00:00 2001 From: Li Fei1 Date: Tue, 27 Apr 2021 13:41:50 +0800 Subject: [PATCH] hv: mmu: fix a minor bug We should only map [low32_max_ram, 4G) MMIO region as UC attribute, not map [low32_max_ram, low32_max_ram + 4G) region as UC attribute. Otherwise, the HV will complain [4G, low32_max_ram + 4G) region has already mapped. Tracked-On: #5830 Signed-off-by: Li Fei1 --- hypervisor/arch/x86/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index 0b077f4e3..77c7bc92d 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -307,8 +307,8 @@ void init_paging(void) high64_max_ram - MEM_4G, PAGE_ATTR_USER | PAGE_CACHE_WB, &ppt_pgtable); /* Map [low32_max_ram, 4G) and [HI_MMIO_START, HI_MMIO_END) MMIO regions as UC attribute */ - pgtable_add_map((uint64_t *)ppt_mmu_pml4_addr, low32_max_ram, low32_max_ram, MEM_4G, - PAGE_ATTR_USER | PAGE_CACHE_UC, &ppt_pgtable); + pgtable_add_map((uint64_t *)ppt_mmu_pml4_addr, low32_max_ram, low32_max_ram, + MEM_4G - low32_max_ram, PAGE_ATTR_USER | PAGE_CACHE_UC, &ppt_pgtable); if ((HI_MMIO_START != ~0UL) && (HI_MMIO_END != 0UL)) { pgtable_add_map((uint64_t *)ppt_mmu_pml4_addr, HI_MMIO_START, HI_MMIO_START, (HI_MMIO_END - HI_MMIO_START), PAGE_ATTR_USER | PAGE_CACHE_UC, &ppt_pgtable);