hv: pgtable: add pgtable_create_root

Add pgtable_create_root to allocate a page for PMl4 page table page.

Tracked-On: #5830
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Li Fei1 2021-03-09 10:59:42 +08:00 committed by wenlingz
parent eb52e2193a
commit 596c349600
4 changed files with 8 additions and 2 deletions

View File

@ -503,7 +503,7 @@ int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *v
vm->hw.created_vcpus = 0U;
init_ept_pgtable(&vm->arch_vm.ept_pgtable, vm->vm_id);
vm->arch_vm.nworld_eptp = alloc_ept_page(vm);
vm->arch_vm.nworld_eptp = pgtable_create_root(&vm->arch_vm.ept_pgtable);
sanitize_pte((uint64_t *)vm->arch_vm.nworld_eptp, &vm->arch_vm.ept_pgtable);
(void)memcpy_s(&vm->uuid[0], sizeof(vm->uuid),

View File

@ -307,7 +307,7 @@ void init_paging(void)
}
/* Allocate memory for Hypervisor PML4 table */
ppt_mmu_pml4_addr = alloc_page(ppt_pgtable.pool);
ppt_mmu_pml4_addr = pgtable_create_root(&ppt_pgtable);
/* Map all memory regions to UC attribute */
pgtable_add_map((uint64_t *)ppt_mmu_pml4_addr, 0UL, 0UL, high64_max_ram - 0UL, attr_uc, &ppt_pgtable);

View File

@ -430,6 +430,11 @@ void pgtable_add_map(uint64_t *pml4_page, uint64_t paddr_base, uint64_t vaddr_ba
}
}
void *pgtable_create_root(const struct pgtable *table)
{
return (uint64_t *)alloc_page(table->pool);
}
/**
* @pre (pml4_page != NULL) && (pg_size != NULL)
*/

View File

@ -304,6 +304,7 @@ static inline uint64_t pdpte_large(uint64_t pdpte)
return pdpte & PAGE_PSE;
}
void *pgtable_create_root(const struct pgtable *table);
/**
*@pre (pml4_page != NULL) && (pg_size != NULL)
*/