mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
hv: ept: refine ept_mr_add base on mmu_add
Refine ept_mr_add base on mmu_add. The old map_mem could be removed once this was done. Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -422,6 +422,7 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
{
|
||||
uint64_t hpa, base_paddr;
|
||||
uint64_t prot;
|
||||
uint64_t *pml4_page;
|
||||
|
||||
if ((region->size & (CPU_PAGE_SIZE - 1UL)) != 0UL) {
|
||||
pr_err("%s: [vm%d] map size 0x%x is not page aligned",
|
||||
@@ -442,6 +443,7 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
pml4_page = (uint64_t *)target_vm->arch_vm.nworld_eptp;
|
||||
if (region->type != MR_DEL) {
|
||||
prot = 0UL;
|
||||
/* access right */
|
||||
@@ -467,11 +469,10 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
prot |= EPT_UNCACHED;
|
||||
}
|
||||
/* create gpa to hpa EPT mapping */
|
||||
return ept_mr_add(target_vm, hpa,
|
||||
return ept_mr_add(target_vm, pml4_page, hpa,
|
||||
region->gpa, region->size, prot);
|
||||
} else {
|
||||
return ept_mr_del(target_vm,
|
||||
(uint64_t *)target_vm->arch_vm.nworld_eptp,
|
||||
return ept_mr_del(target_vm, pml4_page,
|
||||
region->gpa, region->size);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user