mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 11:50:30 +00:00
hv: mmu: add pre-assumption for hpa2gpa
They're: (a) only SOS would use hpa2gpa and (b) the GPA and HPA in SOS is identical mapping. Rename hpa2gpa to vm0_hpa2gpa then. Tracked-On: #1124 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -103,19 +103,12 @@ uint64_t gpa2hpa(struct vm *vm, uint64_t gpa)
|
||||
return local_gpa2hpa(vm, gpa, NULL);
|
||||
}
|
||||
|
||||
uint64_t hpa2gpa(struct vm *vm, uint64_t hpa)
|
||||
/**
|
||||
* @pre: the gpa and hpa are identical mapping in SOS.
|
||||
*/
|
||||
uint64_t vm0_hpa2gpa(uint64_t hpa)
|
||||
{
|
||||
uint64_t *pgentry, pg_size = 0UL;
|
||||
|
||||
pgentry = lookup_address((uint64_t *)vm->arch_vm.m2p,
|
||||
hpa, &pg_size, PTT_EPT);
|
||||
if (pgentry == NULL) {
|
||||
pr_err("VM %d hpa2gpa: failed for hpa 0x%llx",
|
||||
vm->vm_id, hpa);
|
||||
ASSERT(false, "hpa2gpa not found");
|
||||
}
|
||||
return ((*pgentry & (~(pg_size - 1UL)))
|
||||
| (hpa & (pg_size - 1UL)));
|
||||
return hpa;
|
||||
}
|
||||
|
||||
int ept_violation_vmexit_handler(struct vcpu *vcpu)
|
||||
|
@@ -131,7 +131,8 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
|
||||
hpa, gpa_rebased, size, EPT_RWX | EPT_WB);
|
||||
|
||||
/* Get the gpa address in SOS */
|
||||
gpa = hpa2gpa(vm0, hpa);
|
||||
gpa = vm0_hpa2gpa(hpa);
|
||||
|
||||
/* Unmap trusty memory space from sos ept mapping*/
|
||||
ept_mr_del(vm0, (uint64_t *)vm0->arch_vm.nworld_eptp,
|
||||
gpa, size);
|
||||
|
Reference in New Issue
Block a user