dm: add support of high MMIO mapping

1G PCI hole is added just after 4G address which is used as the
PCI high MMIO address space. Guest high memory is mapped from 5G
address for both EPT and device model user space address. Guest
e820 table and API vm_map_gpa are updated accordingly.

Tracked-On: #2577
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Jian Jun Chen
2019-02-25 16:28:14 +08:00
committed by wenlingz
parent 32925c10bd
commit 29b1ebcd43
9 changed files with 34 additions and 26 deletions

View File

@@ -652,14 +652,7 @@ int hugetlb_setup_memory(struct vmctx *ctx)
ctx->highmem =
ALIGN_DOWN(ctx->highmem, hugetlb_priv[HUGETLB_LV1].pg_size);
/*
* High BIOS resides right below 4GB.
* Therefore, at least 4GB of memory space is needed.
*/
if (ctx->biosmem > 0 || ctx->highmem > 0)
total_size = 4 * GB + ctx->highmem;
else
total_size = ctx->lowmem;
total_size = ctx->highmem_gpa_base + ctx->highmem;
/* check & set hugetlb level memory size for lowmem/biosmem/highmem */
lowmem = ctx->lowmem;
@@ -735,7 +728,8 @@ int hugetlb_setup_memory(struct vmctx *ctx)
}
/* mmap highmem */
if (mmap_hugetlbfs(ctx, 4 * GB, get_highmem_param, adj_highmem_param) < 0) {
if (mmap_hugetlbfs(ctx, ctx->highmem_gpa_base,
get_highmem_param, adj_highmem_param) < 0) {
perror("highmem mmap failed");
goto err;
}
@@ -772,8 +766,9 @@ int hugetlb_setup_memory(struct vmctx *ctx)
/* map ept for highmem */
if (ctx->highmem > 0) {
if (vm_map_memseg_vma(ctx, ctx->highmem, 4 * GB,
(uint64_t)(ctx->baseaddr + 4 * GB), PROT_ALL) < 0)
if (vm_map_memseg_vma(ctx, ctx->highmem, ctx->highmem_gpa_base,
(uint64_t)(ctx->baseaddr + ctx->highmem_gpa_base),
PROT_ALL) < 0)
goto err;
}