HV: Add walk_ept_table and get_ept_entry APIs

The walk_ept_table API is used to walk through EPT table for getting
all of present pages, user can get each page entry and its size
from the walk_ept_table callback.

The get_ept_entry is used to getting EPT pointer of the vm, if current
context of mv is secure world, return secure world EPT pointer, otherwise
return normal world EPT pointer.

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-13 20:04:08 +08:00
committed by ACRN System Integration
parent f81585eb3d
commit f320130d58
2 changed files with 89 additions and 8 deletions

View File

@@ -8,6 +8,8 @@
#define EPT_H
#include <types.h>
typedef void (*pge_handler)(uint64_t *pgentry, uint64_t size);
/**
* Invalid HPA is defined for error checking,
* according to SDM vol.3A 4.1.4, the maximum
@@ -104,6 +106,28 @@ 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 Get EPT pointer of the vm
*
* @param[in] vm the pointer that points to VM data structure
*
* @retval If the current context of vm is SECURE_WORLD, return EPT pointer of
* secure world, otherwise return EPT pointer of normal world.
*/
void *get_ept_entry(struct acrn_vm *vm);
/**
* @brief Walking through EPT table
*
* @param[in] vm the pointer that points to VM data structure
* @param[in] cb the pointer that points to walk_ept_table callback, the callback
* will be invoked when getting a present page entry from EPT, and
* the callback could get the page entry and page size parameters.
*
* @return None
*/
void walk_ept_table(struct acrn_vm *vm, pge_handler cb);
/**
* @brief EPT misconfiguration handling
*