hv: mmu: reimplement mmu_add to add page table mapping

The ept_mr_add still use the old map_mem. The old API will
keep for a peroid until the SOS the same refine be merged.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1
2018-07-22 20:15:41 +08:00
committed by lijinxia
parent c7799584dc
commit e2516fa6a0
5 changed files with 210 additions and 18 deletions

View File

@@ -324,6 +324,9 @@ void enable_smep(void);
void init_paging(void);
int map_mem(struct map_params *map_params, void *paddr, void *vaddr,
uint64_t size, uint32_t flags);
int mmu_add(uint64_t *pml4_page, uint64_t paddr_base,
uint64_t vaddr_base, uint64_t size,
uint64_t prot, enum _page_table_type ptt);
int mmu_modify_or_del(uint64_t *pml4_page,
uint64_t vaddr_base, uint64_t size,
uint64_t prot_set, uint64_t prot_clr,

View File

@@ -68,12 +68,18 @@ static inline uint64_t *pte_offset(uint64_t *pde, uint64_t addr)
return pde_page_vaddr(*pde) + pte_index(addr);
}
static inline uint64_t get_pte(uint64_t *pte)
/*
* pgentry may means pml4e/pdpte/pde/pte
*/
static inline uint64_t get_pgentry(uint64_t *pte)
{
return *pte;
}
static inline void set_pte(uint64_t *ptep, uint64_t pte)
/*
* pgentry may means pml4e/pdpte/pde/pte
*/
static inline void set_pgentry(uint64_t *ptep, uint64_t pte)
{
*ptep = pte;
}