HV: Add ept_flush_leaf_page API

The ept_flush_leaf_page API is used to flush address space
from a ept page entry, user can use it to match walk_ept_mr to
flush VM address space.

Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu 2019-06-14 14:26:03 +08:00 committed by ACRN System Integration
parent f320130d58
commit 7018a13cb6
2 changed files with 28 additions and 0 deletions

View File

@ -156,6 +156,23 @@ void ept_del_mr(struct acrn_vm *vm, uint64_t *pml4_page, uint64_t gpa, uint64_t
}
}
/**
* @pre pge != NULL && size > 0.
*/
void ept_flush_leaf_page(uint64_t *pge, uint64_t size)
{
uint64_t hpa = INVALID_HPA;
void *hva = NULL;
if ((*pge & EPT_MT_MASK) != EPT_UNCACHED) {
hpa = (*pge & (~(size - 1UL)));
hva = hpa2hva(hpa);
stac();
flush_address_space(hva, size);
clac();
}
}
/**
* @pre: vm != NULL.
*/

View File

@ -106,6 +106,17 @@ void ept_modify_mr(struct acrn_vm *vm, uint64_t *pml4_page, uint64_t gpa,
void ept_del_mr(struct acrn_vm *vm, uint64_t *pml4_page, uint64_t gpa,
uint64_t size);
/**
* @brief Flush address space from the page entry
*
* @param[in] pge the pointer that points to the page entry
*
* @param[in] size the size of the page
*
* @return None
*/
void ept_flush_leaf_page(uint64_t *pge, uint64_t size);
/**
* @brief Get EPT pointer of the vm
*