hv: ept: move EPT PML4 table allocation to create_vm

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Li, Fei1 2018-07-17 16:33:10 +08:00 committed by lijinxia
parent 1815a1bb01
commit 38e2e45d83
2 changed files with 9 additions and 4 deletions

View File

@ -495,10 +495,6 @@ int ept_mmap(struct vm *vm, uint64_t hpa,
/* Setup memory map parameters */
map_params.page_table_type = PTT_EPT;
if (vm->arch_vm.nworld_eptp == NULL) {
vm->arch_vm.nworld_eptp = alloc_paging_struct();
vm->arch_vm.m2p = alloc_paging_struct();
}
map_params.pml4_base = vm->arch_vm.nworld_eptp;
map_params.pml4_inverted = vm->arch_vm.m2p;

View File

@ -110,6 +110,15 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
/* gpa_lowtop are used for system start up */
vm->hw.gpa_lowtop = 0UL;
vm->arch_vm.nworld_eptp = alloc_paging_struct();
vm->arch_vm.m2p = alloc_paging_struct();
if ((vm->arch_vm.nworld_eptp == NULL) ||
(vm->arch_vm.m2p == NULL)) {
pr_fatal("%s, alloc memory for EPTP failed\n", __func__);
return -ENOMEM;
}
/* Only for SOS: Configure VM software information */
/* For UOS: This VM software information is configure in DM */
if (is_vm0(vm)) {