mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 15:45:05 +00:00
hv: mmu: replace dynamic memory allocation in memory
Replace dynamic memory allocation in memory management with static memory allocation. Since the static memory allocation can guarantee the allocation never failed, so split_large_page and construct_pgentry don't need to return a errno any more. Besides, the destroy_ept don't need to free page any more. Instead, it would memset the eptp to 0 to make sure we can't walk this paging table again. Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -356,7 +356,7 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id)
|
||||
static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
struct vm *target_vm, const struct vm_memory_region *region)
|
||||
{
|
||||
uint64_t hpa, base_paddr;
|
||||
uint64_t hpa, base_paddr, gpa_end;
|
||||
uint64_t prot;
|
||||
uint64_t *pml4_page;
|
||||
|
||||
@@ -366,6 +366,14 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
gpa_end = region->gpa + region->size;
|
||||
if ((gpa_end > vm->arch_vm.ept_mem_ops.info->ept.top_address_space) &&
|
||||
(region->gpa < TRUSTY_EPT_REBASE_GPA)) {
|
||||
pr_err("%s, invalid gpa: 0x%llx, size: 0x%llx, top_address_space: 0x%llx", __func__,
|
||||
region->gpa, region->size, vm->arch_vm.ept_mem_ops.info->ept.top_address_space);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(ACRN_DBG_HYCALL,
|
||||
"[vm%d] type=%d gpa=0x%x vm0_gpa=0x%x size=0x%x",
|
||||
target_vm->vm_id, region->type, region->gpa,
|
||||
|
||||
Reference in New Issue
Block a user